Almost two years ago, @hunt0r and I needed to parse some ArduPlane logs. We are both on our track to get a PhD in UAV control systems and Matlab is a very common tool in our trade.
Sadly, at the time the only tool able to convert from DataFlash logs (.bin) to a format readable by Matlab was Mission Planner and it didn’t serve our needs well enough. It would work only on Windows, take a very long time to convert and would ignore all text fields.
So, we decided to create our own converter,
Ardupilog. It is Matlab-based, meaning that you need Matlab to run it.
It can read all DataFlash logs, since they are self-defining, and create a versatile log object.
You can even “flatten” the log into a classic struct, if you want the information to be independent of our library.
Reading a log
Ardupilog source code to your path.
log = Ardupilog()
will open a file browser, where you can select the log file you want to decode.
The variable struct
log will be generated with the included message types as fields.
Its contents can be normally processed with Matlab commands:
You can optionally filter the log file for specific message types:
log_filtered = log.filterMsgs(<msgFilter>)
msgFilter can be:
- Either a vector of integers, representing the message IDs you want to convert.
- Or a cell array of strings. Each string is the literal name of the message type.
Typically, only a small portion of the flight log is of interest.
Ardupilog supports slicing logs to a specific start-end interval. For example, to keep log messages from boot time 1000sec to 2500sec:
sliced_log = log.getSlice([1000, 2500], 'TimeS')
Exporting to plain struct
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.
More information can be found on the repo’s README.
Ardupilog does not receive regular updates, features that we’d like to see supported at some point are:
- Support for MAVLink
- Incorporation of DataFlash units for messages fields
- Interpolation of message field timeseries, where applicable
We hope this little project proves useful to those who need it.