Compare commits
46 Commits
39ebc247c9
...
221ef17d30
| Author | SHA1 | Date |
|---|---|---|
|
|
221ef17d30 | 3 days ago |
|
|
4bafce21c7 | 3 days ago |
|
|
9ffb8aa715 | 3 days ago |
|
|
b9aa2b5811 | 3 days ago |
|
|
5d68765a53 | 3 days ago |
|
|
61608a9fcb | 3 days ago |
|
|
97ff121ce3 | 3 days ago |
|
|
e588a79cad | 3 days ago |
|
|
9fcaef192d | 3 days ago |
|
|
f7cd661fc8 | 3 days ago |
|
|
7a1bfce748 | 3 days ago |
|
|
75325d38b2 | 3 days ago |
|
|
2fc1a58afe | 3 days ago |
|
|
eedf0944bc | 3 days ago |
|
|
cc2f6670b6 | 3 days ago |
|
|
3df3728426 | 3 days ago |
|
|
4d79943e55 | 3 days ago |
|
|
afd8cb3bf5 | 3 days ago |
|
|
f965097f55 | 3 days ago |
|
|
0ffa6c7512 | 3 days ago |
|
|
37a607ba86 | 3 days ago |
|
|
9e13222bd1 | 3 days ago |
|
|
f43a9f19d7 | 3 days ago |
|
|
307c7c6038 | 3 days ago |
|
|
ce2ae0ea61 | 3 days ago |
|
|
7140fab3f5 | 3 days ago |
|
|
4454747453 | 3 days ago |
|
|
cb80a03df3 | 3 days ago |
|
|
ed570b8dc4 | 3 days ago |
|
|
53d8ecaa23 | 3 days ago |
|
|
8cc8f6f079 | 3 days ago |
|
|
5797a0734a | 3 days ago |
|
|
921737ff6e | 3 days ago |
|
|
78996ea015 | 3 days ago |
|
|
dd0b73c2cb | 3 days ago |
|
|
ac26577771 | 3 days ago |
|
|
7d46d0f74d | 3 days ago |
|
|
a64604e76e | 3 days ago |
|
|
e4fa0f7082 | 3 days ago |
|
|
75762f120a | 3 days ago |
|
|
08454a385d | 3 days ago |
|
|
6d764c1c52 | 3 days ago |
|
|
12494ebb9f | 3 days ago |
|
|
8bb167acd1 | 4 days ago |
|
|
b6930b424b | 4 days ago |
|
|
0d500ede48 | 4 days ago |
@ -0,0 +1,68 @@
|
||||
#! /usr/bin/env python3
|
||||
"""
|
||||
example Python gpsd client
|
||||
run this way: python3 example1.py.txt
|
||||
"""
|
||||
|
||||
# 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 time
|
||||
|
||||
try:
|
||||
|
||||
mode = -1
|
||||
lat = 0
|
||||
lon = 0
|
||||
alt = 0
|
||||
|
||||
session = gps.gps(mode=gps.WATCH_ENABLE)
|
||||
|
||||
start = time.perf_counter()
|
||||
|
||||
try:
|
||||
while (session.read() == 0) and ((time.perf_counter() - start) < 2) and (mode < 2):
|
||||
# print(gps.MODE_SET)
|
||||
# print(session.valid)
|
||||
if (session.valid):
|
||||
# not useful, probably not a TPV message
|
||||
# continue
|
||||
|
||||
# print('Mode: %s(%d) Time: ' %
|
||||
# (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode],
|
||||
# session.fix.mode), end="")
|
||||
# print time, if we have it
|
||||
# print("%d " % session.fix.mode, end="")
|
||||
if (session.fix.mode > mode):
|
||||
mode = session.fix.mode
|
||||
# if gps.TIME_SET & session.valid:
|
||||
# print(session.fix.time, end="")
|
||||
# else:
|
||||
# print('n/a', end="")
|
||||
|
||||
if gps.isfinite(session.fix.latitude):
|
||||
lat = session.fix.latitude
|
||||
if gps.isfinite(session.fix.longitude):
|
||||
lon = session.fix.longitude
|
||||
if gps.isfinite(session.fix.altitude):
|
||||
alt = session.fix.altitude
|
||||
# print("%.6f %.6f %.6f" % (session.fix.latitude, session.fix.longitude, session.fix.altitude))
|
||||
|
||||
# else:
|
||||
# print(" 0 0 0")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
# got a ^C. Say bye, bye
|
||||
print('')
|
||||
|
||||
# Got ^C, or fell out of the loop. Cleanup, and leave.
|
||||
session.close()
|
||||
print("%d %.6f %.6f %.1f" % (mode, lat, lon, alt))
|
||||
# exit(0)
|
||||
|
||||
except:
|
||||
print("-1 0 0 0")
|
||||
exit(0)
|
||||
|
||||
Loading…
Reference in new issue