ROS 2 rclcpp + rcl - kilted  kilted
ROS 2 C++ Client Library with ROS Client Library
Functions
discovery_options.h File Reference
#include "rcl/types.h"
#include "rcl/visibility_control.h"
#include "rcutils/allocator.h"
#include "rmw/discovery_options.h"
Include dependency graph for discovery_options.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

RCL_PUBLIC rcl_ret_t rcl_get_automatic_discovery_range (rmw_discovery_options_t *discovery_options)
 Determine how the user wishes to discover other ROS nodes automatically. More...
 
RCL_PUBLIC const char * rcl_automatic_discovery_range_to_string (rmw_automatic_discovery_range_t automatic_discovery_range)
 Convert the automatic discovery range value to a string for easy printing. More...
 
RCL_PUBLIC rcl_ret_t rcl_get_discovery_static_peers (rmw_discovery_options_t *discovery_options, rcutils_allocator_t *allocator)
 Determine how the user wishes to discover other ROS nodes via statically-configured peers. More...
 

Function Documentation

◆ rcl_automatic_discovery_range_to_string()

RCL_PUBLIC const char* rcl_automatic_discovery_range_to_string ( rmw_automatic_discovery_range_t  automatic_discovery_range)

Convert the automatic discovery range value to a string for easy printing.

Parameters
[in]automatic_discovery_rangerange enum to stringify
Returns
string version of enum, or NULL if not recognized

Definition at line 90 of file discovery_options.c.

Referenced by rcl_init().

Here is the caller graph for this function:

◆ rcl_get_automatic_discovery_range()

RCL_PUBLIC rcl_ret_t rcl_get_automatic_discovery_range ( rmw_discovery_options_t *  discovery_options)

Determine how the user wishes to discover other ROS nodes automatically.

Use the ROS_AUTOMATIC_DISCOVERY_RANGE environment variable to determine how far automatic discovery should be allowed to propagate:

  • not at all (no automatic discovery),
  • the local machine only,
  • or the subnet (or as far beyond the local system as the middleware can)

When the subnet is specified the automatic discovery mechanism used by the rmw implementation dictates how far discovery can propagate on the network, e.g. for multicast-based discovery this will be the local subnet, hence the name.

The option indicated by the environment variable will be stored in the automatic_discovery_range field of the given discovery_options struct.

If the environment variable isn't set, then the default discovery range will be the value of the preprocessor definition RCL_DEFAULT_DISCOVERY_RANGE. If the definition is undefined, then the default will be SUBNET. It is intended that the default will be LOCALHOST in future versions of ROS.

Parameters
[out]discovery_optionsMust not be NULL.
Returns
RCL_RET_INVALID_ARGUMENT if an argument is invalid, or
RCL_RET_ERROR if an unexpected error happened, or
RCL_RET_OK.

Definition at line 43 of file discovery_options.c.

References RCL_RET_ERROR, RCL_RET_INVALID_ARGUMENT, and RCL_RET_OK.

Referenced by rcl_init().

Here is the caller graph for this function:

◆ rcl_get_discovery_static_peers()

RCL_PUBLIC rcl_ret_t rcl_get_discovery_static_peers ( rmw_discovery_options_t *  discovery_options,
rcutils_allocator_t *  allocator 
)

Determine how the user wishes to discover other ROS nodes via statically-configured peers.

Use the ROS_STATIC_PEERS environment variable to determine which hosts the user wants to communicate with, in addition to localhost.

Values for the static peers are not validated beyond basic string checks, e.g. avoiding empty strings, etc. Any validation of IP addresses or hostnames is left up to the rmw implementation, and therefore what is and is not acceptable in these fields is dependent on it.

The general expectation, however, is that IP addresses and hostnames are acceptable.

The static peers are split by ';' and returned as a list of fixed length c-strings in the static_peers and static_peers_count fields of the given discovery_options struct. Each peer may only be RMW_DISCOVERY_OPTIONS_STATIC_PEERS_MAX_LENGTH long, and if it is longer it will be skipped and a warning log message will be produced.

Parameters
[out]discovery_optionsMust not be NULL.
Returns
RCL_RET_INVALID_ARGUMENT if an argument is invalid, or
RCL_RET_ERROR if an unexpected error happened, or
RCL_RET_OK.

Definition at line 109 of file discovery_options.c.

References RCL_RET_ERROR, RCL_RET_INVALID_ARGUMENT, and RCL_RET_OK.

Referenced by rcl_init().

Here is the caller graph for this function: