Skip to content

Commit

Permalink
Merge pull request #43 from Aceinna/develop
Browse files Browse the repository at this point in the history
Merge Develop to Master
  • Loading branch information
yiweisong authored Jul 1, 2020
2 parents 7618799 + a65592d commit e56b6b8
Show file tree
Hide file tree
Showing 32 changed files with 5,460 additions and 268 deletions.
232 changes: 229 additions & 3 deletions openrtk_data_parse/openrtk_packets.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"userNMEAList": ["$GPGGA", "$GPRMC", "$GPGSV", "$GLGSV", "$GAGSV", "$BDGSV", "$GPGSA", "$GLGSA", "$GAGSA", "$BDGSA"],
"userPacketsTypeList": ["s1", "K1", "pS", "sK"],
"userPacketsTypeList": ["s1", "K1", "pS", "sK", "iN", "d1", "gN"],
"debugPacketsTypeList": [177, 268, 42, 99, 507],
"userOutputPackets": [
{
Expand Down Expand Up @@ -48,6 +48,204 @@
"unit": "deg/s"
}
]
},
{
"name": "iN",
"isList": 0,
"payload": [
{
"type": "uint32",
"name": "GPS_Week",
"unit": ""
},
{
"type": "double",
"name": "GPS_TimeofWeek",
"unit": "sec"
},
{
"type": "uint8",
"name": "insStatus",
"unit": ""
},
{
"type": "uint8",
"name": "insPositionType",
"unit": ""
},
{
"type": "int32",
"name": "latitude",
"unit": "deg"
},
{
"type": "int32",
"name": "longitude",
"unit": "deg"
},
{
"type": "float",
"name": "height",
"unit": "m"
},
{
"type": "int16",
"name": "velocityNorth",
"unit": "m/s"
},
{
"type": "int16",
"name": "velocityEast",
"unit": "m/s"
},
{
"type": "int16",
"name": "velocityUp",
"unit": "m/s"
},
{
"type": "int16",
"name": "roll",
"unit": "m/s"
},
{
"type": "int16",
"name": "pitch",
"unit": "m/s"
},
{
"type": "int16",
"name": "heading",
"unit": "m/s"
}
]
},
{
"name": "d1",
"isList": 0,
"payload": [
{
"type": "uint32",
"name": "GPS_Week",
"unit": ""
},
{
"type": "double",
"name": "GPS_TimeofWeek",
"unit": "sec"
},
{
"type": "int16",
"name": "latitude_std",
"unit": ""
},
{
"type": "int16",
"name": "longitude_std",
"unit": ""
},
{
"type": "int16",
"name": "height_std",
"unit": ""
},
{
"type": "int16",
"name": "north_vel_std",
"unit": ""
},
{
"type": "int16",
"name": "east_vel_std",
"unit": ""
},
{
"type": "int16",
"name": "up_vel_std",
"unit": ""
},
{
"type": "int16",
"name": "roll_std",
"unit": ""
},
{
"type": "int16",
"name": "pitch_std",
"unit": ""
},
{
"type": "int16",
"name": "heading_std",
"unit": ""
}
]
},
{
"name": "gN",
"isList": 0,
"payload": [
{
"type": "uint32",
"name": "GPS_Week",
"unit": ""
},
{
"type": "double",
"name": "GPS_TimeofWeek",
"unit": "sec"
},
{
"type": "uint8",
"name": "positionMode",
"unit": ""
},
{
"type": "int32",
"name": "latitude",
"unit": "deg"
},
{
"type": "int32",
"name": "longitude",
"unit": "deg"
},
{
"type": "float",
"name": "height",
"unit": "m"
},
{
"type": "uint8",
"name": "numberOfSVs",
"unit": ""
},
{
"type": "float",
"name": "hdop",
"unit": ""
},
{
"type": "uint16",
"name": "diffage",
"unit": ""
},
{
"type": "int16",
"name": "velocityNorth",
"unit": "m/s"
},
{
"type": "int16",
"name": "velocityEast",
"unit": "m/s"
},
{
"type": "int16",
"name": "velocityUp",
"unit": "m/s"
}
]
},
{
"name": "K1",
Expand Down Expand Up @@ -308,21 +506,49 @@
{
"name": "odo",
"messageId": "177",
"needHeadTime": 0,
"needHeadTime": 2,
"payload": [
{
"type": "uint32",
"name": "GPS_Week",
"unit": "",
"need": 1,
"format": ""
},
{
"type": "double",
"name": "GPS_TimeofWeek",
"unit": "s",
"need": 1,
"format": "11.4f"
},
{
"type": "uint8",
"name": "mode",
"unit": "",
"need": 1,
"format": ""
},
{
"type": "double",
"name": "speed",
"unit": "m/s",
"need": 2,
"need": 1,
"format": "10.4f"
},
{
"type": "uint8",
"name": "fwd",
"unit": "",
"need": 1,
"format": ""
},
{
"type": "uint64",
"name": "wheel_tick",
"unit": "",
"need": 2,
"format": ""
}
]
},
Expand Down
27 changes: 19 additions & 8 deletions openrtk_data_parse/openrtk_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def __init__(self, data_file, path):
self.nmea_sync = 0
self.log_files = {}

self.s1_time = 0.0
self.inspva_time = 0.0
self.std1_time = 0.0

with open('openrtk_packets.json') as json_data:
self.rtk_properties = json.load(json_data)

Expand All @@ -54,7 +58,7 @@ def start_pasre(self):
self.packet_buffer = []
self.sync_state = 0
else:
print('user data crc err!')
#print('user data crc err!')
self.sync_state = 0 # CRC did not match
else:
for packet_type in self.userPacketsTypeList:
Expand Down Expand Up @@ -115,6 +119,10 @@ def log(self, name, data):
for i in range(len(data)):
if i == 1:
self.log_files[name].write(format((data[i]), '11.4f'))
if self.s1_time != 0.0:
if float(data[i]) - self.s1_time > 0.01001:
print('S1 timeout: {0}'.format(float(data[i])))
self.s1_time = float(data[i])
elif i >= 2 and i <= 4:
self.log_files[name].write(format(data[i], '14.10f'))
elif i >= 5 and i <= 7:
Expand All @@ -131,6 +139,11 @@ def log(self, name, data):
self.log_files[name].write(data[i].__str__())
self.log_files[name].write(",")
self.log_files[name].write("\n")
if name == 'iN':
if self.inspva_time != 0.0:
if float(data[1]) - self.inspva_time > 0.01001:
print('inspva timeout: {0}'.format(float(data[1])))
self.inspva_time = float(data[1])

def parse_output_packet_payload(self, packet_type):
payload_lenth = self.packet_buffer[2]
Expand Down Expand Up @@ -271,7 +284,7 @@ def start_pasre(self):
self.sync_state = 0
else:
self.err_count = self.err_count + 1
print('debug data crc err. type {0} count{1}'.format(packet_type, self.err_count))
#print('debug data crc err. type {0} count{1}'.format(packet_type, self.err_count))
self.sync_state = 0 # CRC did not match
else:
for message_id in self.debugPacketsTypeList:
Expand Down Expand Up @@ -314,10 +327,8 @@ def log(self, output, data):
self.fp_all.write("$ODO,")
for i in range(len(data)):
if payload[i]['need']:
if i == 0:
if i == 1:
self.write_data_fm(name, data[i]/1000, payload[i]['format'])
self.write_data(name, ",")
self.write_data_fm(name, float(self.time_tag[1])/1000, '10.4f')
else:
self.write_data_fm(name, data[i], payload[i]['format'])
if payload[i]['need'] == 1:
Expand Down Expand Up @@ -479,9 +490,9 @@ def write_titlebar(self, file, output):
if value['need']:
file.write(value['name'])
file.write(",")
if value['name'] == 'GPS_TimeofWeek':
file.write('Time_Stamped')
file.write(",")
# if value['name'] == 'GPS_TimeofWeek':
# file.write('Time_Stamped')
# file.write(",")
else:
if output['needHeadTime'] == 2:
file.write('GPS_Week')
Expand Down
6 changes: 4 additions & 2 deletions samples/device_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def on_find_device(device):
device.setup(None)
# start log
device.start_data_log()

device._lock()
# print('Logging...')
time.sleep(10)
# time.sleep(10)
# stop log
device.stop_data_log()
# device.stop_data_log()
device.close()


Expand Down
3 changes: 1 addition & 2 deletions src/aceinna/bootstrap/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def on_receive_output_packet(self, method, packet_type, data):
'''
Listenr for receive output packet
'''

data_updated = False
for item in self.latest_packet_collection:
if item['packet_type'] == packet_type:
Expand Down Expand Up @@ -536,7 +535,7 @@ def handle_device_complete_upgrade(self):

def detect_device(self, callback):
'''find if there is a connected device'''
print('start to find device')
print('Prepare to find device...')
if self.communicator is None:
self.communicator = CommunicatorFactory.create(
self.communication, self.options)
Expand Down
Loading

0 comments on commit e56b6b8

Please sign in to comment.