Expand description
A implementation of roslibrust’s generic traits for native ROS1 communication.
This is a pure rust re-implementation of ROS1 communication via xmlrpc and TCPROS. This crate shows performance on par with roscpp.
It is recommended to not use this crate directly and instead access if via the roslibrust crate with the ros1 feature enabled.
Basic Example:
// Normally accessed as roslibrust::{Result, TopicProvider, Publish}
use roslibrust_common::{Result, TopicProvider, Publish};
// Normally you'd use generated types from roslibrust::codegen
use roslibrust_test::ros1::*;
use roslibrust_ros1::NodeHandle;
async fn my_behavior(ros: impl TopicProvider) -> Result<()> {
let publisher = ros.advertise::<std_msgs::String>("my_topic").await?;
publisher.publish(&std_msgs::String { data: "Hello, world!".to_string() }).await?;
Ok(())
}
#[tokio::main]
async fn main() -> Result<()> {
// Create a ros1 handle we can use
let ros = NodeHandle::new("http://localhost:11311", "my_node").await?;
// Use it like ros:
my_behavior(ros).await?;
Ok(())
}Structs§
- Master
Client - A client that exposes the API hosted by the rosmaster
- Node
Handle - Represents a handle to an underlying Node. NodeHandle’s can be freely cloned, moved, copied, etc. This class provides the user facing API for interacting with ROS. The last node handle dropped shuts down the node.
- Protocol
Params - Publisher
- The regular Publisher representation returned by calling advertise on a crate::NodeHandle.
- Publisher
Any - A specialty publisher used when message type is not known at compile time.
- Service
Client - Service
Server - ServiceServer is simply a lifetime control The underlying ServiceServer is kept alive while object is kept alive. Dropping this object, un-advertises the underlying service with rosmaster
- Subscriber
- Subscriber
Any - System
State - The complete list of publishers, subscribers, and service hosts know to the master