Robot Motion with RRC

This example demonstrates a movement for an ABB robot using COMPAS RRC python API.
To run the example:
Start the robot where RRC driver is installed
Start ROS driver using Docker (see example
docker-compose.yml
below)Run the code example
For more details, check the COMPAS RRC Start repository.
import compas_rrc as rrc
if __name__ == '__main__':
# Create Ros Client
ros = rrc.RosClient()
ros.run()
# Create ABB Client
abb = rrc.AbbClient(ros, '/rob1')
print('Connected.')
# Set tool
abb.send(rrc.SetTool('tool0'))
# Set work object
abb.send(rrc.SetWorkObject('wobj0'))
# Read current frame position
frame = abb.send_and_wait(rrc.GetFrame())
# Print received values
print(frame)
# Change the x-value [mm]
frame.point[0] -= 50
# Set speed [mm/s]
speed = 100
# Move robot the new pos
done = abb.send_and_wait(rrc.MoveToFrame(frame, speed, rrc.Zone.FINE, rrc.Motion.LINEAR))
# Print feedback
print('Feedback = ', done)
# End of Code
print('Finished')
# Close client
ros.close()
ros.terminate()
version: '3'
services:
ros-master:
image: compasrrc/compas_rrc_driver:v1.1.0
container_name: ros-master
environment:
- ROS_HOSTNAME=ros-master
- ROS_MASTER_URI=http://ros-master:11311
ports:
- "11311:11311"
command:
- roscore
ros-bridge:
image: compasrrc/compas_rrc_driver:v1.1.0
container_name: ros-bridge
environment:
- ROS_HOSTNAME=ros-bridge
- ROS_MASTER_URI=http://ros-master:11311
ports:
- "9090:9090"
depends_on:
- ros-master
command:
- roslaunch
- --wait
- rosbridge_server
- rosbridge_websocket.launch
- unregister_timeout:=28800 # This horribly long timeout of 8 hours is to workaround this issue: https://github.com/RobotWebTools/rosbridge_suite/issues/138
abb-driver:
image: compasrrc/compas_rrc_driver:v1.1.0
container_name: abb-driver
environment:
- ROS_HOSTNAME=abb-driver
- ROS_MASTER_URI=http://ros-master:11311
depends_on:
- ros-master
command:
- roslaunch
- --wait
- compas_rrc_driver
- bringup.launch
- robot_ip:=host.docker.internal
- robot_streaming_port:=30101
- robot_state_port:=30201
- namespace:=rob1