Georacer / ardupilog

A ardupilot log to MATLAB converter
GNU General Public License v3.0
48 stars 36 forks source link
ardupilot log

ardupilog

An Ardupilot log to MATLAB converter. Primarily intended to facilitate processing of logs under MATLAB environment.

It is very efficient: The time required to parse large logs is in the order of seconds.

cover

Supported log formats

Currently, only Dataflash logs (.bin files) are supported.

Usage

Add the ardupilog source code to your path. Then,

log = Ardupilog()

will open a file browser, where you can select the log file you want to decode.

Alternatively, the path can be passed directly as a string:

log = Ardupilog('<path-to-log-string>')

The variable struct log will be generated with the included message types as fields. Each field is a variable of type LogMsgGroup.

Each LogMsgGroup under a log contains the following members:

Plotting

To plot a specific numerical data field from a specific message, you can enter:

log.plot('<msgName>/<fieldName>')

The full command allows for passnig a Matlab-style line style and an existing Axes Handle to plot in. Additionally, it always returns the Axes Handles it plots in:

ah = log.plot('<msgName>/<fieldName>',<lineStyle>,<axesHandle>)

For example, to plot the Pitch field from the AHR2 message in red, enter:

log.plot('AHR2/Pitch', 'r')

and to plot more than one series in the same figure, you can capture the axis handle of the first plot:

ah = log.plot('AHR2/Roll')
log.plot('AHR2/Pitch', 'r', ah)

Mode change lines

By default ardupilog plots vertical lines that signify mode changes. You can inspect the mode name by clicking on them with the Data Cursor.

You can disable mode line plotting with log.disableModePlot();

You can re-enable mode line plotting with log.enableModePlot();

Message Filter

You can optionally filter the log file for specific message types:

log_filtered = log.filterMsgs(<msgFilter>)
log_filtered = Ardupilog('<path-to-log>', <msgFilter>)

msgFilter can be:

Example

log_filtered = log.filterMsgs({'POS', 'AHR2'})

Slicing

Typically, only a small portion of the flight log is of interest. Ardupilog supports slicing logs to a specific start-end interval with:

sliced_log = log.getSlice([<start_value>, <end_vlaue>], <slice_type>)

Example

log_during_cruise = log.getSlice([t_begin_cruise, t_end_cruise], 'TimeS')

Exporting to plain struct

To parse and use the log object created by

log = Ardupilog('<path-to-log>')

requires the ardupilog library to exist in the current MATLAB path.

Creating a more basic struct file, free of the ardupilog dependency, is possible with:

log_struct = log.getStruct()

log_struct does not need the ardupilog source code accompanying it to be shared.

Supported log versions

Logs from the following versions are been tested for Continuous Integration:

LICENSE

This work is distributed under the GNU GPLv3 license.