Crate roslibrust_ros1

Crate roslibrust_ros1 

Source
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§

MasterClient
A client that exposes the API hosted by the rosmaster
NodeHandle
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.
ProtocolParams
Publisher
The regular Publisher representation returned by calling advertise on a crate::NodeHandle.
PublisherAny
A specialty publisher used when message type is not known at compile time.
ServiceClient
ServiceServer
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
SubscriberAny
SystemState
The complete list of publishers, subscribers, and service hosts know to the master

Enums§

NodeError
RosMasterError