This is a short tutorial to get a Garmin GPS "puck" working with ROS. GPS receivers are very common, simple sensors for robotics, so this tutorial is also a general purpose tutorial on how one might step through a process to integrate a new sensor.
The Garmin GPS 18x PC is shown below.
The sensor has two connections:
- A cigarette lighter connection for power
- A DP9 connector for serial communication
The first think you will want to do is to provide power to the sensor. The first time you use any sensor it is is a good idea to use a lab power supply to provide electrical power. This is nice because it allows you to set both the voltage and the current the supplied. This can prevent destroying a device if you are new to its operation.
I chose to remove the cigarette lighter adapter and use the internal wires to make the connection. A sticker on the device indicates that the input can be between 8-30 V, but this only pertains to power supplied through the cigarette lighter adapter. This adapter contains a voltage regulator to provide 5 V downstream. Therefore, to get this device to work you need to provide precisely 5 V.
The setup looks something like illustrated below....
The power supply is providing 4.99 V and 0.031 Amps. The DB9 serial connector is attached to a USB-to-serial adapter (shown in white on the left).
Checking the Serial Connection
Before introducing ROS, it is a good idea to check your serial connection. (You might review Serial Ports in Linux for information on terminal program, permissions, etc.)
Access the serial connection using gtkTerm. If you have not installed gtkTerm, you can download it with the command:
sudo apt-get install gtkterm
At the top of your computer, select Configuration --> Port on the toolbar. Select the correct baudrate and output. Both will revert back to the default each time you open the Port window.
If the device has power and you are connected to it correctly, you should see NMEA traffic at 4800 baud like this...
The nice thing about this is that we don't really need to understand what these NMEA message mean (altough it is good to know http://www.gpsinformation.org/dale/nmea.htm#RMC)
Using the ROS Driver
We want a ROS node that does know how to interface with the NMEA messages coming in via the serial connection and turn them into ROS topics. The nmea_navsat_driver ROS package is exactly that. We'll run the nmea_serial_driver node in that package like so...
I've assumed you have a ROS master running. I've specified the port and baud parameters explicitly even though they are the same as the default values.
Now to check that the the driver is publishing to the topics we expect using rqt_topic...
To interpret the fix message you need to know that it is a message of type NavSatFix. Furthermore the status field is of type NavSatStatus. Therefore the status.status value of 0 indicates an unaugmented fix which is strange since this test was done indoors?