Skip to main content

A Cleanflight/Betaflight blackbox log parser written in Python 3

Project description

Orangebox

PyPI version Documentation Status

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.

Documentation

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)

Contributing

  • Contributions are very welcome!
  • Please follow the PEP8 Style Guido.
  • More info in the docs.

Changelog

0.5.0

  • Breaking change: raise RuntimeError on unexpected end of log
  • New features and fixes thanks to @rtlopez!
    • Add support for Inav and Rotorflight events
    • Handle unexpected end of log
    • Event parsing bugfix

0.4.0

  • Inspect log files for potentially missing required headers
  • Allow skipping of badly formatted headers via the allow_invalid_header argument

0.3.1

  • Add bb2gpx utility for converting GPS data into GPX

0.3.0

  • Add support for GPS frames (thanks to @tblaha!)

0.2.0

  • 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

0.1.1-beta

  • Add bb2csv command-line script for converting logs into CSV

0.1.0-beta

  • First release (with a lot of missing parts)

Known issues

  • No explicit validation of raw data against corruption (except for headers), 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)

Acknowledgement

Original blackbox data encoder and decoder was written by Nicholas Sherlock.

License

This project is licensed under GPLv3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orangebox-0.5.0.tar.gz (42.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orangebox-0.5.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file orangebox-0.5.0.tar.gz.

File metadata

  • Download URL: orangebox-0.5.0.tar.gz
  • Upload date:
  • Size: 42.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for orangebox-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e1b096e2b0e07edcb428a3a9c810faba4189f02d1ac36e0f3925b78289cec583
MD5 488efafe4614aa554ca157d81391b5cc
BLAKE2b-256 82a89ca0d8f951b91c2ca493d8a2418d364409512990c656f0049e2931391f05

See more details on using hashes here.

File details

Details for the file orangebox-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: orangebox-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for orangebox-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a13d003a1caf13d84a422de1ca36fa0ad682e41a195ee207354c08fa5f451761
MD5 f2f56261595bdfddd02aad99bd22c744
BLAKE2b-256 04d7e87c820a1911c301e2679d7ff2594da8c830f5315d01e8bf518292e25a49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page