forked from daveake/flextrak
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracker.py
More file actions
executable file
·38 lines (29 loc) · 1.02 KB
/
tracker.py
File metadata and controls
executable file
·38 lines (29 loc) · 1.02 KB
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
33
34
35
36
37
38
from flextrak import *
from time import sleep
def extra_telemetry():
# Return any extra fields as CSV string
return ""
def take_photo(filename, width, height, gps):
# sample code to take a photo
# Use the gps object if you want to add a telemetry overlay, or use different image sizes at different altitudes, for example
with picamera.PiCamera() as camera:
camera.resolution = (width, height)
camera.start_preview()
time.sleep(2)
camera.capture(filename)
camera.stop_preview()
def GotNewSentence(Sentence):
print(Sentence)
def GotNewPosition(Position):
print(str(Position['time']) + ', ' + "{:.5f}".format(Position['lat']) + ', ' + "{:.5f}".format(Position['lon']) + ', ' + str(Position['alt']) + ', ' + str(Position['sats']))
print ("Load tracker ...")
mytracker = Tracker()
mytracker.LoadSettings("flextrak.ini")
# Callbacks
mytracker.WhenNewSentence = GotNewSentence
mytracker.WhenNewPosition = GotNewPosition
print ("Start tracker ...")
mytracker.start()
print ("Loop ...")
while True:
sleep(1)