WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

GPS

Adds support for GPS devices.
GPS devices normally provide information on position (latitude and longitude), altitude and time of day by locking on to a number of satellites and using triangulation.
The greater the number of satellites, and the further they are away from each other, then the more accurate the calculations.
When a GPS is turned on having been powered down for a while (cold boot) then it can take several minutes for it to lock on to enough satellites to start returning valid readings. This delay tends to be much shorter after a warm-boot ie if you only turn the power off for a few seconds.
Note that the accuracy can be as rough as 10m or so. This is obviously not very useful if your are trying to track your robots location in, say, a small maze - but is useful for robots that cover a wider distance.
A further reduction in accuracy is caused by the avr-gcc compiler implementation of floating point numbers which, being only 4 bytes long, can only store a small number of significant digits (ie values get rounded).
A useful side effect of a GPS is the time-of-day, called the Fix Time, which can be useful for generating dates and times in logging applications.
There are a number of standards for how GPS devices communicate but the most widely implemented standard is called NMEA. This sends out messages, normally at 4800 baud and one message every one second, over a serial port.
Example
Assuming you have created a gps device called myGPS in Project Designer and you want to print out any valid longitude and latitude values then you could write:-
// Read the GPS
myGPS.read();
 
// Check if valid and position changed
if( myGPS.isValid() && myGPS.isPositionUpdated()){
    // Dump the GPS values
    cout << myGPS;
}

 

Project Designer supports the following devices

 

Valid XHTML 1.0 Transitional