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

Start multiple nodes at boot and give access to ports

asked 2015-04-10 03:53:23 -0500

Sander gravatar image

updated 2015-04-10 03:55:56 -0500

Currently when testing our robot (Ubuntu 14.04, ROS indigo), we need to start lots of nodes by hand. This takes lots of time when doing this over and over. Therefore we've tried to write a startup script using a bash script. But then when it started roscore, it does not execute all the other commands. Bassically what we are trying to do is automate the following terminal commands. For example, now only the startup of the xsens was used. But, like this, we need to start a laserscanner, a logitech controller, a camera and motorcontrollers as well. We found out we can do it using a launch file, but we do not now how to give permission to read a port that way. Does anyone have tips regarding this topic on how to automate the next process: ?

On startup:

New terminal:

$ roscore

New terminal:

$ cd /bullseye/catkin_ws/
$ source devel/setup.bash
$ sudo chmod a+rw /dev/ttyUSB0
$ rosrun xsens_driver -f 5
$ rosrun xsens_driver

New terminal:

$ cd test_bullseye/
$ python

Thanks in advance, Sander

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-10 05:33:53 -0500

georg l gravatar image

You are addressing three different problems. First is system startup: To set permissions the clean way would be udev - rules. The quick way is change /etc/rc.local

#!/bin/sh -e
# ... bla bla
# By default this script does nothing.
chmod a+rw /dev/ttyUSB0
exit 0

The next point is starting your ros nodes: take a look at the roslaunch documentation.

And the last is start problem of your application on desktop level: I would create a bash script which starts two terminals (I suggest xterm, because it is quite easily scriptable) which automatically start roslaunch and another terminal with the python script. Depending on your desktop environment you can call the script at startup of the graphical system.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-04-10 03:53:23 -0500

Seen: 797 times

Last updated: Apr 10 '15