Simulation
Apart from being used with a real robot, the ROS driver can be used with ros2_control’s mock hardware or the URSim simulator (which is equivalent from the driver’s perspective).
Additionally, the robot can be simulated using Gazebo Classic or GZ Sim but that’s outside of this driver’s scope.
Usage with official UR simulator
The easiest way to use URSim is the Docker image provided by Universal Robots (See this link for a CB3-series image).
To start it, we’ve prepared a script:
ros2 run ur_client_library start_ursim.sh -m <ur_type>
With this, we can spin up a driver using
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=<ur_type> robot_ip:=192.168.56.101 launch_rviz:=true
You can view the polyscope GUI by opening http://192.168.56.101:6080/vnc.html.
When we now move the robot in Polyscope, the robot’s RViz visualization should move accordingly.
For details on the Docker image, please see the more detailed guide here.
Mock hardware
The package can simulate hardware with the ros2_control MockSystem
. This emulator enables an
environment for testing of “piping” of hardware and controllers, as well as testing robot’s
descriptions. For more details see ros2_control documentation
for more details.
Note
Some driver functionalities currently don’t work with mock hardware:
The TCP pose broadcaster does not work.
The passthrough trajectory controller does not function when calling the follow joint trajectory action.
The force mode controller also does not respond when trying to start force mode.
The GPIO controller cannot verify that it has changed the state of an I/O pin, so it will report a failure when trying to set an I/O pin.