gps_tracker GPS Position Logging Program

gps_tracker.py

Latitude and longitude are recorded as measurements.

A script task runs periodically:
  • Task ensures the GPS is on
  • Task reads the position for the GPS and stores it into global variables
Two measurements are associated with scripts:
  • One reads the latitude from the global variable
  • The other reads the longitude from the global variable
  • The measurements need to be scheduled right after the script task

A Sat/XLink setup is associated with this module: gps_tracker_setup.txt

gps_tracker.append_lat_long(standard)

Appened m_latitude and m_longitude to transmission.

gps_tracker.convert_to_decimal_degrees(degrees, minutes, seconds)

converts degrees minutes seconds into degrees with decimal places

gps_tracker.gps_keep_on_and_read_position()
Task has two functions:
  • Make sure the GPS stays on all the time
  • Read the position from the GPS and store it in globals

Task should be scheduled to run periodically, every 5 minutes.

It should happen 30 seconds before the latitude and longitude meas.

gps_tracker.gps_parse_lat_long(gps_status)

Parses Satlink’s STATUS GPS looking for the latitude and longitude.

Example reply when no locati on:

GPS Sync in progress    GPS tracking satellites
Clock has NOT been synced to GPS.
Signal Quality (SatID/Signal CNo): 1/46 3/46 6/43 11/38 17/45 18/36 19/40 22/42 24/37 28/43 at 2018/08/14 15:12:26

And with location:

GPS Sync in progress    GPS acquiring almanac
Last sync to GPS was at 2018/08/14 15:12:48
Last sync is valid till 2018/09/13 15:12:48
GPS was powered for 00::00:01:04 before it acquired satellite lock
Lat N 38o 59' 50.01" Long W 77o 25' 24.46" Alt 134.6m(441.5ft)
Signal Quality (SatID/Signal CNo): 1/44 3/45 6/41 11/34 17/45 18/35 19/39 22/41 24/34 28/41 at 2018/08/14 15:12:41

We want this line:

Lat N 38o 59' 50.01" Long W 77o 25' 24.46" Alt 134.6m(441.5ft)
gps_tracker.gps_read_position()

Gets the current STATUS GPS and parses the location from it.

Returns:latitude, longitude
Return type:float, float
gps_tracker.meas_latitude(inval)

Associate with a measurement to have it log latitude. The measurement should be setup as manual entry.

Please note that this returns a result of zero until the task gps_keep_on_and_read_position is run

gps_tracker.meas_longitude(inval)

Like meas_latitude, but for longitude

gps_tracker.test_gps_read_position()

Verifies that gps_read_position works

gps_tracker.version_needs_check = True

In order to assure that both latitude and longitude are read at the same time, we will have a Satlink task read the GPS status and store the latitude and longitude globally.