r2a

Crates.ior2a
lib.rsr2a
version0.1.7
sourcesrc
created_at2024-10-01 02:24:50.069427
updated_at2024-10-16 19:28:05.269651
descriptionA Rust library that provides a typesafe way to convert ROS 2 messages into Apache Arrow format
homepagehttps://github.com/istvan-fodor/r2a
repositoryhttps://github.com/istvan-fodor/r2a
max_upload_size
id1392407
size155,641
Istvan Fodor (istvan-fodor)

documentation

README

R2A CI Crate

R2A - A Rust library that provides a typesafe way to convert ROS 2 messages into Apache Arrow format

The library is essentially a wrapper on top of the amazing R2R library. The two main components are r2a::ArrowSupport and r2a::RowBuilder.

This build was mainly tested with ROS 2 Humble. I also tested it with Jazzy locally (by switching to the master branch r2r).

Documentation can be found on docs.rs: https://docs.rs/r2a/latest/r2a/

The crate can be found on crates.io: https://crates.io/crates/r2a

Install

  1. cargo add r2a
  2. Make sure to source your ROS 2 environment before you build your project.

Development

If you use Visual Studio Code, the r2a.code-workspace will be useful. If you are using a Mac, the Code workspace assumes that you have Robostack installed and your env is called ros_env.

Examples

use r2a::ArrowSupport;
use r2a::RowBuilder;

let fields = r2r::std_msgs::msg::Header::arrow_fields(true);
let mut row_builder = r2r::std_msgs::msg::Header::new_row_builder(fields.iter().collect()); //We keep all the fields, convert to Vec<&Field>

let my_message = r2r::std_msgs::msg::Header {
               stamp: r2r::builtin_interfaces::msg::Time {
                   sec: 0,
                   nanosec: 0,
               },
               frame_id: "test_frame".to_string(),
           };
row_builder.add_row(&my_message).unwrap();
let arrow_arrays = row_builder.to_arc_arrays();
// store arrow_arrays as Parquet, etc..

For more elaborate examples see the examples folder.

Changelog

[0.1.7] - 2024-10-13

Commit count: 23

cargo fmt