Skip to main content

Module rpc

Module rpc 

Source
Expand description

Requests and replies over DDS (DDS-RPC 1.0): a Requester sends requests on a request topic and gets the replies to them on a reply topic; a Replier takes the requests and answers each one.

A reply names the request it answers with its related sample identity (PID_RELATED_SAMPLE_IDENTITY, sent in-line, DDS-RPC 1.0, 7.8.2): the writer and sequence number of the request, as in the Enhanced Service Mapping (7.4.3), so the request and reply types are the user’s own, with no header. The topics are <service>_Request and <service>_Reply (7.4.1), or names given in RpcConfig.

A request also names, as its related sample identity, the requester’s reply reader (with SEQUENCENUMBER_UNKNOWN), and a replier answers a request that names one with that reader and the request’s sequence number: ROS 2’s rmw_fastrtps_cpp does both (seen in captures), so its clients and services work with these. Others ignore the identity of a request (7.8.2 gives it to replies).

Each side announces its writer and reader as a pair through discovery, with PID_RELATED_ENTITY_GUID (7.6.2.1), and holds back what would go astray while the other side’s pair is half discovered (7.6.2.2): a Replier does not hand out the requests of a requester until it has matched that requester’s reply reader, and Requester::wait_for_service waits for a replier both of whose endpoints are matched. A remote endpoint that does not announce a related entity is paired with those of the same participant.

ROS 2’s rmw_cyclonedds_cpp puts a header in the payload instead, between the encapsulation and the body (seen in captures): the client’s 8-octet id and a 64-bit sequence number of its own, in the byte order of the encapsulation, which the service sends back at the head of the reply. With the endpoints of a participant of Cyclone DDS (vendor 0x0110), a Requester and a Replier write and read that header. Its services answer only a client whose reply reader they have matched, known by clientid= ...; in the USER_DATA of the client’s writer and reader, which a Requester announces.

A Replier sends each reply only to the reply reader of the requester that asked, when it knows which (the reader the request names, or the one paired with the request’s writer): the others are sent a GAP for it, so that a requester does not get the replies to the others (7.2.1).

The topics may have aliases (PID_TOPIC_ALIASES, 7.4.3), set in RpcConfig: an endpoint matches those of a topic named by an alias of its own or whose alias is its topic, as a service of a derived interface does with the clients of its bases.

Requester::basic and Replier::basic make them for the Basic Service Mapping (7.5.1.1), whose request and reply types start with a RequestHeader and a ReplyHeader (BasicRequest, BasicReply): the requester writes the identity of each request in its header, the replier copies it to the reply’s, and the requester reads it there. The requester reads the replies through a content filtered topic that passes only those to its requests (7.2.1).

Re-exports§

pub use idl::dds::rpc::RemoteExceptionCodeT as RemoteExceptionCode;
pub use idl::dds::rpc::ReplyHeader;
pub use idl::dds::rpc::RequestHeader;

Modules§

idl
The common types of the Basic Service Mapping (DDS-RPC 1.0, 7.5.1.1.1), as rustorb-idl -brust -Wbdds_only -Wbxtypes writes them from DdsRpc.idl: the modules dds and dds::rpc. Generated code refers to them with -Wbextern=dds=::rustorb_dds::rpc::idl::dds.

Structs§

Replier
The service side: takes requests of type Req and answers each with replies of type Rep (DDS-RPC 1.0, 7.8.1).
Request
A request taken by a Replier.
Requester
The client side of a service: sends requests of type Req and gets the replies of type Rep to them (DDS-RPC 1.0, 7.8.1).
RpcConfig
How a Requester or Replier is made.

Enums§

RpcError
Why a call of the function-call style failed (DDS-RPC 1.0, 7.5.2, 7.11.1.3): an exception the operation raises (E), a remote exception code the service sent, or a local error.

Constants§

GENERATED_CODE_VERSION_1
What the code of the DDS services that rustorb-idl -brust -Wbdds_only writes needs (the function-call style of DDS-RPC 1.0): generated code refers to it and does not compile against a runtime without it.

Traits§

BasicReply
A reply type of the Basic Service Mapping: a struct with a member header of type ReplyHeader (DDS-RPC 1.0, 7.3.1.4, 7.5.1.1.7).
BasicRequest
A request type of the Basic Service Mapping: a struct with a member header of type RequestHeader (DDS-RPC 1.0, 7.3.1.4, 7.5.1.1.6).