How to modify ublox_gps for USB communication (instead of UART)?

asked 2018-11-05 11:06:18 -0500

erush91 gravatar image


I have outlined my problem below.


I am currently trying to run the ublox_gps rospackage so that I can publish GPS messages.


The hardware includes interfacing a 3DR u-blox GPS with in ODROID-XU4 with a FTDI serial-to-USB cable. This allows me to connect the GPS to a USB port on the ODROID.

3DR GPS kit:

FTDI serial-to-USB cable:

ISSUE: I noticed that the ublox_gps ROS package source code is set up to communicate via UART, not USB.


I enter in the command window:

rosrun ublox_gps ublox_gps

Currently I am receiving an error:

terminate called after throwing an instance of 'std::runtime_error' what(): Could not configure serial baud rate Aborted

This error is preventing the ROS package from running, but I believe once this error is resolved, further changes to the code may be required in order to communicate via USB.

I have looked at the code in node.cpp, and potentially have an idea of what needs to be changed. Based on the code in lines 141-153, it appears that usb/in and usb/out must be set appropriately by initializing above: nh->param("usb/in", [???], [???]) and nh->param("usb/out", [???], [???]). I am not sure what the value of these variables should be though. This should then trigger line 424 and call gps.configUsb.

After modifying that code, I am not sure if there are any other changes that need to be made.

I am relatively new to ROS and would appreciate any help that you may be able to provide!

edit retag flag offensive close merge delete


Not an answer, but: usb-to-serial devices are considered plain serial devices by Linux applications. Unless you want to interface USB endpoints directly (not recommended), no changes should be necessary apart from making sure to open the correct /dev/ttyUSBx port (where x is a number).

gvdhoorn gravatar image gvdhoorn  ( 2018-11-05 11:22:39 -0500 )edit

Hi gvdhoorn, thanks for the feedback. I did change the default /dev/ttyACM0 to my USB port /dev/ttyUSB0 in line 125.


nh->param("device", device_, std::string("/dev/ttyACM0"));


nh->param("device", device_, std::string("/dev/ttyUSB0"));

Still unsure what do to try next?

erush91 gravatar image erush91  ( 2018-11-05 11:33:01 -0500 )edit

Don't edit source code for that. It's a parameter for a reason.

Still unsure what do to try next?

try running your node?

If you get errors: is your user member of the dialout group? If not, it may not be allowed to read/write from/to the serial port.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-05 11:44:59 -0500 )edit