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

Nice ready to use /etc/init.d/ros script

asked 2011-04-06 10:42:00 -0600

Just trying to make my ROS automatically run proper roslaunch command on headless system. I hope someone already made nice scriptwork?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
4

answered 2011-04-07 18:55:37 -0600

Ugo gravatar image

Hi,

Here is the functions we use in our init.d file to start / stop ros. It prints the output of the node in tty8 and tty9. It could be combined with screen for easier use as well.

start_ros () {
    source /opt/ros/setup.sh

    roscore <>/dev/tty8 2>/dev/tty8 & disown
    until rostopic list ; do sleep 1; done
    roslaunch YOUR_PACKAGE YOUR_LAUNCH_FILE.launch <> /dev/tty9 2>/dev/tty9 & disown
}

stop_ros () {
    source /opt/ros/setup.sh

    #killall nodes
    for i in $( rosnode list ); do
    rosnode kill $i;
    done

    #stop roscore
    killall roscore
}
edit flag offensive delete link more
1

answered 2011-04-07 12:16:16 -0600

William gravatar image

I haven't found an example script, but there are two mailing list conversations about this problem where they talk about how to write one (what steps need to be in the script) that might be helpful for you.

http://ros-users.122217.n3.nabble.com/Best-way-to-start-a-launch-file-automatically-on-startup-td1768616.html

http://ros-users.122217.n3.nabble.com/auto-start-ROS-launch-script-on-boot-up-td1687093.html

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-04-06 10:42:00 -0600

Seen: 3,461 times

Last updated: Apr 07 '11