Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
Artemis::Devices::GPS Class Reference

The satellite's Global Positioning System (GPS). More...

#include <artemis_devices.h>

Classes

struct  gpsbeacon
 The GPS beacon structure. More...
 

Public Member Functions

int32_t setup (void)
 Sets up serial connection to GPS sensor.
 
int32_t update (void)
 Called to update the GPS.
 
int32_t read (uint32_t uptime)
 Reads GPS sensor and generates a packet on both RFM23 and Astrodev queues.
 

Public Attributes

Adafruit_GPS * gps = new Adafruit_GPS(&Serial7)
 

Detailed Description

The satellite's Global Positioning System (GPS).

An instance of the Adafruit GPS object.

Member Function Documentation

◆ read()

int32_t Artemis::Devices::GPS::read ( uint32_t  uptime)

Reads GPS sensor and generates a packet on both RFM23 and Astrodev queues.

Parameters
uptimeThe time, in milliseconds, that the Teensy has been powered on.
Returns
int32_t Returns 0 if successful, -1 if GPS has not been set up yet.

The GPS data is only transmitted if it has been set up.

A packet and GPS beacon are created. The beacon is given an identification value.

Each temperature sensor is iterated over. It is read via its analog pin, with that raw voltage reading converted to Celcius. It is then stored in the temperature beacon's array.

The packet's header information is filled out, identifying the originator node, destination node, and packet type. The beacon is then copied into the payload of the packet. The packet is then copied into the RFM23 and Astrodev queues for transmission.

◆ setup()

int32_t Artemis::Devices::GPS::setup ( void  )

Sets up serial connection to GPS sensor.

Returns
int32_t Returns 0 on successful initialization, -1 if failed.

The serial connection to the GPS module is initialized.

Todo:
The Adafruit GPS library has a bug. Connecting over serial always returns true.

The output format of the GPS is set. Possible options are:

  • PMTK_SET_NMEA_OUTPUT_GLLONLY: Latitude, longitude, UTC time of position fix and status.
  • PMTK_SET_NMEA_OUTPUT_RMCONLY: Time, date, position, course, speed data.
  • PMTK_SET_NMEA_OUTPUT_VTGONLY: Course, speed information relative to the ground.
  • PMTK_SET_NMEA_OUTPUT_GGAONLY: Time, position, fix type data.
  • PMTK_SET_NMEA_OUTPUT_GSAONLY: GPS receiver operating mode, satellites used in the position solution, DOP values.
  • PMTK_SET_NMEA_OUTPUT_GSVONLY: Number of satellites in view, satellite ID numbers, elevation, azimuth, SNR values.
  • PMTK_SET_NMEA_OUTPUT_RMCGGA: Time, date, position, course and speed data.
  • PMTK_SET_NMEA_OUTPUT_RMCGGAGSA: Time, date, position, course and speed data, GPS receiver operating mode, satellites used in the position solution, DOP values, Global positioning system fix data (time, position, fix type data).
  • PMTK_SET_NMEA_OUTPUT_ALLDATA: All possible data from the GPS module.
  • PMTK_SET_NMEA_OUTPUT_OFF: Disable GPS output.

The update rate of the GPS is set. Possible options are:

  • PMTK_SET_NMEA_UPDATE_100_MILLIHERTZ: Once every 10 seconds, 100 millihertz.
  • PMTK_SET_NMEA_UPDATE_200_MILLIHERTZ: Once every 5 seconds, 200 millihertz.
  • PMTK_SET_NMEA_UPDATE_1HZ: 1 Hz
  • PMTK_SET_NMEA_UPDATE_2HZ: 2 Hz
  • PMTK_SET_NMEA_UPDATE_5HZ: 5 Hz
  • PMTK_SET_NMEA_UPDATE_10HZ: 10 Hz

Note that this sets the rate at which the GPS module reports its data to the Teensy. This does NOT change the rate at which the GPS module updates its position fix.

To change that value, use the position fix update rate commands. Possible options are:

  • PMTK_API_SET_FIX_CTL_100_MILLIHERTZ: Once every 10 seconds, 100 millihertz.
  • PMTK_API_SET_FIX_CTL_200_MILLIHERTZ: Once every 5 seconds, 200 millihertz.
  • PMTK_API_SET_FIX_CTL_1HZ: 1 Hz
  • PMTK_API_SET_FIX_CTL_5HZ: 5 Hz

The GPS module is limited to a 5 Hz position fix update rate, but can report at 10 Hz.

◆ update()

int32_t Artemis::Devices::GPS::update ( void  )

Called to update the GPS.

Returns
int32_t Returns 0 if able to poll the GPS, -1 if GPS has not been set up yet. Note this does not guarantee that new data has been received, just that we are able to check the GPS for available bytes.

The GPS is only checked if it has been set up.

The GPS is checked to see if there are any bytes available to be read. If there are, all the bytes are read in.

Todo:
Doxygen doesn't like the empty while(){}. Correct this.

If the read in bytes form a new and complete NMEA sentence, parse that NMEA sentence and store the values in the object.


The documentation for this class was generated from the following files: