API Reference

The API of COMPAS RRC is minimal and very easy to understand.

ABB Client

This is the primary way to interact with robots. It contains two methods that are used for almost all communication:

  • send: Sends a command without waiting for feedback.

  • send_and_wait: Sends a command and waits for the robot to respond before continuing to the next line of code.

class compas_rrc.AbbClient(ros, namespace='/')[source]

Bases: object

Client used to communicate with ABB robots via ROS.

This client handles all communication over ROS topics, and implements blocking behaviors as an application-level construct.

Examples

>>> from compas_fab.backends import RosClient
>>> from compas_rrc import *
>>> ros = RosClient()
>>> abb = AbbClient(ros)
>>> abb.run()
>>> abb.ros.is_connected
True
>>> abb.close()
version_check()[source]
ensure_protocol_version()[source]
run(timeout=None)[source]

Starts the event loop in a thread.

run_forever()[source]

Starts the event loop and blocks.

close()[source]

Close the connection to the robot.

terminate()[source]

Terminate the event loop that controls the connection.

Once terminated, the program must exit, as the underlying event-loop cannot be restarted.

send(instruction)[source]

Sends an instruction to the robot without waiting.

Instructions can indicate that feedback is required or not. If the instruction sent does not require feedback, this method returns None. However, if the instruction needs feedback (i.e. feedback_level is greater than zero), the method returns a future result object that can be used to wait for completion.

Returns: FutureResult

Represent the future value of the feedback request. This method will return immediately, and this object can be used to wait or react to the feedback whenever it becomes available.

Parameters

instruction – ROS Message representing the instruction to send.

Returns

FutureResult – If feedback_level is greater than zero, the return is a future object that allows to defer waiting for results.

send_and_wait(instruction, timeout=None)[source]

Send instruction and wait for feedback.

This is a blocking call, it will only return once the client send the requested feedback. For this reason, the feedback_level of the instruction parameter needs to be greater than zero.

Parameters
  • instruction – ROS Message representing the instruction to send.

  • timeout (int) – Timeout in seconds to wait before raising an exception. Optional.

send_and_subscribe(instruction, callback)[source]
feedback_callback(message)[source]
class compas_rrc.ExecutionLevel[source]

Bases: object

Defines the execution level of an instruction.

ROBOT = 0
RECEIVER = 1
SENDER = 2
MASTER = 10

Handling feedback

For cases in which you wish to send a command and wait for feedback, the easiest option is to use send_and_wait, but for fine-grained control of when to wait for feedback, the send methods returns an object of type FutureResult. The call is non-blocking, so it returns immediatelly but when the result() method of the future result is invoked, it will block until the result is eventually available.

class compas_rrc.FeedbackLevel[source]

Bases: object

Represents default valid feedback levels.

NONE = 0
DONE = 1
class compas_rrc.FutureResult[source]

Bases: object

Represents a future result value.

Futures are the result of asynchronous operations but allow to explicitely control when to block and wait for its completion.

result(timeout=None)[source]

Return the feedback value returned by the instruction.

If the instruction has not yet returned feedback, it will wait up to timeout seconds. If the timeout expires, the method will raise an exception.

_set_result(value)[source]

Robot joints and External axes

class compas_rrc.RobotJoints(*values)[source]

Bases: object

Represents a configuration for robot joints

property rax_1
property rax_2
property rax_3
property rax_4
property rax_5
property rax_6
class compas_rrc.ExternalAxes(*values)[source]

Bases: object

Represents a configuration for external axes

property eax_a
property eax_b
property eax_c
property eax_d
property eax_e
property eax_f

Motion instructions

class compas_rrc.MoveToJoints(joints, ext_axes, speed, zone, feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Move to configuration is a call that moves the robot with axis values.

RAPID Instruction: MoveAbsJ

joints

Robot joint positions.

Type

compas_rrc.common.RobotJoints or list of float

ext_axes

External axes positions.

Type

compas_rrc.common.ExternalAxes or list of float

speed

Integer specifying TCP translational speed in mm/s. Min=``0.01``.

Type

int

zone

Zone data. Predefined in the robot contrller, only Zone fine will do a stop point all others are fly by points

Type

Zone

feedback_level

Integer specifying requested feedback level. Default=``0`` (i.e. NONE). Feedback level is instruction-specific but the value 1 always represents completion of the instruction.

Type

int

class compas_rrc.MoveToFrame(frame, speed, zone, motion_type='J', feedback_level=0)[source]

Bases: compas_rrc.motion.MoveGeneric

Move to frame is a call that moves the robot in the cartisian space.

RAPID Instruction: MoveJ or MoveL

– old Text – Represents a move joint instruction.

frame

Target frame.

Type

compas.geometry.Frame

speed

Integer specifying TCP translational speed in mm/s. Min=``0.01``.

Type

int

zone

Zone data. Predefined in the robot contrller, only Zone fine will do a stop point all others are fly by points

Type

Zone

motion_type

Motion type. Defaults to Joint.

Type

Motion

feedback_level

Integer specifying requested feedback level. Default=``0`` (i.e. NONE). Feedback level is instruction-specific but the value 1 always represents completion of the instruction.

Type

int

Note

ABB Documentation - Usage:

MoveJ is used to move the robot quickly from one point to another when that movement does not have to be in a straight line. The robot and external axes move to the destination position along a non-linear path. All axes reach the destination position at the same time. This instruction can only be used in the main task T_ROB1 or, if in a MultiMove system, in Motion tasks.

class compas_rrc.MoveToRobtarget(frame, ext_axes, speed, zone, motion_type='J', feedback_level=0)[source]

Bases: compas_rrc.motion.MoveGeneric

Move to frame is a call that moves the robot in the cartisian space.

RAPID Instruction: MoveJ or MoveL

frame

Target frame.

Type

compas.geometry.Frame

ext_axes

External axes positions.

Type

compas_rrc.common.ExternalAxes or list of float

speed

Integer specifying TCP translational speed in mm/s. Min=``0.01``.

Type

int

zone

Zone data. Predefined in the robot controller, only Zone fine will do a stop point all others are fly by points

Type

Zone

motion_type

Motion type. Defaults to Joint.

Type

Motion

feedback_level

Integer specifying requested feedback level. Default=``0`` (i.e. NONE). Feedback level is instruction-specific but the value 1 always represents completion of the instruction.

Type

int

class compas_rrc.Motion[source]

Bases: object

Describes the valid motion types.

LINEAR = 'L'
JOINT = 'J'
class compas_rrc.Zone[source]

Bases: object

Describes the valid zone data definitions.

FINE = -1
Z0 = 0
Z1 = 1
Z5 = 5
Z10 = 10
Z15 = 15
Z20 = 20
Z30 = 30
Z40 = 40
Z50 = 50
Z60 = 60
Z80 = 80
Z100 = 100
Z150 = 150
Z200 = 200

Get Current Status

class compas_rrc.GetFrame(feedback_level=1)[source]

Bases: compas_rrc.utility.GetRobtarget

Query the current frame of the robot.

RAPID Instruction: GetRobT

parse_feedback(result)[source]
class compas_rrc.GetJoints(feedback_level=1)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Get joints is a call that queries the axis values of the robot.

RAPID Instruction: GetJointT

parse_feedback(result)[source]
class compas_rrc.GetRobtarget(feedback_level=1)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Query the current robtarget (defined as frame + external axes) of the robot.

RAPID Instruction: GetRobT

parse_feedback(result)[source]

Input/Output

class compas_rrc.ReadAnalog(io_name, feedback_level=1)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Read analog is a call that returns the value of an analog input signal.

RAPID Instruction: ReadAi

parse_feedback(result)[source]
class compas_rrc.ReadDigital(io_name, feedback_level=1)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Read digital is a call that returns the value of an digital input signal.

RAPID Instruction: ReadDi

parse_feedback(result)[source]
class compas_rrc.ReadGroup(io_name, feedback_level=1)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Read group is a call that returns the value of an digital group input signal.

RAPID Instruction: ReadGi

parse_feedback(result)[source]
class compas_rrc.SetAnalog(io_name, value, feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Set analog is a call that sets the value of an analog output signal (float).

RAPID Instruction: SetAo

class compas_rrc.SetDigital(io_name, value, feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Set digital is a call that sets the value of an digital output signal (0 or 1).

RAPID Instruction: SetDo

class compas_rrc.SetGroup(io_name, value, feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Set group is a call that sets the value of an digital group output signal (Integer Value, depending on the size of the group ).

RAPID Instruction: SetGo

class compas_rrc.PulseDigital(io_name, pulse_time, feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Pulse digital is a call that sets the value to high of an digital output signal for a certain time.

RAPID Instruction: PulseDo

Custom instructions

This library has support for non-standard instructions. Simply pass an instance of CustomInstruction specifying an instruction name, and this will be evaluated and executed on the robot’s side, if a RAPID procedure with that name exists on the controller.

class compas_rrc.CustomInstruction(name, string_values=[], float_values=[], feedback_level=0, exec_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

Custom instruction is a call that calls a custom RAPID instruction. The name has to match to a RAPID procedure.

RAPID Instruction: CustomInstruction

Utility instructions

class compas_rrc.Noop(feedback_level=0)[source]

Bases: compas_fab.backends.ros.messages.std_msgs.ROSmsg

No-op is a call without any effect.

RAPID Instruction: Dummy