Ask Your Question
0

What does rosrun do internally?

asked 2019-12-08 22:06:05 -0600

I was following this tutorial - https://wiki.ros.org/ROS/Tutorials/Wr...

Out of curiosity, I ran the listener using rosrun beginner_tutorials listener.py but ran the talker manually. That is, I changed directory to beginner tutorials, and ran, python talker.py.

I didn't expect it to work, but it did. The nodes are communicating with each other.

Is that a fluke, or will this always work? Is rosrun's job only to find the correct node based on the ROS_PACKAGE_PATH, or does it do something else as well?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-12-09 03:31:15 -0600

updated 2019-12-09 03:32:59 -0600

This will always work. Rosrun's only job is exactly what you said: It searches a couple of directories for the correct node and run it, nothing more. You can get more info on what directories it's searching, and what executable it ends up running, by specifying the --debug flag:

$ source ~/ros-kinetic/devel/setup.bash
$ rosrun --debug imu_filter_madgwick imu_filter_node
[rosrun] Looking in catkin libexec dirs: 
/home/martin/ros-kinetic/devel/lib/imu_filter_madgwick
/home/martin/ros-kinetic/devel/share/imu_filter_madgwick
/home/martin/ros-kinetic/src/imu_tools/imu_filter_madgwick
[rosrun] Looking in rospack dir: /home/martin/ros-kinetic/src/imu_tools/imu_filter_madgwick
[rosrun] Searching for imu_filter_node with permissions /111
[rosrun] Running  /home/martin/ros-kinetic/devel/lib/imu_filter_madgwick/imu_filter_node

If you want to dig deeper, here's the full source code of rosrun (just about 100 lines of bash code): https://github.com/ros/ros/blob/2b307...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-12-08 22:06:05 -0600

Seen: 36 times

Last updated: Dec 09 '19