Robots in ROS


The following examples use the ROS backend and the MoveIt! planner for UR5 robots. Before running them, please make sure you have the ROS backend correctly configured and the UR5 Demo started.

Once ROS is running and MoveIt! planner has started with a robot, we can start interacting with the robot model. There are two basic ways to work with a robot model that is loaded in ROS.

Load model from ROS

This is the easiest and preferable way to load a robot model: request the full model to be loaded from ROS.

from compas_fab.backends import RosClient

with RosClient() as client:
    robot = client.load_robot()

    assert == 'ur5_robot'

Load model from URDF

Alternatively, the URDF model can be loaded from URDF files (stored locally or remotely):

from compas.robots import RobotModel

from compas_fab.backends import RosClient
from compas_fab.robots import Robot

with RosClient() as client:
    model = RobotModel.ur5()
    robot = Robot(model, client=client)

    assert len(robot.get_configurable_joint_names()) == 6