Skip to main content

BlackBox-Parser

PyPI version Python versions License: MIT

A modular parser and telemetry analysis toolkit for drone flight logs. It fully supports both:

  • MAVLink telemetry logs (.tlog)
  • ArduPilot DataFlash binary logs (.bin)

Use it as a command-line tool or as an importable Python library.


Features

  • Format Auto-Detection: Automatically parses .tlog and .bin logs into a unified internal data schema.
  • Summary: Generates an overview of flight duration, speed, max altitude, battery usage, cumulative distance, displacement, climb/descent rates, and a chronological flight events timeline.
  • CSV Export: Extracts telemetry into output/csv/ for GPS, Attitude, Altitude, and Battery data.
  • Graphs: Generates PNG visualizations in output/graphs/ for Altitude, Battery, Speed, Power, and Attitude vs. Time.
  • PDF Report: Generates a self-contained PDF report with summary, embedded graphs, and warnings in output/flight_report.pdf.
  • Flight Track Map: Generates an interactive HTML map with color-coded flight path (green=slow, red=fast).
  • Anomalies: Detects critical warnings (low battery, altitude drop, excessive roll/pitch angles).
  • Batch Mode: Analyze multiple logs at once and compare them in a side-by-side table.
  • Interactive Mode: Menu-driven interface for users who prefer not to memorize CLI flags.

Installation

From PyPI

pip install blackbox-parser

From Source (Development)

git clone https://github.com/Punit-154/BlackBox-Parser.git
cd BlackBox-Parser

python -m venv venv
venv\Scripts\activate      # On Windows
# source venv/bin/activate # On macOS/Linux

pip install -e .

Usage

1. Command-Line Interface (CLI)

Once installed, use either blackbox-parser or the shortcut bbparser:

# View help
blackbox-parser --help

# Run specific analyses on a .tlog or .bin file
blackbox-parser logs/sample.tlog --summary
blackbox-parser logs/sample.bin --export --graphs

# Run all analysis steps at once (summary, export, graphs, warnings)
blackbox-parser logs/sample.tlog --all

# Generate a self-contained PDF report
blackbox-parser logs/sample.tlog --report

# Generate an interactive flight track map
blackbox-parser logs/sample.tlog --map

# Batch analyze all logs in a folder
blackbox-parser --batch logs/

# Interactive mode (menu-driven)
blackbox-parser --interactive

(You can also continue using python analyzer.py [args] from the root directory).


2. Python Library SDK

You can also import blackbox_parser directly into your Python scripts or Jupyter Notebooks:

import blackbox_parser as bbp

# 1. Parse a log file (.tlog or .bin)
data = bbp.parse_log("logs/flight.tlog")

# 2. Generate summary metrics
stats = bbp.generate_summary(data)
print(f"Flight Duration : {stats['duration_formatted']}")
print(f"Max Altitude    : {stats['max_altitude']} m")
print(f"Total Distance  : {stats['total_distance']} m")

# 3. Detect anomalies and warnings
warnings = bbp.run_all_checks(data)
bbp.print_warnings(warnings)

# 4. Export telemetry data to CSV files
bbp.export_all(data, output_dir="output/csv")

# 5. Generate Matplotlib graphs
bbp.generate_all_graphs(data, output_dir="output/graphs")

# 6. Generate a PDF report and interactive HTML track map
bbp.generate_report(data, output_dir="output")
bbp.generate_track_map(data, output_dir="output")

Architecture Notes

The project is built on a "schema normalization" approach:

  • parser.py maps the different raw messages from .tlog (GPS_RAW_INT, ATTITUDE, etc.) and .bin (GPS, ATT, etc.) into a common internal data structure using human-readable units (meters, degrees, m/s, volts).
  • Missing data fields in .bin files (such as battery_remaining, vx, vy, vz, relative_alt) are safely filtered out, handled as None, or skipped in downstream modules (summary.py, graphs.py, anomalies.py, exporter.py) to prevent errors and ensure backward compatibility.
  • Interactive mode runs an event loop that dispatches user menu selections to the same standalone functions used by the flag-based CLI.

Understanding the Metrics & Technical Background

Cumulative Flight Distance & Max Displacement

  • What it is:
    • Cumulative Distance: The total ground distance traveled by the drone over the entire flight.
    • Max Displacement: The furthest straight-line distance the drone flew away from its original takeoff point.
  • Why it exists: Useful for verifying that a flight stayed within required geofence limits (Displacement) and estimating total motor/propulsion work done (Distance).
  • Technical Background: Calculated using the Haversine formula. Because the Earth is a sphere, we cannot use simple 2D Cartesian math (sqrt(x^2 + y^2)) for GPS coordinates. The Haversine formula accounts for the curvature of the Earth to accurately measure the great-circle distance between two (Latitude, Longitude) points.

Peak Climb & Descent Rates

  • What it is: The maximum vertical velocity (in m/s) at which the drone gained or lost altitude.
  • Why it exists: Critical for safety analysis. Rapid descents can cause a drone to enter its own prop-wash (Vortex Ring State), leading to a crash.
  • Technical Background: Calculated using the discrete derivative of altitude with respect to time (dz / dt). By comparing the relative_alt at two consecutive timestamps, we can compute the vertical speed.

Flight Events Timeline

  • What it is: A chronologically ordered timeline of significant flight events (e.g., "Armed", "Takeoff", "Mode AUTO") printed directly in the terminal summary.
  • Why it exists: It provides critical context to understand the progression of the flight without needing to open external graphing tools. Knowing when the drone armed or changed flight modes is essential for diagnosing issues.
  • Technical Background: MAVLink (.tlog) and DataFlash (.bin) logs contain distinct text strings and event IDs. The analyzer parses STATUSTEXT, MSG, MODE, and EV packets, filters for keywords like "arm", "takeoff", or "mode", and formats them into a human-readable chronological timeline.

License

This project is licensed under the MIT License — see the LICENSE file for details.

Metadata

Release files for blackbox-parser 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blackbox-parser 0.1.0
File Size Uploaded Provenance Actions
blackbox_parser-0.1.0.tar.gz 34.5 kB With provenance Details for blackbox_parser-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blackbox-parser 0.1.0
File Interpreter ABI Platform Actions
blackbox_parser-0.1.0-py3-none-any.whl Python 3 none any Details for blackbox_parser-0.1.0-py3-none-any.whl

Total release size: 63.1 kB

Release files / blackbox_parser-0.1.0.tar.gz

Download URL blackbox_parser-0.1.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0c94bea91674838221fe53c345279893e842541d83f8304bef20092df951e81a
BLAKE2b-256 checksum
How to use checksums
6bc8f2591c1bda810f294409f890a3bc32f6340ba5143226a9d0f8719731050b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / blackbox_parser-0.1.0-py3-none-any.whl

Download URL blackbox_parser-0.1.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61999006c2921204b220dbe6a649fda6f7e7c9a57b44b88d9817a0c40e6bda08
BLAKE2b-256 checksum
How to use checksums
0aa1bb0ab7ee4789c4c0a45aef030a85a0e62e4e546aff80131236ef9ea75826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for blackbox-parser 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blackbox_parser-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page