ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are naming conventions in ROS: http://wiki.ros.org/ROS/Patterns/Conventions . As stated by @bouke answers importance of namespace in ROS is that enables to have running a single type node without conflict. If I have a node A which is subscribed to topic /A_subscription and publishes to into topic /A_publishing, in case that you try to run two A's nodes without having a namespace that would differentiate them:

  • First, you could just run one of them as the Master is identifying that you want to rerun the node. Both nodes would have the same name and master does not append any number after the node name when identifying same resource use.

  • Second, in the non real case the Master would handle different names for the same node run automatically and there were no namespace, you would be publishing over the same /A_publishing when both nodes can be running different things.

In the last case a node namespace of the topic /A/A_publishing and /A1/A_publishing would solve the problem and inside the graph resources both implementation live as different things.

So namespaces allow you to avoid problems in an elegant way that does not require you to perform almost any change in your node code.