I'm using a ZED-F9P.
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 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 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)
I did endeavour to answer this before with a hyperlink to an example Python script from the pygnssutils library, but it got deleted by the moderator. I'm not sure if I'm permitted to provide the complete script here (rather than a hyperlink) but assuming I am, here goes: