Search code examples
ros

How to use namespace in ROS?


I can not understand how the namespace works in ROS http://wiki.ros.org/Names Can you hang a couple of real examples of how this works?

And the same question on the parameters http://wiki.ros.org/Parameter%20Server What do these names mean? Are the names of the package-node-parameter or what?


Solution

  • Namespaces are the best option to deal with name collision which is quite oft in robotics, especially when the system is going bigger and more complex...

    Imagine you have a robot with 2 sensors for the distance, the front and back, then you can think I have 2 topics with the same info distance=10 and distance=10

    now what? how can a 3rd node knows which distance is which???

    now using namespaces you can avoid that issue by just doing

    back/distance=10 and front/distance=10