Why the node name hasn't got in the Execise 5.13?

Hi,
Exercise 5.13 hasn’t got any node name in the python code. But move_drone_square is specified as the node name in the launch file. We used the node names in Topic and Service examples. We also used it in the action client section. But even though we don’t use action server, we mentioned it in the launch file. I need your knowledge on this subject. Thanks in advance.

Attention!!
The node name given in the launch file (move_drone_square) is different from the node name specified in the python file (move_square).

Hi @kagizman,

The node name given in the launch file overrides the name given in the Python file (in rospy.init_node()).

If you ran the Python file with rosrun python_file.py, then the one given in init_node() should win. You can check node names using rosnode list.

See the post for more digest:
https://answers.ros.org/question/191839/node-naming-and-running-rospyinit_node-and-launch-file-nodes/

1 Like