Ask Your Question

Revision history [back]

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

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/2b307e1854ebf3954a5b4110f891278f555e79a6/tools/rosbash/scripts/rosrun