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

Call code before launching ?

asked 2015-11-04 06:29:33 -0500 gravatar image

I'm interested in auto-generating some files before the start of my ROS run. The files will depend on real-time data available at the start of the run. Is there a nice way to include this in my lanch file ? Like some tag which funs an executable or python script before loading up the ROS modules?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-04 08:44:49 -0500

updated 2015-11-06 13:07:02 -0500

lucasw gravatar image

As noted in the roslaunch documentation, there are no guarantees on the order that nodes/scripts in launch files are started in. The easiest way to do what you want might be to write a short shell script that first runs the scripts for generating your data and then calls the required ROS launch file afterwards.

/edit To raise awareness for the "hacky way" @dornhege suggests below in comments. An example (creating a folder) is available here.

edit flag offensive delete link more



This sounds like a good solution. There is one slightly hacky way to do this: The param tag allows you to use the output of a command as a parameter. You can create a dummy parameter that just calls your program. Parameters are guaranteed to be set before the launch is started.

dornhege gravatar image dornhege  ( 2015-11-04 09:07:52 -0500 )edit

That hacky way is nice, thanks ! gravatar image  ( 2015-11-04 09:33:30 -0500 )edit

Question Tools

1 follower


Asked: 2015-11-04 06:29:33 -0500

Seen: 343 times

Last updated: Nov 06 '15