{"id":16618233,"url":"https://github.com/RosLibRust/roslibrust","last_synced_at":"2025-03-31T03:30:33.480Z","repository":{"id":37517033,"uuid":"352671601","full_name":"RosLibRust/roslibrust","owner":"RosLibRust","description":"An async first rust client for ROS supporting multiple backends: ROS1, rosbridge, and Zenoh.","archived":false,"fork":false,"pushed_at":"2025-03-27T17:36:29.000Z","size":1730,"stargazers_count":68,"open_issues_count":19,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T07:03:51.572Z","etag":null,"topics":["ros","ros2","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/roslibrust","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RosLibRust.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-29T14:24:55.000Z","updated_at":"2025-03-27T17:36:23.000Z","dependencies_parsed_at":"2023-01-30T17:15:25.743Z","dependency_job_id":"2d868578-475a-4512-9500-10b221871d6d","html_url":"https://github.com/RosLibRust/roslibrust","commit_stats":{"total_commits":279,"total_committers":9,"mean_commits":31.0,"dds":0.6379928315412187,"last_synced_commit":"b4376106284efd5801e357bcaaff81884406d0fd"},"previous_names":["carter12s/roslibrust"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RosLibRust%2Froslibrust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RosLibRust%2Froslibrust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RosLibRust%2Froslibrust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RosLibRust%2Froslibrust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RosLibRust","download_url":"https://codeload.github.com/RosLibRust/roslibrust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246254146,"owners_count":20747949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ros","ros2","rust"],"created_at":"2024-10-12T02:19:21.349Z","updated_at":"2025-03-31T03:30:33.474Z","avatar_url":"https://github.com/RosLibRust.png","language":"Rust","funding_links":[],"categories":["ROS"],"sub_categories":[],"readme":"# RosLibRust\n\n[![Noetic](https://github.com/roslibrust/roslibrust/actions/workflows/noetic.yml/badge.svg)](https://github.com/roslibrust/roslibrust/actions/workflows/noetic.yml)\n[![Galactic](https://github.com/roslibrust/roslibrust/actions/workflows/galactic.yml/badge.svg)](https://github.com/roslibrust/roslibrust/actions/workflows/galactic.yml)\n[![Humble](https://github.com/roslibrust/roslibrust/actions/workflows/humble.yml/badge.svg)](https://github.com/roslibrust/roslibrust/actions/workflows/humble.yml)\n[![Iron](https://github.com/roslibrust/roslibrust/actions/workflows/iron.yml/badge.svg)](https://github.com/roslibrust/roslibrust/actions/workflows/iron.yml)\n[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis crate provides a convenient \"async first\" library for interacting with ROS.\nThis crate defines generic traits for interacting with ROS-like systems, and implementations of those traits for various backends.\n\nThis crate is **pure rust and requires no ROS1 or ROS2 dependencies or installation**.\n\nThis allows writing generic behaviors like:\n\n```no_run\n# use roslibrust_test::ros1::*;\nuse roslibrust::{TopicProvider, Publish, Subscribe};\n\nasync fn relay\u003cT: TopicProvider\u003e(ros: T) -\u003e roslibrust::Result\u003c()\u003e {\n    let mut subscriber = ros.subscribe::\u003cstd_msgs::String\u003e(\"in\").await?;\n    let mut publisher = ros.advertise::\u003cstd_msgs::String\u003e(\"out\").await?;\n    while let Ok(msg) = subscriber.next().await {\n        println!(\"Got message: {}\", msg.data);\n        publisher.publish(\u0026msg).await?;\n    }\n    Ok(())\n}\n\n#[tokio::main]\nasync fn main() -\u003e roslibrust::Result\u003c()\u003e {\n    // Relay messages over a rosbridge connection with either ROS1 or ROS2!\n    #[cfg(feature = \"rosbridge\")]\n    {\n    let ros = roslibrust::rosbridge::ClientHandle::new(\"ws://localhost:9090\").await?;\n    relay(ros).await?;\n    }\n\n    // Relay messages over a native ROS1 connection\n    #[cfg(feature = \"ros1\")]\n    {\n    let ros = roslibrust::ros1::NodeHandle::new(\"http://localhost:11311\", \"relay\").await?;\n    relay(ros).await?;\n    }\n\n    // Relay messages over a mock ROS connection for testing\n    #[cfg(feature = \"mock\")]\n    {\n    let ros = roslibrust::mock::MockRos::new();\n    relay(ros).await?;\n    }\n\n    // Relay messages over a zenoh connection compatible with zenoh-ros1-plugin / zenoh-ros1-bridge\n    #[cfg(feature = \"zenoh\")]\n    {\n    let ros = roslibrust::zenoh::ZenohClient::new(zenoh::open(zenoh::Config::default()).await.unwrap());\n    relay(ros).await?;\n    }\n\n    // TODO - not supported yet!\n    // Relay messages over a native ROS2 connection\n    // let ros = roslibrust::ros2::NodeHandle::new(\"http://localhost:11311\", \"relay\").await?;\n    // relay(ros).await?;\n    Ok(())\n}\n```\n\nAll 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\n`roslibrust_codegen_macro` provides a convenient macro for generating these types:\n\n```no_compile\n// Will generate types from all packages in ROS_PACKAGE_PATH \nroslibrust_codegen_macro::find_and_generate_ros_messages!();\n```\n\nIf you want to see what the generated code looks like check [here](https://github.com/RosLibRust/roslibrust/blob/master/roslibrust_test/src/ros1.rs).\nWhile the macro is useful for getting started, we recommend using `roslibrust_codegen` with a `build.rs` as shown in [example_package](https://github.com/RosLibRust/roslibrust/tree/master/example_package).\nThis allows cargo to know when message files are edited and automatically re-generate the code.\n\n## Getting Started / Examples\n\nExamples can be found in [examples](https://github.com/RosLibRust/roslibrust/tree/master/roslibrust/examples).\nWe recommend looking at the examples prefixed with `generic_` first, these examples show the recommended style of using `roslibrust` through the generic traits.\nCode written this way can be used with any backend, and critically can be tested with the mock backend.\n\nExamples prefixed with `ros1_`, `rosbridge_`, and `zenoh_` show direct use of specific backends if you are only interested in a single backend.\nSome backends may provide additional functionality not available through the generic traits.\n\nTo get started with writing a node with `roslibrust` we recommend looking at [example_package](https://github.com/RosLibRust/roslibrust/tree/master/example_package) and setting up your\n`Cargo.toml` and `build.rs` in a similar way.\nSome important tips to keep in mind with using the crate:\n\n* This crate is built around the [tokio runtime](https://docs.rs/tokio/latest/tokio/) and requires tokio to work. All backends expect to be created inside a tokio runtime.\n* The generic traits `TopicProvider` and `ServiceProvider` are not [object safe](https://doc.rust-lang.org/reference/items/traits.html#object-safety) due to their generic parameters. This means you cannot use them as trait objects with `Box\u003cdyn TopicProvider\u003e` or `Box\u003cdyn ServiceProvider\u003e`. Instead, they should be used as compile time generics like `fn foo(ros: impl TopicProvider)` or `struct MyNode\u003cT: TopicProvider\u003e { ros: T }`.\n* By default the roslibrust crate does not include any backends. You must enable the specific backends you want to use with features in `Cargo.toml` like `roslibrust = { version = \"0.12\", features = [\"ros1\"] }`.\n\n## Contributing\n\nContribution 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.\n\nWe uphold the rust lang [Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct).\n\n### Minimum Supported Rust Version / MSRV\n\nMSRV is currently set to 1.75 to enable `async fn` in traits.\n\nWe are likely to increase the MSRV to 1.83 when support for `async closures` lands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRosLibRust%2Froslibrust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRosLibRust%2Froslibrust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRosLibRust%2Froslibrust/lists"}