Below is the Python script I’ve made for printing the Latitude and Longitude without correction data, but now I’d like to try and get more accurate with RTK.
I’ve got familiar with desktop applications for applying RTCM like PyGPSClient (https://github.com/semuconsulting/PyGPSClient) and u-center but I’d like to be able to achieve RTK fix within a python script.
I say this because my goal is to achieve RTK on an Arduino or similar portable device, then send that to the cloud where I can compare it to an identical device in another location (i.e. get the distance between the two).
I thought perhaps I could use parts of the source code for PyGPSClient? I’m not sure where to start. Any advice would be appreciated. Thanks!
import serial
gps = serial.Serial('com5', baudrate=9600)
while True:
ser_bytes = gps.readline()
decoded_bytes = ser_bytes.decode("utf-8")
data = decoded_bytes.split(",")
if data[0] == '$GNRMC':
lat_nmea = (data[3],data[4])
lat_degrees = float(lat_nmea[0][0:2])
lat_minutes = float(lat_nmea[0][2:])
lat = lat_degrees + (lat_minutes/60)
lon_nmea = (data[5],data[6])
lon_degrees = float(lon_nmea[0][:3])
lon_minutes = float(lon_nmea[0][3:])
lon = lon_degrees + (lon_minutes/60)
if lat_nmea[1] == 'S':
lat = -lat
if lon_nmea[1] == 'W':
lon = -lon
print("%0.8f" %lat,',' "%0.8f" %lon)
Please check you are using the correct Arduino board definition for the Thing Plus (vs. Thing Plus C).
Also, please check your Espressif ESP32 board definitions are up to date. 2.0.5 is the latest. There was an issue with a previous version that stopped Qwiic (I2C) from working.
You may also need to factory-reset your GNSS board if you have had it configured differently for Python. Connect with u-center via USB; open the View \ Messages View; navigate to UBX-CFG-CFG; click the “Revert to default configuration” radio button; click “Send” at the bottom of the window; click “Save current configuration” then click “Send”. That will ensure UBX is enabled on the I2C port.
You can also reset using PyGPSClient. Connect via USB and open the UBX Configuration window. There are preset configuration commands for RESTORE_FACTORY_DEFAULTS and SAVE_CURRENT_CONFIGURATION.
Thanks for the link to PyGPSClient BTW. It’s a really nice piece of work…