-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPS_Controller.py
More file actions
33 lines (26 loc) · 858 Bytes
/
GPS_Controller.py
File metadata and controls
33 lines (26 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
from gps import *
import threading
# Initialise the Ultimate GPS Controller class
#os.system('sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock') #gpsd autostart enabled via command: sudo dpkg-reconfigure gpsd
class GpsController(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
self.running = False
def run(self):
self.running = True
while self.running:
# grab EACH set of gpsd info to clear the buffer
self.gpsd.next()
def stopController(self):
self.running = False
@property
def fix(self):
return self.gpsd.fix
@property
def utc(self):
return self.gpsd.utc
@property
def satellites(self):
return self.gpsd.satellites