0
$\begingroup$

Rosanswers logo

Hi! I alwasy run some command in terminal like:

sudo chmod 777 /dev/USB0
sudo chmod 777 /dev/ACM0 

but how can i do this in launch file, when i ask roslaunch expamle.launch it call this shell programming for once?


Originally posted by Mohsen Hk on ROS Answers with karma: 139 on 2013-05-28

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You should really configure your system so that you don't have to manually modify device permissions on startup.

For serial devices on most Linux systems, that usually just means adding yourself to the proper group that has access to the serial device, or modifying the udev rules.

You can verify which group has access to the devices by doing ls -l /dev/ttyACM0 /dev/ttyUSB0 ; then add yourself to that group. For example, on Ubuntu the group is dialout, so you would do:

sudo usermod -a -G dialout USER

Originally posted by ahendrix with karma: 47576 on 2013-05-29

This answer was ACCEPTED on the original site

Post score: 9


Original comments

Comment by koenlek on 2014-04-24:
Please note that you need to log-out and log-in again (or reboot your pc) for this changes to take efffect! After that, it works like a charm here...

$\endgroup$
0
$\begingroup$

Rosanswers logo

Put these commands into an executable shell script (let's call it yourscript.sh) somewhere inside the package directory (let's call the package yourpackage) and then reference that script inside your launch file (e.g. example.launch):

<node name="nodename" pkg="yourpackage" type="yourscript.sh">

Originally posted by DamienJadeDuff with karma: 399 on 2013-05-28

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by felix k on 2013-05-28:
Actually roslaunch direct_path_to_.launch_file is possible. See roslaunch -h ;-)

Comment by felix k on 2013-05-28:
@Mohsen Keep in mind that this 'script node' is started with all others in parallel. So while usually the chmods will be done before any node even starts thinking about those /devs, the worst case might be that every other node has started (and perhaps crashed) before the first chmod is called

Comment by dornhege on 2013-05-29:\

  • For sudo, you'd need to enter password. From the command, it seems you should set that up with udev. For the devices you use, it might also be sufficient to do adduser <USER> dialout.

Comment by benabruzzo on 2014-04-14:
When I use the above I get an error: ERROR: cannot launch node of type [hast/yourScript.sh]: Cannot locate node of type [yourScript.sh] in package [hast]. Is an entry to the CMakeLists file necessary?

Comment by dornhege on 2014-04-15:
Is the script executable?

Comment by DamienJadeDuff on 2014-04-17:
Fixed the answer, thanks felix k. My answer is not a good one anyway. ;)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.