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

Run shell command from launch script

asked 2012-05-11 01:52:51 -0600

mapa17 gravatar image

Hello,

i need to run some system commands ( configurating drivers and similar stuff ) at startup and thought about doing so by including them into the .launch script of my project.

Is this a good idea, is there a simple way to run shell commands ( with root privileges ) from a launch script? Or if not, is there maybe a simple node that i can call to execute shell commands.

edit retag flag offensive close merge delete

Comments

Running the command from a shell script would be nice, but how do i call that script via roslaunch? That was what i was looking for in the beginning, reading [http://ros.org/wiki/roslaunch/XML].

mapa17 gravatar image mapa17  ( 2012-05-11 02:38:08 -0600 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2012-05-11 02:01:31 -0600

dornhege gravatar image

In principle you can put your commands in any shell script, put it in a ROS package and rosrun that or call it via roslaunch.

One thing that might prevent this from being usable is that you don't have a guarantee that your commands are executed before any others (besides executing different launch files).

edit flag offensive delete link more
0

answered 2012-05-11 02:17:56 -0600

By "at startup", you mean once on system boot? In that case, I would use another method (such as /etc/init.d scripts), especially if you need to run as root.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-05-11 01:52:51 -0600

Seen: 4,544 times

Last updated: May 11 '12