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

How naming work in ros?

asked 2018-08-12 21:47:16 -0500

phsamuel gravatar image

In tutorial Using rqt_console and roslaunch, the two turtlesim node are named as "sim" in the launch file. But inside the mimic block, they are referred as "turtle1". The name tag inside seems redundant in this case. What is its use really?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-08-13 13:58:17 -0500

Bogdar_ gravatar image

There are naming conventions in ROS: http://wiki.ros.org/ROS/Patterns/Conv... . 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.

edit flag offensive delete link more
0

answered 2018-08-13 04:30:54 -0500

bouke gravatar image

There are two things to distinguish here: the simulations and the turtles. In your case, you run two simulations, each within its own namespace: /turtlesim1/sim and /turtlesim2/sim. Each simulation has one turtle: turtle1. It is also possible to have two turtles in one simulation, such as in the Parameters and services tutorial. Then you could have one sim with two turtles: turtle1 and turtle2.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-08-12 21:47:16 -0500

Seen: 252 times

Last updated: Aug 13 '18