Commit 1a0f7da2 authored by Sigurd M. Albrektsen's avatar Sigurd M. Albrektsen
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request enfo/sentiboard-utils!8
parents 8afc2b14 066529fc
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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]
            try:
                pack = parser.parse_buffer(raw_pack)
            except Exception as e:
                print 'Could not parse package', e
                continue
        except EOFError:
            break

+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ def handle_device(com, do_print):
            extra_bytes = (4 - ((data_len + HEADER_FOOTER_SIZE) & 0b11)) & 0b11
            com.read(extra_bytes)

            outfile.write(TIMED_SYNC_WORD + header[1:] + binarystamp + package_data + package_cs)
            outfile.write(TIMED_SYNC_WORD + header[2:] + binarystamp + package_data + package_cs)


            # Switch directory if the timeout has expired
+7 −5
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
import struct

class AeroprobePackage(object):
    def __init__(self, TOV, TOA, timestamp, S1, S2, V, Vin, AoA, AoS, A, Ps, Pt, TC, CS):
    def __init__(self, TOV, TOA, TOT, timestamp, S1, S2, V, Vin, AoA, AoS, A, Ps, Pt, TC, CS):
        self._tov = TOV
        self._toa = TOA
        self.V = V
@@ -14,7 +14,7 @@ class AeroprobePackage(object):
        self.Pt = Pt
        self.TC = TC

        self.dict = {'tov': TOV, 'toa': TOA, 'timestamp': timestamp,
        self.dict = {'tov': TOV, 'toa': TOA, 'tot': TOT, 'timestamp': timestamp,
                        'S1': S1, 'S2': S2, 'V': V,
                     'Vin': Vin, 'AoA': AoA, 'AoS': AoS, 'A': A, 'Ps': Ps,
                     'Pt': Pt, 'TC': TC, 'CS': CS}
@@ -31,20 +31,22 @@ class AeroprobeParser(object):
            #accel, 3x3 bytes, status
            #incl,  3x3 bytes, status
            #counter, lat, crc

            fmt = '>4B' + \
                  ' 3BH3B' + \
                  ' 4f' + \
                  ' i' + \
                  ' 3f B'
                  ' 2f B'
            aero_data = struct.unpack(fmt, buf[:])

            #print(alti_data)
            S1, S2, ID, L, \
                H, M, S, MS, MM, DD, YY, \
                V, Vin, AoA, AoS, \
                A, Ps, Pt, TC, \
                A, Ps, Pt, \
                CS = aero_data

            TC = 0
            '''
            print(buf.tov, buf.toa)
            print(ID)
@@ -53,7 +55,7 @@ class AeroprobeParser(object):
            print(H, M, S, MS)
            print(A, Ps, Pt, TC)
            '''
            return AeroprobePackage(buf.tov, buf.toa, buf.timestamp, S1, S2, V, Vin, AoA, AoS,
            return AeroprobePackage(buf.tov, buf.toa, buf.tot, buf.timestamp, S1, S2, V, Vin, AoA, AoS,
                                    A, Ps, Pt, TC, CS)
        except Exception:
            raise
+16 −16
Original line number Diff line number Diff line
@@ -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)
+0 −6
Original line number Diff line number Diff line
@@ -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]