Skip to content

SSL-A-Team/ssl-logtools-rs

Repository files navigation

ssl-logtools-rs

Rust library and tools for working with RoboCup Small Size League game logs.

This repo is NOT intended to replace existing league tools for working with game logs (such as ssl-logtools and ssl-go-tools). This package aims to extend the existing ecosystem with Rust-native utilties.

Tools

The following tools are provided in the sll-logtools crate in this workspace.

Using the Library

The library is available in the ssl-loglib crate in this workspace.

Adding Dependency

The easiest way to use this library in your rust project is by specifying a git dependency.

[dependencies]
ssl-loglib = { git = "https://github.com/SSL-A-Team/ssl-logtools-rs.git" }

Reading log files

The primary mechanism for reading log files with this library is the LogFileReader struct. For convenience, this struct implements the Iterator trait so you can directly loop over messages from your log file.

use ssl_loglib::MessageBody;
use ssl_loglib::log_file_reader::LogFileReader;

let reader = LogFileReader::new("path/to/log/file.log")?;
for message in reader {
    match message.body {
        MessageBody::Refbox2013(ref_data) => { /*...*/ },
        // ...
    }
}

If you are loading log data from another data source (not a file on disk), you can pass any implementation of Read to extract_next_message.

There is also a convenienve function for pulling all referee messages out of a log file.

use ssl_loglib::get_all_referee_messages;

let ref_messages = get_all_referee_messages("path/to/log/file.log")?;
// ref_messages is a Vec<LogMessage>

About

Rust library and tools for working with RoboCup Small Size League game logs.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages