Commit d7b1e98a authored by Sigurd M. Albrektsen's avatar Sigurd M. Albrektsen

Merge branch 'develop' of gitlab.kyb.guru:enfo/sentiboard-utils into develop

parents b7233868 c92390f5
Pipeline #121 failed with stages
in 22 seconds
......@@ -11,14 +11,22 @@ def print_usage():
print(' python rtklib2matlab.py [rover.pos]')
sys.exit(1)
def parseline(line):
names = ['week', 'tow', 'ecef_x', 'ecef_y', 'ecef_z', 'Q', 'ns', 'sdx', 'sdy',
'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio']
values = line.split()
def parseline(line, names):
values = line.split('|')
converters = [int] + [float]*4 + [int]*2 + [float]*8
conv_vals = [c(v) for c, v in zip(converters, values) ]
return dict(zip(names, conv_vals))
def handle_name(name):
name = name.strip().lower()
if '(' in name:
name = name[:name.index('(')]
name = name.replace('-', '_')
return name
if __name__ == '__main__':
import sys
......@@ -32,6 +40,9 @@ if __name__ == '__main__':
outfile = os.path.splitext(infile)[0] + '.mat'
print('Converting %s to to %s' % (infile, outfile))
names = ['week', 'tow', 'ecef_x', 'ecef_y', 'ecef_z', 'Q', 'ns', 'sdx', 'sdy',
'sdz', 'sdxy', 'sdyz', 'sdzx', 'age', 'ratio']
n_lines = 0
with open(infile, 'rU') as f:
for line in f:
......@@ -46,8 +57,12 @@ if __name__ == '__main__':
c_line = 0
for line in f:
if line.startswith('%'):
if 'age' in line:
names = [handle_name(name) for name in line.strip('% ').split('|')]
if names[0] == 'gpst':
names.insert(0, 'week')
continue
data_line = parseline(line)
data_line = parseline(line, names)
for key, val in data_line.items():
try:
data[key][c_line] = val
......
......@@ -178,17 +178,29 @@ class StimParser(object):
accl_x, accl_y, accl_z,
incl_x, incl_y, incl_z, temp)
'''
#print package[:20]
stim_package = StimPackage(pack.tov, pack.toa, pack.tot, pack.timestamp,
delta_values = True
if delta_values:
stim_package = StimPackage(pack.tov, pack.toa, pack.tot, pack.timestamp,
GX3, GX2, GX1, GY3, GY2, GY1, GZ3, GZ2, GZ1, GS,
AX3, AX2, AX1, AY3, AY2, AY1, AZ3, AZ2, AZ1, AS,
IX3, IX2, IX1, IY3, IY2, IY1, IZ3, IZ2, IZ1, IS,
COUNT, LATENCY, CRC,
angular_rate=False, incremental_angle=True,
acceleration=False, incremental_velocity=True,
incl_acceleration=False, incl_incremental_velocity=True,
incl_average=False, g_range='10g')
else:
stim_package = StimPackage(pack.tov, pack.toa, pack.tot, pack.timestamp,
GX3, GX2, GX1, GY3, GY2, GY1, GZ3, GZ2, GZ1, GS,
AX3, AX2, AX1, AY3, AY2, AY1, AZ3, AZ2, AZ1, AS,
IX3, IX2, IX1, IY3, IY2, IY1, IZ3, IZ2, IZ1, IS,
COUNT, LATENCY, CRC,
angular_rate=False, incremental_angle=True,
acceleration=False, incremental_velocity=True,
incl_acceleration=False, incl_incremental_velocity=True,
angular_rate=True, incremental_angle=False,
acceleration=True, incremental_velocity=False,
incl_acceleration=True, incl_incremental_velocity=False,
incl_average=False, g_range='10g')
return stim_package
......@@ -213,7 +225,7 @@ if __name__ == '__main__':
try:
while True:
package_buf = reader.get_package()
if package_buf == None:
break
try:
......
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