|
|
|
@ -6,6 +6,8 @@ run this way: python3 example1.py.txt
|
|
|
|
|
|
|
|
|
|
|
|
# from https://gpsd.gitlab.io/gpsd/gpsd-client-example-code.html
|
|
|
|
# from https://gpsd.gitlab.io/gpsd/gpsd-client-example-code.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this client is for the CubeSatSim Lite which does not have a Pico microcontroller
|
|
|
|
|
|
|
|
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
|
|
|
|
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
@ -16,21 +18,22 @@ try:
|
|
|
|
# not useful, probably not a TPV message
|
|
|
|
# not useful, probably not a TPV message
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
print('Mode: %s(%d) Time: ' %
|
|
|
|
# print('Mode: %s(%d) Time: ' %
|
|
|
|
(("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode],
|
|
|
|
# (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode],
|
|
|
|
session.fix.mode), end="")
|
|
|
|
# session.fix.mode), end="")
|
|
|
|
# print time, if we have it
|
|
|
|
# print time, if we have it
|
|
|
|
if gps.TIME_SET & session.valid:
|
|
|
|
print("%d ", session.fix.mode)
|
|
|
|
print(session.fix.time, end="")
|
|
|
|
# if gps.TIME_SET & session.valid:
|
|
|
|
else:
|
|
|
|
# print(session.fix.time, end="")
|
|
|
|
print('n/a', end="")
|
|
|
|
# else:
|
|
|
|
|
|
|
|
# print('n/a', end="")
|
|
|
|
|
|
|
|
|
|
|
|
if ((gps.isfinite(session.fix.latitude) and
|
|
|
|
if ((gps.isfinite(session.fix.latitude) and
|
|
|
|
gps.isfinite(session.fix.longitude))):
|
|
|
|
gps.isfinite(session.fix.longitude))):
|
|
|
|
print(" Lat %.6f Lon %.6f" %
|
|
|
|
print(" %.6f %.6f" %
|
|
|
|
(session.fix.latitude, session.fix.longitude))
|
|
|
|
(session.fix.latitude, session.fix.longitude))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(" Lat n/a Lon n/a")
|
|
|
|
print(" 0 0")
|
|
|
|
|
|
|
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
# got a ^C. Say bye, bye
|
|
|
|
# got a ^C. Say bye, bye
|
|
|
|
|