ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

roslaunch node tag doesn't respect cwd tag if launch-prefix tag found #2226

Open xkaraman opened 2 years ago

xkaraman commented 2 years ago

Trying to debug a python node that is launch from a object_detection.launch file.

The .launch file has a node tag. Both times the .launch file is launched from home folder (i.e. cd ~; roslaunch package object_detection.launch.

This node need to read from it's node's executable folder. In order to achieve this a cwd="node" tag is passed. When i launch with roslaunch package object_detection.launch, it is working all right and loads successfully the file involved. This is verified also from the log file that says [roslaunch][INFO] 2022-01-21 15:17:44,351: process[object_detection-1]: cwd will be [/home/****/ros_space/package_ws/src/package/scripts/object_detection]

If now for example i want to debug this, the go to way is using launch-prefix="gdb -ex run --args" tag inside node tag. Adding this and again launch with same command roslaunch package object_detection.launch, throws

RLException: Roslaunch got a 'No such file or directory' error while attempting to run:

gdb -ex run --args /home/****/ros_space/package_ws/src/package/scripts/object_detection/object_detection.py __name:=object_detection __log:=/home/****/.ros/log/bfbc3742-7aab-11ec-b9da-485f9946fcd1/object_detection-1.log

Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.
The traceback for the exception was written to the log file

This is because the file that is loaded is not found. It took me a while to figure out why but the log file now says [roslaunch][INFO] 2022-01-21 15:19:40,139: process[object_detection-1]: cwd will be []

gbd is for debugging c++ nodes but it just for example. For python it could be launch-prefix="conda run -n env" that still produces same error and node is working if tag removed.

The only thing that was changed here was the launch-prefix tag and i am assuming this is the one causing the error.