RMW desert 1.0
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
Discovery Namespace Reference

Namespace containing discovery functions. More...

Typedefs

using DemangleFunction = std::string(*)(const std::string &)
 

Functions

char * integer_to_string (int x)
 
std::string resolve_prefix (const std::string &name, const std::string &prefix)
 Resolve a prefix.
 
std::string demangle_publisher_from_topic (const std::string &topic_name)
 Demangle a publisher.
 
std::string demangle_subscriber_from_topic (const std::string &topic_name)
 Demangle a subscriber.
 
std::string demangle_topic (const std::string &topic_name)
 Demangle a topic.
 
std::string demangle_service_request_from_topic (const std::string &topic_name)
 Demangle a service request.
 
std::string demangle_service_reply_from_topic (const std::string &topic_name)
 Demangle a service reply.
 
std::string demangle_service_from_topic (const std::string &topic_name)
 Demangle a service.
 
std::string identity_demangle (const std::string &name)
 No demangle.
 
void discovery_thread (rmw_context_impl_t *impl)
 Thread handling discovery beacons.
 
rmw_ret_t discovery_thread_start (rmw_context_impl_t *impl)
 Initialize the discovery thread.
 
void send_discovery_beacon (cbor::TxStream stream, std::string node_name, std::string node_namespace, int entity_type, rmw_gid_t entity_gid, std::string topic_name, std::string type_name, bool disconnect)
 Send a discovery beacon.
 
void send_discovery_request (cbor::TxStream stream)
 Send a discovery request.
 

Variables

const char *const ros_topic_publisher_prefix = integer_to_string(PUBLISHER_TYPE)
 
const char *const ros_topic_subscriber_prefix = integer_to_string(SUBSCRIBER_TYPE)
 
const char *const ros_service_requester_prefix = integer_to_string(CLIENT_TYPE)
 
const char *const ros_service_response_prefix = integer_to_string(SERVICE_TYPE)
 

Detailed Description

Namespace containing discovery functions.

The middleware layer of a ROS stack must implement functionalities used to inform each node of the network structure of the other nodes connected, with their names and topics. Since this operation is quite resource-consuming and the underwater channel has a limited bandwidth, it is possible to disable it.

Function Documentation

◆ demangle_publisher_from_topic()

std::string Discovery::demangle_publisher_from_topic ( const std::string &  topic_name)

Demangle a publisher.

Return the topic name for a given topic if it is part of a publisher, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ demangle_service_from_topic()

std::string Discovery::demangle_service_from_topic ( const std::string &  topic_name)

Demangle a service.

Return the service name for a given topic if it is part of a service, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ demangle_service_reply_from_topic()

std::string Discovery::demangle_service_reply_from_topic ( const std::string &  topic_name)

Demangle a service reply.

Return the service name for a given topic if it is part of a service reply, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ demangle_service_request_from_topic()

std::string Discovery::demangle_service_request_from_topic ( const std::string &  topic_name)

Demangle a service request.

Return the service name for a given topic if it is part of a service request, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ demangle_subscriber_from_topic()

std::string Discovery::demangle_subscriber_from_topic ( const std::string &  topic_name)

Demangle a subscriber.

Return the topic name for a given topic if it is part of a subscriber, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ demangle_topic()

std::string Discovery::demangle_topic ( const std::string &  topic_name)

Demangle a topic.

Return the topic name for a given topic if it is part of one, else "".

Parameters
topic_nameMangled topic name
Returns
Demangled topic name

◆ discovery_thread()

void Discovery::discovery_thread ( rmw_context_impl_t *  impl)

Thread handling discovery beacons.

This function allows the middleware to receive and process incoming discovery beacons from the other nodes.

Parameters
implThe middleware comtext implementation

◆ discovery_thread_start()

rmw_ret_t Discovery::discovery_thread_start ( rmw_context_impl_t *  impl)

Initialize the discovery thread.

This function is called during the creation of a node and starts a discovery thread.

Parameters
implThe middleware comtext implementation
Returns
Outcome of the operation

◆ identity_demangle()

std::string Discovery::identity_demangle ( const std::string &  name)

No demangle.

Used when ros names are not mangled.

Parameters
nameTopic name
Returns
Same topic name

◆ resolve_prefix()

std::string Discovery::resolve_prefix ( const std::string &  name,
const std::string &  prefix 
)

Resolve a prefix.

Returns name stripped of prefix.

Parameters
nameMangled topic name
prefixPrefix of the entity type
Returns
Demangled topic name

◆ send_discovery_beacon()

void Discovery::send_discovery_beacon ( cbor::TxStream  stream,
std::string  node_name,
std::string  node_namespace,
int  entity_type,
rmw_gid_t  entity_gid,
std::string  topic_name,
std::string  type_name,
bool  disconnect 
)

Send a discovery beacon.

This function sends a beacon in the underwater channel containing all the informations related to a specific entity of a node.

Parameters
streamThe stream used to send data
node_nameThe name of the node holding the entity
node_namespaceThe namespace of the node holding the entity
entity_typeThe type of the entity
entity_gidThe global identifier of the entity
topic_nameThe topic name
type_nameThe topic type
disconnectFlag used to determine if an entity is connecting or disconnecting

◆ send_discovery_request()

void Discovery::send_discovery_request ( cbor::TxStream  stream)

Send a discovery request.

This function sends a request in the underwater channel to all the nodes requiring them to send their discovery beacons.

Parameters
streamThe stream used to send data