4. ROS2 Namespace

To aid in differentiating between multiple robots, most ROS2 topics are prefixed with a namespace. The ROS2 message bus is capable of integrating multiple robots, sensors and other nodes on the same network, namespaces can prevent collisions in such scenarios.

Here are a few tips and tricks related to the namespace:

  • Namespace is constructed with a serial number prefixed with ‘UR’.

  • URCapX backend contributions running in docker containers can read namespace from ROS2_NAMESPACE environment variable

Topic names and namespaces should follow the ROS2 recommendation “snake case”.(https://design.ros2.org/articles/topic_and_service_names.html)

4.1 Example topic name with namespace

When serial number is “20225300015” the topic name would be:

/UR20225300015/speed_fraction

4.2 Exceptions

There are few topics that are not prefixed with namespace. Reason for that is to keep compatibility with ROS2 tools. These topics are:

  • joint_states

  • target_joint_states

  • tf

  • tf_static

All are published without namespace. In this case namespace string is prefixed to joint name. Example: name=”UR20225300015_elbow_joint”.