ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I manage ROS like this. I put all launch files inside one master "all.launch", and then I start that using the supervisor service, a simple tool for creating daemons. You can install this on Ubuntu with:
sudo apt-get install supervisor
I configure it by creating a file /etc/supervisor/conf.d/myrobot.conf
which looks like:
[program:myrobot]
command=bash -c "source /usr/local/myrobot/src/ros/setup.bash; roslaunch myrobot all.launch"
directory=/usr/local/myrobot/src/ros
user=ubuntu
stdout_logfile=/var/log/supervisor-myrobot.log
stderr_logfile=/var/log/supervisor-myrobot.log
autostart=true
autorestart=true
startretries=3
priority=998
stopasgroup=true
Then, when the system boots, it launches all your ROS nodes automatically. If you want to cleanly stop it, you'd run:
sudo supervisorctl stop myrobot
Similarly, to start it, you'd run:
sudo supervisorctl start myrobot