Skip to content

Commit

Permalink
fix: fixed spelling, bumped release
Browse files Browse the repository at this point in the history
  • Loading branch information
istvan-fodor committed Oct 1, 2024
1 parent 4c1aed5 commit d86f7f0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "r2a"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
description = "A Rust library that provides a typesafe way to convert ROS2 messages into Apache Arrow format"
description = "A Rust library that provides a typesafe way to convert ROS 2 messages into Apache Arrow format"
homepage = "https://github.com/istvan-fodor/r2a"
repository = "https://github.com/istvan-fodor/r2a"
license = "Apache-2.0"
readme = "README.md"
keywords = ["ROS", "ROS2", "Humble", "Jazzy", "Arrow"]
keywords = ["ROS", "ROS 2", "Humble", "Jazzy", "Arrow"]

[features]
doc-only = []
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
R2A - A Rust library that provides a typesafe way to convert ROS2 messages into Apache Arrow format
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](https://github.com/sequenceplanner/r2r/) library. The two main components are `r2a::ArrowSupport` and `r2a::RowBuilder`.

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

## Install

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

## Examples

Expand Down
10 changes: 5 additions & 5 deletions examples/pubsub_and_parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ use std::sync::{Arc, Mutex};
use tokio::task;

/// This example demonstrates the use of the `r2a::ArrowSupport` and `r2a::RowBuilder`
/// structs to handle ROS2 messages and convert them to Apache Arrow format
/// structs to handle ROS 2 messages and convert them to Apache Arrow format
/// for columnar data storage. The `RowBuilder` provides an easy-to-use interface
/// to batch ROS2 LaserScan messages and transform them into Arrow-compatible arrays,
/// to batch ROS 2 LaserScan messages and transform them into Arrow-compatible arrays,
/// which are then written to Parquet files. The `ArrowSupport` trait simplifies the process
/// of defining Arrow schemas for ROS2 message types.
/// of defining Arrow schemas for ROS 2 message types.
///
/// In this example, the subscriber receives LaserScan messages, batches them in groups of 10,
/// and saves each batch to a Parquet file, showcasing how to integrate ROS2 data streams
/// and saves each batch to a Parquet file, showcasing how to integrate ROS 2 data streams
/// with the Arrow ecosystem for scalable data processing.
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<()> {
Expand All @@ -38,7 +38,7 @@ async fn main() -> Result<()> {
let mut i = 1;
loop {
{
// Spin the ROS2 node for processing subscriptions and publications.
// Spin the ROS 2 node for processing subscriptions and publications.
an_spin
.lock()
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
// specific language governing permissions and limitations
// under the License.

//! # R2A: Arrow bindings to ROS2
//! # R2A: Arrow bindings to ROS 2
//!
//! This library provides utilities for mapping ROS messages to Arrow arrays. It heavily relies
//! on the [r2r](https://github.com/sequenceplanner/r2r) library. Much like how `r2r` works,
//! `r2a` RowBuilder and ArrowSupport implementations are automatically generated during build
//! time and includes in the compilation. Before build, you must source your ROS2 environment.
//! time and includes in the compilation. Before build, you must source your ROS 2 environment.
//!
//!
//! ## Features
Expand Down
34 changes: 17 additions & 17 deletions src/ros_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use arrow_array::builder::ArrayBuilder;
use arrow_array::Array;
use std::sync::Arc;

/// The `RowBuilder` trait is implemented for each ROS2 message type by a code generator.
/// The `RowBuilder` trait is implemented for each ROS 2 message type by a code generator.
/// It serves as an accumulator that collects records and converts them into a collection
/// of Arrow arrays. This trait is responsible for managing how records are added and stored
/// and how they are converted into Arrow-compatible data structures.
///
/// # Type Parameters
///
/// - `'a`: The lifetime of the references to the message and fields.
/// - `T`: The specific ROS2 message type that the row builder will accumulate.
/// - `T`: The specific ROS 2 message type that the row builder will accumulate.
///
/// # Example
///
Expand All @@ -33,7 +33,7 @@ use std::sync::Arc;
/// let arrow_arrays = row_builder.to_arc_arrays();
/// ```
pub trait RowBuilder<'a, T> {
/// Adds a ROS2 message of type `T` to the row builder.
/// Adds a ROS 2 message of type `T` to the row builder.
///
/// This method takes a reference to the message, processes it, and stores the data
/// internally in Arrow array builders that can later be converted to Arrow arrays.
Expand Down Expand Up @@ -73,18 +73,18 @@ pub trait RowBuilder<'a, T> {
fn to_arc_arrays(&mut self) -> Vec<Arc<dyn Array>>;
}

/// The `ArrowSupport` trait is implemented for each ROS2 message type, allowing the creation of
/// The `ArrowSupport` trait is implemented for each ROS 2 message type, allowing the creation of
/// row builders, Arrow schemas, and field definitions for that message type.
///
/// # Associated Types
///
/// - `RowBuilderType`: The type of row builder that will be used to accumulate data for the
/// implementing ROS2 message type.
/// implementing ROS 2 message type.
///
/// # Example
///
/// ```
/// // Assuming a type `MyRos2Message` implements `ArrowSupport`.
/// // Assuming a type `MyROS 2Message` implements `ArrowSupport`.
/// use r2a::ArrowSupport;
///
/// let arrow_fields = r2r::std_msgs::msg::Header::arrow_fields();
Expand All @@ -99,30 +99,30 @@ pub trait RowBuilder<'a, T> {
///
/// ```
pub trait ArrowSupport<'a> {
/// The type of row builder that this ROS2 message type will use to accumulate rows.
/// This type is specific to the ROS2 message type that implements the `ArrowSupport` trait.
/// The type of row builder that this ROS 2 message type will use to accumulate rows.
/// This type is specific to the ROS 2 message type that implements the `ArrowSupport` trait.
type RowBuilderType;

/// Creates a new row builder for the given ROS2 message type.
/// Creates a new row builder for the given ROS 2 message type.
///
/// This method creates a row builder using the provided Arrow field definitions. The row
/// builder is then used to accumulate data for conversion to Arrow arrays.
///
/// # Arguments
///
/// * `arrow_fields` - A vector of references to Arrow field definitions that specify the
/// structure of the data for this ROS2 message type. This has to be a subset of fields
/// structure of the data for this ROS 2 message type. This has to be a subset of fields
/// returned by the `arrow_fields` method.
///
/// # Returns
///
/// A row builder of type `RowBuilderType`, which can be used to accumulate rows for the
/// implementing ROS2 message type.
/// implementing ROS 2 message type.
fn new_row_builder(arrow_fields: Vec<&'a arrow_schema::Field>) -> Self::RowBuilderType;

/// Returns the Arrow field definitions for this ROS2 message type.
/// Returns the Arrow field definitions for this ROS 2 message type.
///
/// This method returns the Arrow field definitions that describe the structure of the ROS2
/// This method returns the Arrow field definitions that describe the structure of the ROS 2
/// message type, including an optional field that containse the whole message as an Arrow Struct.
///
/// # Arguments
Expand All @@ -131,13 +131,13 @@ pub trait ArrowSupport<'a> {
///
/// # Returns
///
/// A vector of Arrow field definitions (`arrow_schema::Field`) for the implementing ROS2
/// A vector of Arrow field definitions (`arrow_schema::Field`) for the implementing ROS 2
/// message type.
fn arrow_fields() -> Vec<arrow_schema::Field>;

/// Returns the Arrow schema for this ROS2 message type.
/// Returns the Arrow schema for this ROS 2 message type.
///
/// This method generates the complete Arrow schema for the ROS2 message type, which can be
/// This method generates the complete Arrow schema for the ROS 2 message type, which can be
/// used when creating Arrow arrays or converting the data to other formats like Parquet.
///
///
Expand All @@ -148,7 +148,7 @@ pub trait ArrowSupport<'a> {
///
/// # Returns
///
/// An Arrow schema (`arrow_schema::Schema`) that represents the full structure of the ROS2
/// An Arrow schema (`arrow_schema::Schema`) that represents the full structure of the ROS 2
/// message type.
fn arrow_schema() -> arrow_schema::Schema;
}
Expand Down

0 comments on commit d86f7f0

Please sign in to comment.