The All-in-One tool to work with PX4 log files.
Project description
title: px4-log-tool description: The All-in-One tool to work with PX4 log files.
Installation
Regular Installation
pip install px4-log-tool
Developer Mode
git clone https://www.github.com/tiiuae/px4-log-tool.git
cd px4-log-tool
pip install -e .
Shell Tab-Completions
Currently only Bash, Zsh and Fish shells are supported. After installing the CLI tool:
_PX4_LOG_TOOL_COMPLETE=bash_source px4-log-tool > ~/.px4_log_tool_completion.bash
_PX4_LOG_TOOL_COMPLETE=zsh_source px4-log-tool > ~/.px4_log_tool_completion.zsh
_PX4_LOG_TOOL_COMPLETE=fish_source px4-log-tool > ~/.px4_log_tool_completion.fish
Then source the generated completion shell file into you .bashrc, .zshrc or config.fish. Example:
echo "source ~/.px4_log_tool_completion.bash" >> ~/.bashrc && source ~/.bashrc
Usage
The CLI tool should have a rich help feature.
px4-log-tool --help
px4-log-tool subcommands --help
Every subcommand is documented and can be queried with the --help flag.
By default, the logging is set to only flag "ERROR" that cause the program to fail.
px4-log-tool --verbose subcommands #shows ERROR
To see general INFO and WARN messages, adjust the environment variable PRINT_LEVEL to 2 or 1.
PRINT_LEVEL=1 px4-log-tool --verbose subcommands #shows WARN, ERROR
PRINT_LEVEL=2 px4-log-tool --verbose subcommands #shows INFO, WARN, ERROR
Data Conversion and Pre-Processing
filter.yaml
This file is necessary for most operations with the CLI tool. This is populated with pertinent information
You can generate a default filter.yaml file in your current working directory by running:
px4-log-tool generate-filter-template
.ulog -> .csv
Contains two lists for whitelist_messages and blacklist headers.
Add uorb/ros2 topics of interest into the whitelist_messages list.
Add headers that are redundant or not required in the blacklist_headers list.
resample_params contains parameters for resampling the data after it is merged. More on this is explained in Resampling Functionality. Provide
the target sampling frequency in Hertz at target_frequency_hz.
For the other parameters, refer to the following documentation links of the pandas library:
.csv -> .db3
Under bag_params contains two parameters topic_prefix and captitalise_topics.
topic_prefix: Namespace/prefix for thepx4_msgsROS 2 topics. Defaults to/fmu/outtopic_max_frequency_hz: The maximum frequency of topics of ROS 2 bags when converting from.ulog. Defaults to 100Hz.capitalise_topics: Depending on the PX4-Autopilot version, the topic names are either CamelCase (capitalise_topics: True) or snake_case (capitalise_topics: False). Defaults toFalse.
Metadata Generation (Only for .ulog files)
The field metadata_fields should be populated with the list of metadata properties to be extracted from the .ulog files.
These fields can be expanded upon through Feature Requests on "Issues". As of now, the possible metadata properties are:
- "max_altitude"
- "min_altitude"
- "average_altitude"
- "max_speed"
- "min_speed"
- "average_speed"
- "yaw_lock"
Example
whitelist_messages:
- sensor_combined
- vehicle_attitude
- ... (other message names. If this list is empty it will convert all messages)
blacklist_headers:
- timestamp
- ... (other field names)
resample_params:
target_frequency_hz: 10
num_method: "mean"
cat_method: "ffill"
interpolate_numerical: True
interpolate_method: "linear"
metadata_fields:
- "max_altitude"
- "min_altitude"
- "average_altitude"
- "max_speed"
- "min_speed"
- "average_speed"
- "yaw_lock"
bag_params:
topic_prefix: "/fmu/out"
topic_max_frequency_hz: 100
capitalise_topics: False
Convert .ulog to .csv: ulog2csv
Convert a provided directory containing .ulog files into .csv. The directory can be ordered in any way, and can contain subdirectories as well.
px4-log-tool ulog2csv DIRECTORY_ADDRESS -f FILTER [-o OUTPUT_DIRECTORY -m -r -c]
Documentation for usage of this command can be obtained through the -h or --help flag:
px4-log-tool ulog2csv --help
Generate metadata.json for .ulog files: generate-metadata
Generate metadata.json for .ulog files in DIRECTORY_ADDRESS with metadata fields in FILTER. This operation is in place, so the .json files will be added into the provided directory.
px4-log-tool generate-metadata DIRECTORY_ADDRESS -f FILTER
Convert .csv to .db3: csv2db3
[!IMPORTANT] Need to have ROS 2 framework and the
px4_msgsROS 2 packages installed and sourced.
Convert a provided directory containing folders of .csv files into ROS 2 bag files in the .db3 format. It is important the the final directory containing .csv files are formatted correctly. Best is to use the ulog2csv first and target the output.
Operation can be in-place or the bag files can be generated into a specified directory.
px4-log-tool csv2db3 DIRECTORY_ADDRESS -f FILTER [-o OUTPUT_DIRECTORY]
Documentation for usage of this command can be obtained through the -h or --help flag:
px4-log-tool csv2db3 --help
Convert .ulog to .db3: ulog2db3
[!IMPORTANT] Need to have ROS 2 framework and the
px4_msgsROS 2 packages installed and sourced.
Convert a provided directory containing folders of .ulog files into ROS 2 bag files in the .db3 format. This will also perform topic adjustment. For instance, it will reduce the rate of the topics from the .ulog file to 100Hz before converting to .db3 ROS 2 bags. This can be changed by modifying the topic_max_frequency_hz, parameter in the filter.yaml file provided when running the CLI tool.
This operation will create a mirror output folder of .csv files with the corresponding .db3 bag files inside them.
px4-log-tool ulog2db3 DIRECTORY_ADDRESS -f FILTER [-o OUTPUT_DIRECTORY]
Documentation for usage of this command can be obtained through the -h or --help flag:
px4-log-tool ulog2db3 --help
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file px4_log_tool-0.6.5.tar.gz.
File metadata
- Download URL: px4_log_tool-0.6.5.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cdcb790ccb10bf843675908640deee27b3f973a5cd7c891d219950b38611959
|
|
| MD5 |
5f7265a77c708e640ef2371d60be4dd4
|
|
| BLAKE2b-256 |
a2916d3854b52cb8d7117c128f6e8e58e8d2274852ffc7a2781bbc350dd7bbf3
|
Provenance
The following attestation bundles were made for px4_log_tool-0.6.5.tar.gz:
Publisher:
python-publish.yml on tiiuae/px4-log-tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
px4_log_tool-0.6.5.tar.gz -
Subject digest:
8cdcb790ccb10bf843675908640deee27b3f973a5cd7c891d219950b38611959 - Sigstore transparency entry: 981130757
- Sigstore integration time:
-
Permalink:
tiiuae/px4-log-tool@0d02a23c1d8f220a59bbddc8fff8ec019b48d71e -
Branch / Tag:
refs/tags/v0.6.5 - Owner: https://github.com/tiiuae
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0d02a23c1d8f220a59bbddc8fff8ec019b48d71e -
Trigger Event:
release
-
Statement type:
File details
Details for the file px4_log_tool-0.6.5-py3-none-any.whl.
File metadata
- Download URL: px4_log_tool-0.6.5-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd11c45692670d56a3aa59c9a95196c80240b282aa79e47734327937a70cb742
|
|
| MD5 |
ce11227963a9ce3fb0c6c53159c28386
|
|
| BLAKE2b-256 |
8d95d432abf77bbbe61ffed593d450fa3cedadb5072ebc0c9fbf52b674266a96
|
Provenance
The following attestation bundles were made for px4_log_tool-0.6.5-py3-none-any.whl:
Publisher:
python-publish.yml on tiiuae/px4-log-tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
px4_log_tool-0.6.5-py3-none-any.whl -
Subject digest:
fd11c45692670d56a3aa59c9a95196c80240b282aa79e47734327937a70cb742 - Sigstore transparency entry: 981130823
- Sigstore integration time:
-
Permalink:
tiiuae/px4-log-tool@0d02a23c1d8f220a59bbddc8fff8ec019b48d71e -
Branch / Tag:
refs/tags/v0.6.5 - Owner: https://github.com/tiiuae
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0d02a23c1d8f220a59bbddc8fff8ec019b48d71e -
Trigger Event:
release
-
Statement type: