| Crates.io | ros2-interfaces-rolling |
| lib.rs | ros2-interfaces-rolling |
| version | 0.0.2 |
| created_at | 2024-11-16 01:23:29.809824+00 |
| updated_at | 2024-12-20 19:46:10.250423+00 |
| description | Structs for Messages and Services listed by ROS Index for ROS2 Rolling. Built around the `ros2-client` crate. |
| homepage | https://www.make87.com |
| repository | |
| max_upload_size | |
| id | 1449801 |
| size | 1,844,488 |
This repository contains Rust structs for all interfaces (i.e., messages and services) that are listed as releases on the ROS Index for Rolling.
The interfaces implement traits from the ros2-client library and can be used easily in conjunction.
Every package is a separate feature for this crate, so you can cherry-pick the interfaces you need.
Example are std_msgs, geometry_msgs and nav2_msgs.
Add this crate to your Cargo.toml:
[dependencies]
ros2-interfaces-rolling = { version = "*", features = ["std_msgs"] } # replace with the latest version and features you need
Then you can use the interfaces in your code:
use ros2_client::{Context, MessageTypeName, Name, NodeName, NodeOptions};
use ros2_interfaces_rolling::std_msgs;
fn test_publisher() {
let context = Context::new().unwrap();
let mut node = context
.new_node(
NodeName::new("/rustdds", "rustdds_listener").unwrap(),
NodeOptions::new().enable_rosout(true),
)
.unwrap();
let topic = node
.create_topic(
&Name::new("/","topic").unwrap(),
MessageTypeName::new("std_msgs", "String"),
&ros2_client::DEFAULT_PUBLISHER_QOS,
)
.unwrap();
let publisher = node
.create_publisher::<std_msgs::msg::String>(&topic, None)
.unwrap();
let message = std_msgs::msg::String {
data: "Hello, world!".to_string(),
};
publisher.publish(message).unwrap();
}
The following packages (and thereby: features) do not compile due to incompatible or missing interface definitions:
mrpt_msgsmrpt_nav_interfacesrosbag2_test_msgdefsTherefore, the features have been commented out in the Cargo.toml file.