diff options
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/logconv.m | 3 | ||||
-rw-r--r-- | Tools/logconv.py | 59 |
2 files changed, 2 insertions, 60 deletions
diff --git a/Tools/logconv.m b/Tools/logconv.m index f7c291b48..f2ae6e5f3 100644 --- a/Tools/logconv.m +++ b/Tools/logconv.m @@ -16,7 +16,7 @@ close all % ************************************************************************
% Set the path to your sysvector.bin file here
-filePath = 'log_second_flight.bin';
+filePath = 'log001.bin';
% Set the minimum and maximum times to plot here [in seconds]
mintime=0; %The minimum time/timestamp to display, as set by the user [0 for first element / start]
@@ -111,6 +111,7 @@ function ImportPX4LogData() time_us = sysvector.TIME_StartTime(end) - sysvector.TIME_StartTime(1);
time_s = uint64(time_us*1e-6);
time_m = uint64(time_s/60);
+ time_s = time_s - time_m * 60
disp([sprintf('Flight log duration: %d:%d (minutes:seconds)', time_m, time_s)]);
diff --git a/Tools/logconv.py b/Tools/logconv.py deleted file mode 100644 index c47d22a45..000000000 --- a/Tools/logconv.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -"""Convert binary log generated by sdlog to CSV format - -Usage: python logconv.py <log.bin>""" - -__author__ = "Anton Babushkin" -__version__ = "0.1" - -import struct, sys - -def _unpack_packet(data): - s = "" - s += "Q" #.timestamp = buf.raw.timestamp, - s += "fff" #.gyro = {buf.raw.gyro_rad_s[0], buf.raw.gyro_rad_s[1], buf.raw.gyro_rad_s[2]}, - s += "fff" #.accel = {buf.raw.accelerometer_m_s2[0], buf.raw.accelerometer_m_s2[1], buf.raw.accelerometer_m_s2[2]}, - s += "fff" #.mag = {buf.raw.magnetometer_ga[0], buf.raw.magnetometer_ga[1], buf.raw.magnetometer_ga[2]}, - s += "f" #.baro = buf.raw.baro_pres_mbar, - s += "f" #.baro_alt = buf.raw.baro_alt_meter, - s += "f" #.baro_temp = buf.raw.baro_temp_celcius, - s += "ffff" #.control = {buf.act_controls.control[0], buf.act_controls.control[1], buf.act_controls.control[2], buf.act_controls.control[3]}, - s += "ffffffff" #.actuators = {buf.act_outputs.output[0], buf.act_outputs.output[1], buf.act_outputs.output[2], buf.act_outputs.output[3], buf.act_outputs.output[4], buf.act_outputs.output[5], buf.act_outputs.output[6], buf.act_outputs.output[7]}, - s += "f" #.vbat = buf.batt.voltage_v, - s += "f" #.bat_current = buf.batt.current_a, - s += "f" #.bat_discharged = buf.batt.discharged_mah, - s += "ffff" #.adc = {buf.raw.adc_voltage_v[0], buf.raw.adc_voltage_v[1], buf.raw.adc_voltage_v[2], buf.raw.adc_voltage_v[3]}, - s += "fff" #.local_position = {buf.local_pos.x, buf.local_pos.y, buf.local_pos.z}, - s += "iii" #.gps_raw_position = {buf.gps_pos.lat, buf.gps_pos.lon, buf.gps_pos.alt}, - s += "fff" #.attitude = {buf.att.pitch, buf.att.roll, buf.att.yaw}, - s += "fffffffff" #.rotMatrix = {buf.att.R[0][0], buf.att.R[0][1], buf.att.R[0][2], buf.att.R[1][0], buf.att.R[1][1], buf.att.R[1][2], buf.att.R[2][0], buf.att.R[2][1], buf.att.R[2][2]}, - s += "fff" #.vicon = {buf.vicon_pos.x, buf.vicon_pos.y, buf.vicon_pos.z, buf.vicon_pos.roll, buf.vicon_pos.pitch, buf.vicon_pos.yaw}, - s += "ffff" #.control_effective = {buf.act_controls_effective.control_effective[0], buf.act_controls_effective.control_effective[1], buf.act_controls_effective.control_effective[2], buf.act_controls_effective.control_effective[3]}, - s += "ffffff" #.flow = {buf.flow.flow_raw_x, buf.flow.flow_raw_y, buf.flow.flow_comp_x_m, buf.flow.flow_comp_y_m, buf.flow.ground_distance_m, buf.flow.quality}, - s += "f" #.diff_pressure = buf.diff_pres.differential_pressure_pa, - s += "f" #.ind_airspeed = buf.airspeed.indicated_airspeed_m_s, - s += "f" #.true_airspeed = buf.airspeed.true_airspeed_m_s - s += "iii" # to align to 280 - d = struct.unpack(s, data) - return d - -def _main(): - if len(sys.argv) < 2: - print "Usage:\npython logconv.py <log.bin>" - return - fn = sys.argv[1] - sysvector_size = 280 - f = open(fn, "r") - while True: - data = f.read(sysvector_size) - if len(data) < sysvector_size: - break - a = [] - for i in _unpack_packet(data): - a.append(str(i)) - print ";".join(a) - f.close() - -if __name__ == "__main__": - _main() |