|
|
|
@ -11,14 +11,14 @@ run this way: python3 example1.py.txt
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mode = -1
|
|
|
|
|
|
|
|
lat = 0
|
|
|
|
|
|
|
|
lon = 0
|
|
|
|
|
|
|
|
alt = 0
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
|
|
|
|
|
|
|
|
mode = -1
|
|
|
|
|
|
|
|
lat = 0
|
|
|
|
|
|
|
|
lon = 0
|
|
|
|
|
|
|
|
alt = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = time.perf_counter()
|
|
|
|
start = time.perf_counter()
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,10 +60,8 @@ try:
|
|
|
|
|
|
|
|
|
|
|
|
# Got ^C, or fell out of the loop. Cleanup, and leave.
|
|
|
|
# Got ^C, or fell out of the loop. Cleanup, and leave.
|
|
|
|
session.close()
|
|
|
|
session.close()
|
|
|
|
print("%d %.6f %.6f %.1f" % (mode, lat, lon, alt))
|
|
|
|
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
print("-1 0 0 0")
|
|
|
|
print("%d %.6f %.6f %.1f" % (mode, lat, lon, alt))
|
|
|
|
exit(0)
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
|