Ask Your Question

Connection issue using nmea_serial_driver

asked 2016-04-14 17:19:49 -0500

M@t gravatar image

I'm trying to use the nmea_serial_driver node (from the nmea_navsat_driver package) to read NMEA strings that are coming from a GPS unit I have plugged into a DB-9 serial port on my computer. The GPS is outputting standard GGA sentences at 4=38400 baud. The DB-9 port is COM1 which I'm pretty sure translates to /dev/ttyS0. I'm running this command:

$ rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/ttyUSB0 _baud:=38400

and I get this error message:

Traceback (most recent call last):
    File "/opt/ros/indigo/lib/nmea_navsat_driver/nmea_serial_driver", line 49, in <module>
        GPS = serial.Serial(port=serial_port, baudrate=serial_baud, timeout=2)
    File "/usr/lib/python2.7/dist-packages/serial/", line 261, in __init__
    File "/usr/lib/python2.7/dist-packages/serial/", line 278, in open
        raise SerialException("could not open port %s: %s:" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyS0: [Errno 13] permission denied: '/dev/ttyS0'

I don't know if I'm getting this message because the port hasn't been configured properly, because i don't have permission to touch the port (as the error suggests) or because I've got the wrong port/baudrate altogether. I have run the same command on ttyS1 and I got an identical error message. For reference, I ran the dmesg command:

$ dmesg | grep tty

and the output was the same regardless of whether or not the GPS was plugged in:

[     0.000000] console [tty0] enabled
[     0.471014] 00.08: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[     0.492790] 00.09: ttyS1 at I/O 0x2f8 (irq = 4, base_baud = 115200) is a 16550A
[     2.216655] cdc_acm 3-11:1.0: ttyACM0: USB ACM device

I suspect that this output can tell me something about the problem, but I don't understand much of it. Any help or advice on how to get the driver working will be greatly appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-14 17:45:45 -0500

M@t gravatar image

updated 2016-05-02 20:11:58 -0500

Of course, irony would have it that I find the answer to my problem the minute after asking for help. So to summarize...

Problem: I cannot get nmea_serial_driver to read from a ttyS0 comm port, instead getting a permission denied error message (see above).

Cause: The user "administrator" was not a part of the "dialout" group, which is the only group that can access comm ports. You can check this by typing the following (without the <>):

groups <username>

This will print a list of groups the user is a part of. If you don't see "dialout" in the list, then you cannot access com ports and this is the probable cause of the problem.

Solution: To add the user to the "dialout" group type:

sudo usermod -aG dialout <username>

Then log out and back in. Run the "groups" command again to double check that you were added correctly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-14 17:17:21 -0500

Seen: 1,315 times

Last updated: May 02 '16