Skip to main content

A lightweight python library to parse MavLink log files

Project description

codecov test PyPI version

pymavlog

A lightweight python library to parse log files from ArduPilot vehicles based on the MavLink protocol. It is built on top of pymavlink and uses NumPy under the hood to vectorize messages.

Installation

Installation with pip:

pip install pymavlog

or via Poetry

poetry add pymavlog

Development

Install the package in editable mode:

pip install -e .

Pymavlog is built using Poetry, so make sure to have it in your local development environment

pip install poetry

Lastly, install the pre-commit hooks

pip install pre-commit
pre-commit install

Testing

poetry run pytest tests --cov pymavlog

or

make tests

Usage

Mavlink log files are parsed using MavLog, which iterates through the logged messages and saves them in-memory as NumPy arrays. You can parse a file like:

from pymavlog import MavLog


filepath = "foo/bar.bin"
mavlog = MavLog("foo/bar.bin")
mavlog.parse()

and access the messages like:

imu_messages = mavlog.get("IMU")

and do some calculations, for example calculating the average value:

avg_gyr_x = imu_messages["GyrX"].mean()

alternatively, you can access a specific attribute like:

gyr_y = mavlog["IMU"]["Gyrx"]

Pymavlog also supports telemetry log files. You can read a tlog file .tlog in a similar way as binary log files, like:

from pymavlog import MavTLog


filepath = "foo/bar.tlog"
tlog = MavTLog("foo/bar.tlog")
tlog.parse()

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

pymavlog-0.4.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

pymavlog-0.4.2-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

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