Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
7861caf4
Commit
7861caf4
authored
11 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
Hotfix: Cleanup / revision of log conversion scripts
parent
4b342c4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tools/logconv.m
+2
-1
2 additions, 1 deletion
Tools/logconv.m
Tools/logconv.py
+0
-59
0 additions, 59 deletions
Tools/logconv.py
with
2 additions
and
60 deletions
Tools/logconv.m
+
2
−
1
View file @
7861caf4
...
...
@@ -16,7 +16,7 @@ close all
% ************************************************************************
% Set the path to your sysvector.bin file here
filePath
=
'log
_second_flight
.bin'
;
filePath
=
'log
001
.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
)]);
...
...
This diff is collapsed.
Click to expand it.
Tools/logconv.py
deleted
100644 → 0
+
0
−
59
View file @
4b342c4a
#!/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:
\n
python 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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment