0
$\begingroup$

Rosanswers logo

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/serialutil.py", line 261, in __init__
        self.open()
    File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", 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.


Originally posted by M@t on ROS Answers with karma: 2327 on 2016-04-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by M@t with karma: 2327 on 2016-04-14

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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