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

Revision history [back]

click to hide/show revision 1
initial version

We used a script like this for the ros diamondback version running under ubuntu 10.04 on a PandaBoard. It worked like it should without any problems. Maybe it will help you. But for the newer ros groovy I get also an error which I will discribe later.

#! /bin/bash
# /etc/init.d/carobot
source /opt/ros/diamondback/setup.bash
export ROS_PACKAGE_PATH=/home/robolab/ros/carobot:$ROS_PACKAGE_PATH
export ROS_IP=192.168.0.1
# initialze the pidfile
CAROBOT_PIDFILE='/var/run/carobot.pid'
ROS_USER=robolab
touch $CAROBOT_PIDFILE
/bin/chown $ROS_USER\:$ROS_USER $CAROBOT_PIDFILE
# roslaunch vars
ROSLAUNCH_BIN="/opt/ros/diamondback/ros/bin/roslaunch"
ROSLAUNCH_ARGS="--pid=$CAROBOT_PIDFILE"
# set path to launchfile
ROSLAUNCH_FILE="/home/robolab/ros/carobot/carobot_motorControl/launch/bootup.launch"
# carry out specific functions when asked by the system
case "$1" in
  start)
    echo "Starting carobot service ..."
    su -c "$ROSLAUNCH_BIN $ROSLAUNCH_ARGS $ROSLAUNCH_FILE" $ROS_USER &
    ;;  
  stop)
    kill -2 $(cat $CAROBOT_PIDFILE) > /dev/null
    echo -n "" > $CAROBOT_PIDFILE
    echo "Stopping carobot services ..."
    ;;  
  restart)
    $0 stop
    sleep 3
    $0 start
    ;;  
  *)  
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    ;;  
esac
exit 0

You can start this script with :

$sudo /etc/init.d/carobot start

And of course call also

$sudo update-rc.d carobot defaults 99

Now we use the newer Ros Groovy under Ubuntu 12.04 on the PandaBoard and I have modified the startup script like this:

#! /bin/bash
# /etc/init.d/carobot
source /home/robolab/ros_ws/setup.bash
export ROS_PACKAGE_PATH=/home/robolab/ros_ws:$ROS_PACKAGE_PATH
export ROS_IP=192.168.2.40
# initialze the pidfile
CAROBOT_PIDFILE='/var/run/carobot.pid'
# or alternativ use
#CAROBOT_PIDFILE='/home/robolab/carobot.pid'
ROS_USER=robolab
touch $CAROBOT_PIDFILE
/bin/chown $ROS_USER\:$ROS_USER $CAROBOT_PIDFILE
# roslaunch vars
ROSLAUNCH_BIN="/opt/ros/groovy/ros_catkin_ws/install_isolated/bin/roslaunch"
ROSLAUNCH_ARGS="--pid=$CAROBOT_PIDFILE"
# set path to launchfile
ROSLAUNCH_FILE="/home/robolab/ros_ws/carobot/trunk/carobot_motorControl/launch/bootup_joy2.launch"
# carry out specific functions when asked by the system
case "$1" in
  start)
    echo "Starting carobot service ..."
    su -c "$ROSLAUNCH_BIN $ROSLAUNCH_ARGS $ROSLAUNCH_FILE" $ROS_USER &
    ;;  
  stop)
    kill -2 $(cat $CAROBOT_PIDFILE) > /dev/null
    echo -n "" > $CAROBOT_PIDFILE
    echo "Stopping carobot services ..."
    ;;  
  restart)
    $0 stop
    sleep 3
    $0 start
    ;;  
  *)  
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    ;;  
esac
exit 0

No there is a problem by using this newer script. Please have a look at the complete output at: h++p://pastebin.com/GjXyaQad

After starting the script with:

$sudo /etc/init.d/carobot start

all nodes and parameters are listed so I think the launchfile is correctly loaded but then after "auto-starting new master" an error occurs:

auto-starting new master
Roslaunch got a 'No such file or directory' error while attempting to run:

rosmaster --core -p 11311 __log:=/home/robolab/.ros/log/0d59cac4-6a1b-11e2-9a62-2a0092823b0a/master.log

Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.
[master] killing on exit

But if I start the launchfile by hand

/opt/ros/groovy/ros_catkin_ws/install_isolated/bin/roslaunch /home/robolab/ros_ws/carobot/trunk/carobot_motorControl/launch/bootup_joy2.launch

or

roslaunch /home/robolab/ros_ws/carobot/trunk/carobot_motorControl/launch/bootup_joy2.launch

everything works fine without any problems. I' am not sure, but is it possible that the roslaunch in ros groovy needs some different parameters?

Thanks for any feedback!