Commit 0ac0e582 authored by Sigurd M. Albrektsen's avatar Sigurd M. Albrektsen

Bugfixes of TOT addition

parent 16a20a86
......@@ -27,6 +27,8 @@ def extract_packages(fname, parsers):
last_ten_percent = 0
packages = {}
print('Extracting: %s' % fname)
print('')
while True:
try:
ten_percent = int(reader.file_percentage()*10)
......@@ -35,7 +37,11 @@ def extract_packages(fname, parsers):
last_ten_percent = ten_percent
raw_pack = reader.get_package()
parser = parsers[raw_pack.package_type]
pack = parser.parse_buffer(raw_pack)
try:
pack = parser.parse_buffer(raw_pack)
except Exception as e:
print 'Could not parse package', e
continue
except EOFError:
break
......
......@@ -84,9 +84,9 @@ class UbloxPackageRxmSfrbX(UbloxPackage):
ubx_name = 'RXM-SFRBX'
ubx_id = '\x02\x13'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
self._name = self.ubx_name
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
self._dict.update(dict(zip(('gnssId', 'svId'),
struct.unpack_from('BB', package, 0))))
......@@ -108,9 +108,9 @@ class UbloxPackageRxmSfrbX(UbloxPackage):
class UbloxPackageRxmMeasX(UbloxPackage):
ubx_name = 'RXM-MEASX'
ubx_id = '\x02\x14'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
self._name = self.ubx_name
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
self._dict.update(dict(('version', ), struct.unpack_from('B', self.package, 0)))
......@@ -147,8 +147,8 @@ class UbloxPackageNavPosLLH(UbloxPackage):
ubx_name = 'NAV-POSLLH'
ubx_id = '\x01\x02'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
iTow, lon, lat, height, hMSL, hAcc, vAcc = struct.unpack('I4i2I', self.package[:])
self._dict.update({'iTow': iTow, 'lon': lon, 'lat': lat, 'height': height, 'hMSL': hMSL, 'hAcc': hAcc, 'vAcc': vAcc})
......@@ -157,8 +157,8 @@ class UbloxPackageNavPosECEF(UbloxPackage):
ubx_name = 'NAV-POSECEF'
ubx_id = '\x01\x01'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
iTow, ecefX, ecefY, ecefZ, pAcc = struct.unpack('I3iI', self.package[:])
self._dict.update({'iTow': iTow, 'ecefX': ecefX, 'ecefY': ecefY, 'ecefZ': ecefZ, 'pAcc': pAcc})
......@@ -167,8 +167,8 @@ class UbloxPackageNavVelEcef(UbloxPackage):
ubx_name = 'NAV-VELECEF'
ubx_id = '\x01\x11'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
iTow, ecefVX, ecefVY, ecefVZ, sAcc = struct.unpack('I3iI', self.package[:])
self._dict.update({'iTow': iTow, 'ecefVX': ecefVX, 'ecefVY': ecefVY, 'ecefVZ': ecefVZ, 'sAcc': sAcc})
......@@ -177,8 +177,8 @@ class UbloxPackageNavVelNED(UbloxPackage):
ubx_name = 'NAV-VELNED'
ubx_id = '\x01\x12'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
names = ('iTow', 'velN', 'velE', 'velD', 'speed', 'gSpeed', 'heading', 'sAcc', 'cAcc')
values = struct.unpack('I3i2Ii2I', self.package)
......@@ -188,8 +188,8 @@ class UbloxPackagePVT(UbloxPackage):
ubx_name = 'NAV-PVT'
ubx_id = '\x01\x07'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
iTow, year, month, day, hour, minute, sec = struct.unpack_from('IH5B', self.package, 0)
......@@ -211,8 +211,8 @@ class UbloxPackageNavClock(UbloxPackage):
ubx_name = 'NAV-CLOCK'
ubx_id = '\x01\x22'
def __init__(self, ubx_id, tov, package, toa, tov, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tov, timestamp)
def __init__(self, ubx_id, tov, package, toa, tot, timestamp):
UbloxPackage.__init__(self, ubx_id, tov, package, toa, tot, timestamp)
names = ('iTow', 'clkB', 'clkD', 'tAcc', 'fAcc')
values = struct.unpack('I2i2I', self.package)
......
......@@ -213,12 +213,6 @@ class SyncboardReader(object):
print(repr(buf))
return -1, None
if buf[:2] == '^C':
buf = self.com.bufread(4 + 4)
self.splinter_time_raw = buf[2:-2]
#TODO: check this
buf = '^B' + buf[2:]
#Found something that looks like a package
n_bytes = struct.unpack('H', buf[-2:])[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment