Skip to content

Software

roslibrust

By RosLibRust, from github.com/RosLibRust/roslibrust (opens in a new tab)

  • Middleware
  • Library
  • MIT

An async Rust library for talking to ROS1 and ROS2 systems, built on Tokio, with one trait-based API that works across several transport backends.

Facts

GitHub stars
142read on 29 Nov 2026
Last update
25 Sept 2026Newest commit on master
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate

Checked on GitHub on 29 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit a798361 (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

At a glance

What it is
  • Provides a single trait-based API so the same behaviour code can run over any supported backend, chosen at compile time.
  • Supports native ROS2 via rmw_zenoh, native ROS1 via TCPROS, zenoh, rosbridge_server, and a mock backend for testing.
  • Requires no ROS1 or ROS2 installation; message types are generated in pure Rust from .msg and .srv files.
  • Roslibrust_codegen and roslibrust_codegen_macro generate Rust message types, usable from a build.rs or a macro.
  • Minimum supported Rust version is 1.90.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's website (opens in a new tab)
Maintenance
Active, last commit on 25 Sept 2026.

Use it

How to install it, in the creator's words: The project's website (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit a798361

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by RosLibRust, at commit a798361, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

RosLibRust

(opens in a new tab) (opens in a new tab) (opens in a new tab)

Documentation about the crate is on docs.rs (opens in a new tab), extended guides can be found on roslibrust.github.io (opens in a new tab)

An async rust library for interfacing with ROS1 and ROS2, built on Tokio.

Image: roslibrust backend architecture (opens in a new tab)

  • One Trait Based API - Write your behavior once and use it with any backend! Select the backend you want to use at compile time.
  • Pure Rust - No ROS1 or ROS2 dependencies or installation required! Compile time message generation from .msg/.srv files.

This allows writing generic behaviors like:

use roslibrust_test::ros1::*; // Provides std_msgs::String
use roslibrust::{TopicProvider, Publish, Subscribe};

async fn relay<T: TopicProvider>(ros: T) -> roslibrust::Result<()> {
    let mut subscriber = ros.subscribe::<std_msgs::String>("/in").await?;
    let mut publisher = ros.advertise::<std_msgs::String>("/out").await?;
    while let Ok(msg) = subscriber.next().await {
        println!("Got message: {}", msg.data);
        publisher.publish(&msg).await?;
    }
    Ok(())
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    // Relay messages over a native ROS 2 Kilted-or-newer connection using rmw_zenoh.
    #[cfg(feature = "hiroz")]
    {
        use roslibrust::hiroz::Builder;
        let ctx = roslibrust::hiroz::context::ZContextBuilder::default()
            .with_domain_id(0)
            .with_connect_endpoints(["tcp/127.0.0.1:7447"])
            .build()?;
        let ros = roslibrust::hiroz::ZenohClient::new(&ctx, "relay").await?;
        relay(ros).await?;
    }

    // Relay messages over a native ROS1 connection via TCPROS
    #[cfg(feature = "ros1")]
    {
    let ros = roslibrust::ros1::NodeHandle::new("http://localhost:11311", "relay").await?;
    relay(ros).await?;
    }

    // Relay messages over a zenoh connection compatible with zenoh-ros1-plugin / zenoh-ros1-bridge
    #[cfg(feature = "zenoh")]
    {
    let ros = roslibrust::zenoh::ZenohClient::new(
        roslibrust::zenoh::open(roslibrust::zenoh::Config::default())
            .await
            .unwrap(),
    );
    relay(ros).await?;
    }

    // Relay messages over a rosbridge_server connection with either ROS1 or ROS2!
    #[cfg(feature = "rosbridge")]
    {
    let ros = roslibrust::rosbridge::ClientHandle::new("ws://localhost:9090").await?;
    relay(ros).await?;
    }

    // Relay messages over a mock ROS connection for testing
    #[cfg(feature = "mock")]
    {
    let ros = roslibrust::mock::MockRos::new();
    relay(ros).await?;
    }

    Ok(())
}

All of this is backed by common traits for ROS messages, topics, and services. roslibrust_codegen provides generation of Rust types from both ROS1 and ROS2 .msg/.srv files and roslibrust_codegen_macro provides a convenient macro for generating these types:

// Will generate types from all packages in ROS_PACKAGE_PATH, AMENT_PREFIX_PATH, and COLCON_PREFIX_PATH
roslibrust_codegen_macro::generate_ros_types_with_env!();

If you want to see what the generated code looks like checkout our generated messages in our test crate (opens in a new tab). While the macro is useful for getting started, we recommend using roslibrust_codegen with a build.rs as shown in example_package (opens in a new tab). This allows cargo to know when message files are edited and automatically re-generate the code.

Getting Started / Examples
Contributing

Contribution through reporting of issues encountered and implementation in PRs is welcome! Before landing a large PR with lots of code implemented, please open an issue if there isn't a relevant one already available and chat with a maintainer to make sure the design fits well with all supported platforms and any in-progress implementation efforts.

We uphold the rust lang Code of Conduct (opens in a new tab).

Minimum Supported Rust Version / MSRV

MSRV is currently 1.90.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.