Using a GPS system

The Global Positioning System (GPS) is a space-based satellite system that provides information on the position and time for any weather and any place on the face of the earth and its vicinity. You must have an unobstructed direct path with four GPS satellites to obtain valid data.

The data received from the GPS conforms to the standards of communication set up by National Maritime Electronics Association (NMEA) and follows a protocol with different types of sentences. In them, we can find all the information about the position of the receiver.

To read more about all the types of NMEA messages, you can visit http://www.gpsinformation.org/dale/nmea.htm.

One of the most interesting pieces of information about GPS is contained in GGA sentences. They provide the current fix data with the 3D location of the GPS. An example of this sentence and an explanation of each field is given here:

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 
Where: 
GGA Global Positioning System Fix Data 
123519 Fix taken at 12:35:19 UTC 
4807.038,N Latitude 48 deg 07.038' N 
01131.000,E Longitude 11 deg 31.000' E 
1 Fix quality: 0 = invalid 
1 = GPS fix (SPS) 
2 = DGPS fix 
3 = PPS fix 
4 = Real Time Kinematic 
5 = Float RTK 
6 = estimated (dead reckoning) (2.3 feature) 
7 = Manual input mode 
8 = Simulation mode 
08 Number of satellites being tracked 
0.9 Horizontal dilution of position 
545.4,M Altitude, Meters, above mean sea level 
46.9,M Height of geoid (mean sea level) above WGS84 
ellipsoid 
(empty field) time in seconds since last DGPS update 
(empty field) DGPS station ID number 
*47 the checksum data, always begins with * 

Depending on the GPS receiver, we can find different performances and precisions. We have a simple GPS at a low cost that is commonly used in different applications, such as UAV. They have an error that can be in the range of a few meters. Also, we can find expensive GPS devices that can be configured as differential GPS or can work in the Real Time Kinematics (RTK) mode, where a second GPS at a known location sends corrections to the first GPS. This GPS can achieve great results in terms of precision, with location errors less than 10 cm.

In general, GPS uses serial protocols to transmit the data received to a computer or a microcontroller, such as Arduino. We can find devices that use TTL or RS232, and they are easy to connect to the computer with a USB adapter. In this section, we will use a low-cost NEO-Bloc 6 M and a really accurate system, such as GR-3 Topcon in the RTK mode. We will see that, with the same drivers, we can obtain the latitude, longitude, and altitude from both devices:

Em406a and Topcon GPS

In order to control a GPS sensor with ROS, we will install the NMEA GPS driver package by using the following command line (don't forget to run the rosstack
and rospack profiles after that):

    $ sudo apt-get install ros-kinetic-nmea-gps-driver
    $ rosstack profile & rospack profile
  

To execute the GPS driver, we will run the nmea_gpst_driver.py file. To do that, we have to indicate two arguments: the port that is connected to the GPS and the baud rate:

    $ rosrun nmea_gps_driver nmea_gps_driver.py _port:=/dev/ttyUSB0 _baud:=4800
  

In the case of the EM-406a GPS, the default baud rate is 4800 Hz as indicated in the preceding command line. For Topcon GR-3, the baud rate is higher; it's about 1,15,200 Hz. If we want to use it with ROS, we will modify the _baud argument, as shown in the following command:

    $ rosrun nmea_gps_driver nmea_gps_driver.py _port:=/dev/ttyUSB0 _baud:=115200
  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.177.85