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

rosrun can give output (images) in a folder while roslaunch cannot

asked 2020-08-04 17:21:50 -0600

jason gravatar image

Hello, I am using ros to generate some imaes to do control. The node I use can generate a folder named "ImageFolder" under catkin_ws folder. And some images will be saved to ImageFolder after the code. However, when I use launch file to launch the same node, the terminal will give me cannot mkdir ImageFolder, it exists, even I delete the ImageFolder before launch this file. Of course, the new images is not printed in this folder either. The launch file I use is the simplest one, with only type, pkg, name arguments. Does anyone know what's the reason? Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-04 20:09:48 -0600

Thomas D gravatar image

When you use roslaunch and then make or save files/directories, those files and directories are created at $ROS_HOME, typically set to /home/user/.ros/. I suggest you look at that location for your images.

Additionally, you can specify a location to write files to using a parameter for your node. In your launch file you can set that parameter, and even have it be relative to a package. See, specifically the $(find pkg) syntax.

edit flag offensive delete link more


Hi Thomas, thanks for your reply. It is in the invisible ".ros". Then I tried to specificy a path from "imageFolder" to "~/catkin_ws/imageFolder" in the code. However, both roslaunch and rosrun can generate this folder but cannot write images to it. Then I switch back to make it generated in the executable file directory using <launch> <node name="test" pkg="my_package" type="my_node" cwd="node" /> </launch>

jason gravatar image jason  ( 2020-08-05 18:17:23 -0600 )edit

Question Tools



Asked: 2020-08-04 17:21:50 -0600

Seen: 201 times

Last updated: Aug 04 '20