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

I suggest you have a look at this wiki page.

The short explanation for the observed phenomenon would be:

rosp.init_node() defines a default name which is used if you don't overwrite it (e.g. rosrun rf_trilateration rf_sim_node.py). The name tag in the launch file on the other hand overwrites this name and therefore you will always find the node named the same as the name tag in the launch file.

The most important part about naming nodes is that the name has to be unique. If you try to start two nodes with the same name, the first node would be killed when the second one is started. The argument anonymous=True makes sure that you always have a unique name for your node. If you would run:

rosrun rf_trilateration rf_sim_node.py
rosrun rf_trilateration rf_sim_node.py

so the same command twice, you would see a different rosnode list output.

I suggest you have a look at this wiki page.

The short explanation for the observed phenomenon would be:

rosp.init_node() defines a default name which is used if you don't overwrite it (e.g. rosrun rf_trilateration rf_sim_node.py). The name tag in the launch file on the other hand overwrites this name and therefore you will always find the node named the same as the name tag in the launch file.

The most important part about naming nodes is that the name has to be unique. If you try to start two nodes with the same name, the first node would be killed when the second one is started. The argument anonymous=True makes sure that you always have a unique name for your node. If you would run:

rosrun rf_trilateration rf_sim_node.py
rosrun rf_trilateration rf_sim_node.py

so the same command twice, you would see a different rosnode list output.

Edit: To answer the comment

name is actually a mandatory field. If you give an empty string name="" it will create a name from the type=myscript.py tag myscript_py_machinename_id_id_id which is the same as using name=$(anon some_name) which will create nodes called: some_name_manchinename_id_id_id so it uses the name some_name instead of the name of the binary or python script given to type.

The name tag however voids the default name and the anonymus attribute given to __init__(). So from my experience and what I could find on the internet, there is no way of using the default name when starting the node via roslaunch.

I suggest you have a look at this wiki page.

The short explanation for the observed phenomenon would be:

rosp.init_node() defines a default name which is used if you don't overwrite it (e.g. rosrun rf_trilateration rf_sim_node.py). The name tag in the launch file on the other hand overwrites this name and therefore you will always find the node named the same as the name tag in the launch file.

The most important part about naming nodes is that the name has to be unique. If you try to start two nodes with the same name, the first node would be killed when the second one is started. The argument anonymous=True makes sure that you always have a unique name for your node. If you would run:

rosrun rf_trilateration rf_sim_node.py
rosrun rf_trilateration rf_sim_node.py

so the same command twice, you would see a different rosnode list output.

Edit: To answer the comment

name is actually a mandatory field. If you give an empty string name="" it will create a name from the type=myscript.py tag myscript_py_machinename_id_id_id which is the same as using name=$(anon some_name) which will create nodes called: some_name_manchinename_id_id_id so it uses the name some_name instead of the name of the binary or python script given to type.

The name tag however voids the default name and the anonymus attribute given to __init__()init_node(). So from my experience and what I could find on the internet, there is no way of using the default name when starting the node via roslaunch.

I suggest you have a look at this wiki page.

The short explanation for the observed phenomenon would be:

rosp.init_node() defines a default name which is used if you don't overwrite it (e.g. rosrun rf_trilateration rf_sim_node.py). The name tag in the launch file on the other hand overwrites this name and therefore you will always find the node named the same as the name tag in the launch file.

The most important part about naming nodes is that the name has to be unique. If you try to start two nodes with the same name, the first node would be killed when the second one is started. The argument anonymous=True makes sure that you always have a unique name for your node. If you would run:

rosrun rf_trilateration rf_sim_node.py
rosrun rf_trilateration rf_sim_node.py

so the same command twice, you would see a different rosnode list output.

Edit: To answer the comment

name is actually a mandatory field. If you give an empty string name="" it will create a name from the type=myscript.py tag myscript_py_machinename_id_id_id which is the same as using name=$(anon some_name) which will create nodes called: some_name_manchinename_id_id_id so it uses the name some_name instead of the name of the binary or python script given to type.

The name tag however voids the default name and the anonymusanonymous attribute given to init_node(). So from my experience and what I could find on the internet, there is no way of using the default name when starting the node via roslaunch.