GPS Interface - Terrapin-Rocket-Team/SRAD-Avionics GitHub Wiki

Home/Documentation/GPS Interface

The GPS Interface (GPS.h)

Overview

This interface extends the Sensor interface and is used to define the functions that all GPS sensors must implement. This includes functions to get the latitude, longitude, altitude, and speed of the sensor. The GPS class is responsible for parsing the module's data into local variables. The State class then reads these variables to get the data.

Note: The getDataString() and getStaticDataString() functions are expected to return heap-allocated char*s. This is because the State class is responsible for freeing the memory after the data is used. getCsvHeader() is expected to return a char[] as a string literal (i.e. Don't delete[] it).

The GPS Class

Rather than list out all the functions here, I will refer you to the header file for the GPS class. This prevents outdated documentation. The functions are documented in the header file.

Some important ideas to note:

  • The GPS interface overrides the getType() and getTypeString() functions itself rather than leaving it to the fully derived implementation. This just makes it a bit easier to use.
  • The GPS class has a dependency on Adafruit's imumaths library for vector math and storage. This is used to store position and velocity vectors. The library is included in the project, so you shouldn't need to worry about it.

See Also

  • Sensor.h - The Sensor interface.
  • imumaths - The Adafruit library used for vector math and storage.
  • State.h - The State estimation system.

About GPSs

A Global Positioning System (GPS) is a satellite-based navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Our current GPS is the MAX-M10s, which is a GPS module that provides latitude, longitude, altitude, and time-of-day data. The requirement for four or more satellites for an accurate fix illustrates some limitations of GPS, as it can be difficult to get a fix indoors or in urban canyons. Even in open air, it can take up to a minute for the sensor to get a fix. We attempt to mitigate this issue by using the hasFirstFix() function to determine if the GPS has a fix before using the data.

⚠️ **GitHub.com Fallback** ⚠️