|
|
|
@ -11,18 +11,17 @@ run this way: python3 example1.py.txt
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
import gps # the gpsd interface module
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = time.perf_counter()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mode = -1
|
|
|
|
mode = -1
|
|
|
|
|
|
|
|
|
|
|
|
lat = 0
|
|
|
|
lat = 0
|
|
|
|
|
|
|
|
|
|
|
|
lon = 0
|
|
|
|
lon = 0
|
|
|
|
|
|
|
|
|
|
|
|
alt = 0
|
|
|
|
alt = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session = gps.gps(mode=gps.WATCH_ENABLE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = time.perf_counter()
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
while (session.read() == 0) and ((time.perf_counter() - start) < 2) and (mode < 2):
|
|
|
|
while (session.read() == 0) and ((time.perf_counter() - start) < 2) and (mode < 2):
|
|
|
|
# print(gps.MODE_SET)
|
|
|
|
# print(gps.MODE_SET)
|
|
|
|
|