On each log session (commonly started and stopped by arming and disarming the vehicle) a new file logxxx.bin is created. In many cases there will be only one logfile named log001.bin (only one flight).
There are two conversion scripts in this ZIP file:
logconv.m: This is a MATLAB script which will automatically convert and display the flight data with a GUI. If running this script, the second script can be ignored.
sdlog2_dump.py: This is a Python script (compatible with v2 and v3) which converts the self-describing binary log format to a CSV file. To export a CSV file from within a shell (Windows CMD or BASH on Linux / Mac OS), run:
@ -76,11 +67,7 @@ class SDLog2Parser:
@@ -76,11 +67,7 @@ class SDLog2Parser:
self.__msg_descrs={}# message descriptions by message type map
self.__msg_labels={}# message labels by message name map
self.__msg_names=[]# message names in the same order as FORMAT messages
#ifdef python2
self.__buffer=""# buffer, python2
#else
self.__buffer=bytearray()# buffer for input binary data
#endif
self.__buffer=""# buffer for input binary data
self.__ptr=0# read pointer in buffer
self.__csv_columns=[]# CSV file columns in correct order in format "MSG.label"
self.__csv_data={}# current values for all columns
@ -129,24 +116,15 @@ class SDLog2Parser:
@@ -129,24 +116,15 @@ class SDLog2Parser:
self.__buffer=self.__buffer[self.__ptr:]+chunk
self.__ptr=0
whileself.__bytesLeft()>=self.MSG_HEADER_LEN:
#ifdef python2
head1=ord(self.__buffer[self.__ptr])
head2=ord(self.__buffer[self.__ptr+1])
#else
head1=self.__buffer[self.__ptr]
head2=self.__buffer[self.__ptr+1]
#endif
if(head1!=self.MSG_HEAD1orhead2!=self.MSG_HEAD2):
ifself.__correct_errors:
self.__ptr+=1
continue
else:
raiseException("Invalid header at %i (0x%X): %02X%02X, must be %02X%02X"%(bytes_read+self.__ptr,bytes_read+self.__ptr,head1,head2,self.MSG_HEAD1,self.MSG_HEAD2))
#ifdef python2
msg_type=ord(self.__buffer[self.__ptr+2])
#else
msg_type=self.__buffer[self.__ptr+2]
#endif
ifmsg_type==self.MSG_TYPE_FORMAT:
# parse FORMAT message
ifself.__bytesLeft()<self.MSG_FORMAT_PACKET_LEN:
@ -192,13 +170,9 @@ class SDLog2Parser:
@@ -192,13 +170,9 @@ class SDLog2Parser: