-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from Stefal/unicore_um980
support for Unicore um98x (rtcm3 mode)
- Loading branch information
Showing
14 changed files
with
684 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Config file for using a Unicore UM980 with RTKBase (RTCM3) | ||
# SIGNALGROUP will reset the device | ||
CONFIG SIGNALGROUP 2 | ||
CONFIG SBAS ENABLE AUTO | ||
MODE BASE 1 TIME 60 1 | ||
rtcm1019 1 | ||
rtcm1020 1 | ||
rtcm1042 1 | ||
rtcm1044 1 | ||
rtcm1045 1 | ||
rtcm1046 1 | ||
rtcm1077 1 | ||
rtcm1087 1 | ||
rtcm1097 1 | ||
rtcm1107 1 | ||
rtcm1117 1 | ||
rtcm1127 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Config file for using a Unicore UM982 with RTKBase (RTCM3) | ||
# SIGNALGROUP will reset the device | ||
CONFIG SIGNALGROUP 7 0 | ||
CONFIG SBAS ENABLE AUTO | ||
MODE BASE 1 TIME 60 1 | ||
rtcm1019 1 | ||
rtcm1020 1 | ||
rtcm1042 1 | ||
rtcm1044 1 | ||
rtcm1045 1 | ||
rtcm1046 1 | ||
rtcm1077 1 | ||
rtcm1087 1 | ||
rtcm1097 1 | ||
rtcm1107 1 | ||
rtcm1117 1 | ||
rtcm1127 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
[project] | ||
name = "unicore_gnss" | ||
version = "0.0.1" | ||
dependencies = ["pyserial",] | ||
|
||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#! /usr/bin/env python3 | ||
import serial | ||
import time | ||
|
||
|
||
class SerialComm: | ||
def __init__( | ||
self, | ||
address, | ||
baudrate=115200, | ||
timeout=5, | ||
write_timeout=5, | ||
cmd_delay=0.1, | ||
on_error=None, | ||
byte_encoding="ISO-8859-1", | ||
): | ||
self.cmd_delay = cmd_delay | ||
self.on_error = on_error | ||
self.byte_encoding = byte_encoding | ||
self.device_serial = serial.Serial( | ||
port=address, | ||
baudrate=baudrate, | ||
timeout=timeout, | ||
write_timeout=write_timeout, | ||
bytesize = serial.EIGHTBITS, | ||
parity = serial.PARITY_NONE, | ||
stopbits = serial.STOPBITS_ONE, | ||
xonxoff = False, | ||
rtscts = False, | ||
dsrdtr = False, | ||
) | ||
|
||
def send(self, cmd) -> str or None: | ||
self.device_serial.write(cmd.encode(self.byte_encoding) + b"\r\n") | ||
time.sleep(self.cmd_delay) | ||
|
||
def send_raw(self, cmd): | ||
self.device_serial.write(cmd) | ||
time.sleep(self.cmd_delay) | ||
|
||
def read_lines(self) -> list: | ||
read = self.device_serial.readlines() | ||
for i, line in enumerate(read): | ||
read[i] = line.decode(self.byte_encoding, errors='ignore').strip() | ||
return read | ||
|
||
def read_until(self, expected='\r\n') -> list: | ||
read = self.device_serial.read_until(expected = expected.encode()) | ||
read = read.decode(self.byte_encoding, errors='ignore').strip().splitlines() | ||
read = [ val for val in read if val != ''] | ||
return read | ||
|
||
def read_until_line(self, expected='\r\n', eol='\r\n') -> str: | ||
#while True: | ||
read_start = self.device_serial.read_until(expected = expected.encode()) | ||
read_start = read_start.decode(self.byte_encoding, errors='ignore').strip().splitlines()[-1] | ||
if expected in read_start: | ||
read_end = self.device_serial.readline().decode(self.byte_encoding, errors='ignore') | ||
return read_start + read_end | ||
|
||
def read_raw(self, size: int): | ||
return self.device_serial.read(size) | ||
|
||
def close(self): | ||
self.device_serial.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /usr/bin/env python3 | ||
from . unicore_cmd import UnicoGnss | ||
|
||
def test_checksum(): | ||
c = object.__new__(UnicoGnss) | ||
assert c._xor8_checksum('VERSIONA') == '1B' | ||
|
||
def test_expected_res(): | ||
c = object.__new__(UnicoGnss) | ||
c.debug = False | ||
assert c._expected_res_for('VERSIONA') == '$command,VERSIONA,response: OK*45' | ||
assert c._expected_res_for('FRESET') == '$command,FRESET,response: OK*4D' | ||
|
||
def test_cmd_with_checksum(): | ||
c = object.__new__(UnicoGnss) | ||
assert c._cmd_with_checksum('VERSIONA') == '$VERSIONA*1B' | ||
assert c._cmd_with_checksum('SAVECONFIG') == '$SAVECONFIG*0B' | ||
|
Oops, something went wrong.