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

rosrun & node_name

asked 2012-04-16 10:57:45 -0500

SmithGeneP gravatar image

With the advice from Lorenz I was able to resolve the errors I had when running rosmake. However I tried to launch rosrun but found that I am not using the correct node_name. Actually, I (incorrectly) assumed that after rosmake run completed one of the outputs would the creation of the node_name. Can anyone tell me how is the node_name created and where do I look for it?



edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2012-04-16 12:55:03 -0500

joq gravatar image

updated 2018-03-05 04:02:46 -0500

gvdhoorn gravatar image

In ROS there are separate names for packages, executables and nodes. Rosmake creates an executable file for each node. The default node name will be the string it passes to ros::init(), but that name can be overridden:

$ rosrun my_package node_executable __name:=my_node1

The equivalent roslaunch command is:

<node package="my_package" type="node_executable" name="my_node1"/>
edit flag offensive delete link more


thanks for the info. A minor issue that: it should be

<node package="my_package" type="node_executable" name="my_node1"/>
Anders gravatar image Anders  ( 2018-03-05 03:57:39 -0500 )edit

You're right, I updated the answer.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-05 04:03:13 -0500 )edit

This doesn't seem to be supported for all nodes. Specifying __name when running rqt_image_view is ignored, and the node still uses an auto-generated node name like "/rqt_gui_cpp_node_12409".

Cerin gravatar image Cerin  ( 2018-07-03 08:56:51 -0500 )edit

Question Tools

1 follower


Asked: 2012-04-16 10:57:45 -0500

Seen: 10,404 times

Last updated: Mar 05 '18