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
– Iffeedback_level
is greater than zero, the return is a future object that allows to defer waiting for results.
- Returns:
-
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 theinstruction
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 thetimeout
expires, the method will raise an exception.
-
_set_result
(value)[source]
-
Robot joints and External axes
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
-
speed
Integer specifying TCP translational speed in mm/s. Min=``0.01``.
- Type
-
zone
Zone data. Predefined in the robot contrller, only Zone
fine
will do a stop point all others are fly by points- Type
-
feedback_level
Integer specifying requested feedback level. Default=``0`` (i.e.
NONE
). Feedback level is instruction-specific but the value1
always represents completion of the instruction.- Type
-
-
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.
-
speed
Integer specifying TCP translational speed in mm/s. Min=``0.01``.
- Type
-
zone
Zone data. Predefined in the robot contrller, only Zone
fine
will do a stop point all others are fly by points- Type
-
motion_type
Motion type. Defaults to Joint.
- Type
-
feedback_level
Integer specifying requested feedback level. Default=``0`` (i.e.
NONE
). Feedback level is instruction-specific but the value1
always represents completion of the instruction.- Type
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
orMoveL
-
frame
Target frame.
-
speed
Integer specifying TCP translational speed in mm/s. Min=``0.01``.
- Type
-
zone
Zone data. Predefined in the robot controller, only Zone
fine
will do a stop point all others are fly by points- Type
-
motion_type
Motion type. Defaults to Joint.
- Type
-
feedback_level
Integer specifying requested feedback level. Default=``0`` (i.e.
NONE
). Feedback level is instruction-specific but the value1
always represents completion of the instruction.- Type
-
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]
-
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