Skip to main content

Crate rustorb_dds_ros2

Crate rustorb_dds_ros2 

Source
Expand description

The conventions of ROS 2 on DDS, for rustorb-dds: what a DDS program needs to be seen by ROS 2 (Jazzy) as ROS 2 nodes, and to talk with them with types known only at run time.

  • names: ROS 2 names (topics, services, nodes, namespaces) checked and expanded, and their DDS names: rt/, rq/...Request, rr/...Reply, pkg::msg::dds_::Name_.
  • msg: the .msg and .srv files parsed.
  • TypeLibrary: interface types found on a search path (and AMENT_PREFIX_PATH), as MessageType and ServiceType: the fields, the DDS type as a DynamicType, the description and the RIHS01 type hash of REP-2011 (type_description).
  • Value: messages as trees of named fields, to and from DynamicData, checked against their types.
  • QosProfile: the ROS 2 QoS profiles by name.
  • UserData: the key=value; entries ROS 2 puts in USER_DATA (typehash=RIHS01_...;).
  • RosParticipant and Node: nodes announced on ros_discovery_info, with publishers and subscriptions whose USER_DATA has the type hash; and the writer of a received sample (RosParticipant::writer_of).

ROS 2 is used as a black box: what it puts on DDS, seen with its tools and in captures, and its documented conventions (REP-2011, the design articles). No ROS 2 code is used or needed; the .msg files are read where they are installed.

use rustorb_dds_ros2::{QosProfile, RosParticipant, TypeLibrary, UserData, Value};

let types = TypeLibrary::with_dirs(["msgs"]);
let string = types.message("std_msgs/msg/String")?;
let ros = RosParticipant::new(0)?;
let node = ros.create_node("/", "talker")?;
let publisher =
    node.create_publisher("chatter", &string, &QosProfile::DEFAULT, &UserData::new())?;
publisher.publish(&Value::Struct(vec![(
    "data".into(),
    Value::String("Hello World".into()),
)]))?;

Re-exports§

pub use library::MessageType;
pub use library::ServiceType;
pub use library::TypeLibrary;
pub use node::Node;
pub use node::RosParticipant;
pub use node::RosPublisher;
pub use node::RosSubscription;
pub use qos::QosProfile;
pub use type_description::TypeHash;
pub use user_data::UserData;
pub use value::Value;

Modules§

library
ROS 2 interface types found in .msg and .srv files, with their DDS types (DynamicType), descriptions and RIHS01 hashes.
msg
The ROS 2 interface definition languages .msg and .srv, parsed.
names
ROS 2 names and their DDS names.
node
ROS 2 nodes on a DDS participant, announced on ros_discovery_info.
qos
The QoS profiles of ROS 2 by name, as DDS QoS.
type_description
The description of a type that ROS 2 hashes (REP-2011, “Evolving Message Types”), and its hash RIHS01_<sha256>.
user_data
The USER_DATA of ROS 2 participants, writers and readers: entries key=value;, one after the other.
value
Values of ROS 2 messages as a tree of named fields, to and from DynamicData.

Enums§

Error
Errors of this crate.

Type Aliases§

Result
The result type of this crate.