forked from r0ro/skytraq
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sample.py
executable file
·50 lines (38 loc) · 1.32 KB
/
sample.py
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
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import binascii
from skytraq.venus8 import Venus8
serial_speed = None # 9600
# open com port
gps = Venus8('/dev/ttyUSB0', serial_speed, debug=False)
if serial_speed == None:
# try to guess serial speed
serial_speed = gps.guessSerialSpeed()
print("===================================")
print("==== device info =====")
print("===================================")
print("> serial port speed: ", serial_speed)
print("> soft version", gps.getSoftwareVersion(0))
print("> soft crc", binascii.hexlify(gps.getSoftwareCRC()).decode('utf8').upper())
waas_enabled = gps.getWaasStatus()
print("> waas: ", waas_enabled)
nav_mode = gps.getNavigationMode()
print("> navigation mode: ", nav_mode)
# ensure waas is enabled
if not waas_enabled:
print("Enable WAAS")
gps.setWaasStatus(True, True)
print("> waas: ", gps.getWaasStatus())
# ensure we are in pedestrian mode
if nav_mode != "pedestrian":
print("Enable pedestrian mode")
gps.setNavigationMode(True, True)
print("> navigation mode: ", gps.getNavigationMode())
print("===================================")
print("====== cold start demo =======")
print("===================================")
# Send Cold Start Command
gps.send_restart(restart_type=Venus8.COLD_START_MODE)
print("DONE")
#eph = gps.getEphemeris(0)
#print(eph)