Function rcl_get_discovery_static_peers

Function Documentation

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:

discovery_options[out] Must not be NULL.

Returns:

RCL_RET_INVALID_ARGUMENT if an argument is invalid, or

Returns:

RCL_RET_ERROR if an unexpected error happened, or

Returns:

RCL_RET_OK.