4 releases
new 0.0.4 | Jan 16, 2025 |
---|---|
0.0.3 | Jan 15, 2025 |
0.0.2 | Dec 31, 2024 |
0.0.1 | Dec 31, 2024 |
#39 in Robotics
518 downloads per month
2MB
2K
SLoC
Rust ULog Parser
A robust Rust implementation of a parser for the ULog file format, commonly used in PX4 flight stack for logging system data. This parser provides a safe, efficient way to read and process ULog files with strong type checking and error handling.
Project Status
This project is currently in development, it basically works but I'll be making changes to the interface as I go.
- Parse ULog files and extract all messages
- Make a nice interface for the parser (in progress)
- Documentation
- Add cli features for the binary (right now it just gives some summary data for a sanity check)
- Add tests (Parity tests are in progress, using pyulog for comparison. The holdup is munging the data to match the format from pyulog)
- Benchmarking
Features
- Complete implementation of the ULog file format specification
- Support for all ULog message types including:
- Data messages
- Format messages
- Parameter messages
- Logged messages (both plain and tagged)
- Multi messages
- Subscription messages
- Dropout tracking
- Safe handling of nested message types
- Comprehensive error handling
- Zero-copy parsing where possible
- Support for appended data sections
Usage
Add this to your Cargo.toml
:
[dependencies]
ulog_rs = "0.0.1"
Basic Example
use std::fs::File;
use ulog_rs::ULogParser;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Open a ULog file
let file = File::open("sample.ulg")?;
// Create parser instance
let parser = ULogParser::parse_reader(file)?;
// Access header information
println!("ULog Header:");
println!(" Version: {}", parser.header().version);
println!(" Timestamp: {} μs", parser.header().timestamp);
println!(" Final Timestamp: {} μs", parser.last_timestamp());
// Access logged messages
for message in parser.logged_messages() {
println!("[{}] {}", message.timestamp, message.message);
}
Ok(())
}
Project Structure
The project is organized into several modules, each handling specific aspects of ULog parsing:
lib.rs
: Core parser implementation and type definitionsdata_message.rs
: Handles data message parsingdropout_message.rs
: Manages dropout tracking and statisticsformat_message.rs
: Processes message format definitionsinfo_message.rs
: Handles info message parsinglogged_message.rs
: Manages regular logged messagesmulti_message.rs
: Handles multi-part messagesparameter_message.rs
: Processes parameter messagessubscription_message.rs
: Manages message subscriptionstagged_logged_message.rs
: Handles tagged log messages
API Overview
Main Parser Interface
The ULog
struct provides the main interface for parsing ULog files:
use ulog_rs::ulog::ULog;
let ulog = ULog::parse_file("sample.ulg")?;
// Access header information
println!("Version: {}", ulog.version);
println!("Timestamp: {} μs", ulog.timestamp);
// Get logged messages
for message in &ulog.logged_messages() {
println!("[{}] {}", message.timestamp, message.message);
}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Dependencies
~2–13MB
~100K SLoC