Skip to content

Commit

Permalink
Updated README file to include instructions on setting permissions on…
Browse files Browse the repository at this point in the history
… the serial port
  • Loading branch information
Patrick Goebel committed Feb 25, 2013
1 parent d9d0c8b commit e0fcbbf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Official ROS Documentation
--------------------------
A standard ROS-style version of this documentation can be found on the ROS wiki at:

http://www.ros.org/wiki/ros_arduino_bridge
http://www.ros.org/wiki/ros\_arduino\_bridge


System Requirements
Expand All @@ -54,13 +54,46 @@ sketchbook/libraries directory.
Finally, it is assumed you are using version 1.0 or greater of the
Arduino IDE.

Preparing your Serial Port under Linux
--------------------------------------
Your Arduino will likely connect to your Linux computer as port /dev/ttyACM# or /dev/ttyUSB# where # is a number like 0, 1, 2, etc., depending on how many other devices are connected. The easiest way to make the determination is to unplug all other USB devices, plug in your Arduino, then run the command:

Installation
------------
$ ls /dev/ttyACM*

or

$ ls /dev/ttyUSB*

Hopefully, one of these two commands will return the result you're looking for (e.g. /dev/ttyACM0) and the other will return the error "No such file or directory".

Next you need to make sure you have read/write access to the port. Assuming your Arduino is connected on /dev/ttyACM0, run the command:

$ ls -l /dev/ttyACM0

and you should see an output similar to the following:

crw-rw---- 1 root dialout 166, 0 2013-02-24 08:31 /dev/ttyACM0

Note that only root and the "dialout" group have read/write access. Therefore, you need to be a member of the dialout group. You only have to do this once and it should then work for all USB devices you plug in later on.

To add yourself to the dialout group, run the command:

$ sudo usermod -a -G dialout your\_user\_name

where your\_user\_name is your Linux login name. You will likely have to log out of your X-window session then log in again, or simply reboot your machine if you want to be sure.

When you log back in again, try the command:

$ groups

and you should see a list of groups you belong to including dialout.

Installation of the ros\_arduino\_bridge Stack
----------------------------------------------

$ cd ~/ros_workspace
$ git clone https://github.com/hbrobotics/ros_arduino_bridge.git
$ cd ros_arduino_bridge
$ git clone https://github.com/hbrobotics/ros\_arduino\_bridge.git
$ cd ros\_arduino\_bridge
$ rosmake

The provided Arduino library is called ROSArduinoBridge and is
Expand Down Expand Up @@ -122,6 +155,8 @@ Firmware Commands
-----------------
The ROSArduinoLibrary accepts single-letter commands over the serial port for polling sensors, controlling servos, driving the robot, and reading encoders. These commands can be sent to the Arduino over any serial interface, including the Serial Monitor in the Arduino IDE.

**NOTE:** Before trying these commands, set the Serial Monitor baudrate to 57600 and the line terminator to "Carriage return" or "Both NL & CR" using the two pulldown menus on the lower right of the Serial Monitor window.

The list of commands can be found in the file commands.h. The current list includes:

<pre>
Expand Down
9 changes: 6 additions & 3 deletions ros_arduino_python/src/arduino_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from math import pi as PI, degrees, radians
import os
import time
import sys
import sys, traceback
from serial.serialutil import SerialException
from serial import Serial

Expand Down Expand Up @@ -68,15 +68,18 @@ def connect(self):
test = self.get_baud()
if test != self.baudrate:
time.sleep(1)
test = self.get_baud()
test = self.get_baud()
if test != self.baudrate:
raise SerialException
print "Connected at", self.baudrate
print "Arduino is ready."

except SerialException:
print "Serial Exception:"
print sys.exc_info()
print "Traceback follows:"
traceback.print_exc(file=sys.stdout)
print "Cannot connect to Arduino!"
print "Make sure you are plugged in and turned on."
os._exit(1)

def open(self):
Expand Down

0 comments on commit e0fcbbf

Please sign in to comment.