March 2, 2008

GPS

As a help for localization, the robot will use GPS. The plan is not to use GPS for any detailed navigation, but I hope that it can be used to give a first rough estimation of where the robot is. I will use the BU-353 which is based on the SiRF Star III chipset and is equipped with a USB interface.

Communication with the GPS is very easy. The only problem is to set the communication speed correctly. For GPS devices, the default serial speed is 4800 baud (8 bits, no parity, one stop bit), which is very very slow, but still sufficient if all you need is a new fix every second. For a USB device, you still need to set the communication speed correctly for everything to work. One would have thought that the USB drivers could do this for you, but apparently that is too much to wish for. After setting the parameters, you can open a connection withe the device and start to read data from the it

The data comes in the form of NMEA sentences that consist of one line of ASCII terminated by CR+LF. Unfortunately, the NMEA specification is proprietary. It is apparently from the old days when it seemed like a good idea to keep a standard secret (or rather at $270). Luckily, the information is available on the web anyway.

The sentence I am primarily interested in starts with $GPGGA and is followed by the time, longitude, latitude and altitude, together with some auxiliary data. Each sentence ends with a two-byte  hexadecimal checksum

The latitude and longitude are given in degrees with decimal minutes. This is different from the alternative model where degrees, minutes and seconds are used. For example, I read the following sentence from the GPS:
$GPGGA,100753.000,5543.7019,N,01301.2776,E,1,09,0.9,8.8,M,40.6,M,,0000*51
This means that the fix was taken at 10:07 UTC, at latitude 55° 43.7019' N and longitude 13° 1.2776' E. Putting these coordinates into Google Earth, I get a cross just above the room where I am writing this.



This is good news. If this precision is not just an accident then it means that GPS has sufficient precision to be used for my purposes even though I am indoors. Something GPS was never intended for.

By the way, the number 09 in the sentence indicates that the GPS is currently using nine satellites to make the fix.