gps_serial¶
Yet another NMEA sentence parser for serial UART based GPS modules. This implements the threading module for [psuedo] asynchronous applications. CAUTION: The individual satelite info is being ignored until we decide to support capturing it from the GPS module’s output.
-
gps_serial.
DEFAULT_LOC
= {'lat': 37.96713657090229, 'lng': -122.0712176165581}¶ The default/fallback location to use when waiting for a fix upon power-up of GPS device. This has been hard-coded to DVC Engineering buildings’ courtyard.
-
class
gps_serial.
GPSserial
(address, timeout=1.0, baud=9600)[source]¶ Parameters: - address (int) – The serial port address that the GPS module is connected to. For example, on the raspberry pi’s GPIO pins, this is
/dev/ttyS0
; on windows, this is something likecom#
where # is designated by windows. - timeout (int) – Specific number of seconds till the threading
Serial
’s~serial.Serial.read_until()
operation expires. Defaults to 1 second. - baud (int) – The specific baudrate to be used for the serial connection. If left
-
lat
¶ This attribute holds the latitude coordinate that was most recently parsed from the GPS module’s data output.
-
lng
¶ This attribute holds the longitude coordinate that was most recently parsed from the GPS module’s data output.
-
utc
¶ This attribute holds a tuple of time & date data that was most recently parsed from the GPS module’s data output. This tuple conforms with python’s time module functions.
-
speed_knots
¶ This attribute holds the speed (in nautical knots) that was most recently parsed from the GPS module’s data output.
-
speed_kmph
¶ This attribute holds the speed (in kilometers per hour) that was most recently parsed from the GPS module’s data output.
-
sat_connected
¶ This attribute holds the number of connected GPS satelites that was most recently parsed from the GPS module’s data output.
-
sat_view
¶ This attribute holds the number of GPS satelites in the module’s view that was most recently parsed from the GPS module’s data output.
-
sat_quality
¶ This attribute holds the description of the GPS satelites’ quality that was most recently parsed from the GPS module’s data output.
-
course_true
¶ This attribute holds the course direction (in terms of “true north”) that was most recently parsed from the GPS module’s data output.
-
course_mag
¶ This attribute holds the course direction (in terms of “magnetic north”) that was most recently parsed from the GPS module’s data output.
-
altitude
¶ This attribute holds the GPS antenna’s altitude that was most recently parsed from the GPS module’s data output.
-
fix
¶ This attribute holds the description of GPS module’s fix quality that was most recently parsed from the GPS module’s data output.
-
data_status
¶ This attribute holds the GPS module’s data authenticity that was most recently parsed from the GPS module’s data output.
-
rx_status
¶ This attribute holds the GPS module’s receiving status that was most recently parsed from the GPS module’s data output.
-
pdop
¶ This attribute holds the GPS module’s positional dilution of percision that was most recently parsed from the GPS module’s data output.
-
vdop
¶ This attribute holds the GPS module’s vertical dilution of percision that was most recently parsed from the GPS module’s data output.
-
hdop
¶ This attribute holds the GPS module’s horizontal dilution of percision that was most recently parsed from the GPS module’s data output.
-
get_data
(raw=False)[source]¶ This function only starts the process of parsing the data from a GPS module (if any).
Parameters: raw (bool) – True
prints the raw data being parsed from the GPS module.False
doesn’t print the raw data. Defaults toFalse
.Returns: the last latitude and longitude coordinates obtained from either object instantiation ( DEFAULT_LOC
values) or previously completed parsing of GPS data.
- address (int) – The serial port address that the GPS module is connected to. For example, on the raspberry pi’s GPIO pins, this is