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

Use roslaunch to run turtlesim automatically

asked 2018-03-22 20:56:07 -0500

mmcoose gravatar image

Does anyone have a .launch file for launching turtlesim automatically on a Raspberry Pi? My team is prgramming a robot run on a raspberry pi with ROS. There is a control computer that we connect wirelessly to the raspberry pi. The master and slave are configured properly, but ROScore, turtlesim and other desired ROS nodes need to be launched upon booting up the Raspberry Pi so that we can untether the robot from the monitor. Please help and give an example of a launch file where we can easily edit for turlesim and other nodes if possible. We are beginners in using ROS for robotic applications.

edit retag flag offensive close merge delete


Is you question about how to best automatically start ROS nodes? Then robot_upstart would be something for you. This installs launch files as upstart scripts. If your question is more about the turtlesim launch files, please provide some more Details.

mgruhler gravatar image mgruhler  ( 2018-03-23 01:46:00 -0500 )edit

Hi Mig,

We want to run roscore, turtlesim_node and a command for executing arduino code upon booting our rpi. If I use robot_upstart and download the github files, do I still need to write my own launch file? I do not understand the syntax for setting that up.

mmcoose gravatar image mmcoose  ( 2018-03-24 08:20:13 -0500 )edit

Yes, this would still require you to write your own launchfile.

mgruhler gravatar image mgruhler  ( 2018-03-26 01:06:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-23 15:27:12 -0500

See the part about @reboot

You may start a shell script that starts the launch file; I know that works well. Here's a sample:

source ~/.bashrc
source catkin_ws/devel/setup.bash
roslaunch jet_bringup jet_real.launch

Just remember to make your shell script text file executable with the chmod 755 command.

edit flag offensive delete link more


Hi Rodolfo,

If I use the Cron option. Where do I place the @reboot line of code? Does it belong in the .bashrc? Our goal is to have these 3 nodes running automatically in the background: 1. roscore 2. turtlesim turtlesim_node 3. a line of code that activates our motors, sensor and servomotor

mmcoose gravatar image mmcoose  ( 2018-03-24 08:15:22 -0500 )edit

The 3rd line is related to code written for the Arduino board.

If we use the launch file option, do we need to write a "jet_real.launch" file first? This is the part I do not understand, but I think it is actually what we need.

mmcoose gravatar image mmcoose  ( 2018-03-24 08:16:55 -0500 )edit

Please read the Cron document. This is a scheduled job, very easy to set up. It will run at reboot only.

The launch file should be your own launch file that you want to start at boot. I put the "source" line in there because it didn't work right without it.

Rodolfo8 gravatar image Rodolfo8  ( 2018-03-24 10:02:51 -0500 )edit

Question Tools

1 follower


Asked: 2018-03-22 20:56:07 -0500

Seen: 937 times

Last updated: Mar 23 '18