A Cleanflight/Betaflight blackbox log parser written in Python 3.
Orangebox has no dependencies other than the Python standard library, although it might be worthy to investigate
how using numpy
could possibly bring some performance gain in the future. If so, it shouldn't be a usability barrier
since any user wanting to make something out of the decoded data will more than likely have numpy
installed
transitively as well as it's also a dependency of libraries like matplotlib
and pandas
(among others).
This parser was roughly modeled after the one in Blackbox Log Viewer hence produces the same output.
You can browse the full documentation online on Read the Docs, here's a quick example:
from orangebox import Parser
# Load a file
parser = Parser.load("btfl_all.bbl")
# or optionally select a log by index (1 is the default)
# parser = Parser.load("btfl_all.bbl", 1)
# Print headers
print("headers:", parser.headers)
# Print the names of fields
print("field names:", parser.field_names)
# Select a specific log within the file by index
print("log count:", parser.reader.log_count)
parser.set_log_index(2)
# Print field values frame by frame
for frame in parser.frames():
print("first frame:", frame.data)
break
# Complete list of events only available once all frames have been parsed
print("events:", parser.events)
# Selecting another log changes the header and frame data produced by the Parser
# and also clears any previous results and state
parser.set_log_index(1)
- Add support for GPS frames (thanks to @tblaha!)
- Improved
Reader
class can now handle multiple logs in a single file - Add
bbsplit
command-line script for splitting flashchip logs (thanks to @ysoldak!) - Improved logging
- Added HTML documentation
- Fix parsing stats
- Add
bb2csv
command-line script for converting logs into CSV
- First release (with a lot of missing parts)
- No explicit validation of raw data against corruption, missing headers or whatsoever, but it's highly likely that a Python exception will be raised in these cases anyway
- Tested only on logs generated by Betaflight
- Not all event frames are parsed (see TODO comments)
- Some decoders are missing (see TODO comments)
Original blackbox data encoder and decoder was written by Nicholas Sherlock.
This project is licensed under GPLv3.