ROS 2 rclcpp + rcl - rolling
rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
|
Encapsulation of options for node initialization. More...
#include <rclcpp/node_options.hpp>
Public Member Functions | |
RCLCPP_PUBLIC | NodeOptions (rcl_allocator_t allocator=rcl_get_default_allocator()) |
Create NodeOptions with default values, optionally specifying the allocator to use. More... | |
virtual RCLCPP_PUBLIC | ~NodeOptions ()=default |
Destructor. | |
RCLCPP_PUBLIC | NodeOptions (const NodeOptions &other) |
Copy constructor. | |
RCLCPP_PUBLIC NodeOptions & | operator= (const NodeOptions &other) |
Assignment operator. | |
RCLCPP_PUBLIC const rcl_node_options_t * | get_rcl_node_options () const |
Return the rcl_node_options used by the node. More... | |
RCLCPP_PUBLIC rclcpp::Context::SharedPtr | context () const |
Return the context to be used by the node. | |
RCLCPP_PUBLIC NodeOptions & | context (rclcpp::Context::SharedPtr context) |
Set the context, return this for parameter idiom. | |
RCLCPP_PUBLIC const std::vector< std::string > & | arguments () const |
Return a reference to the list of arguments for the node. | |
RCLCPP_PUBLIC NodeOptions & | arguments (const std::vector< std::string > &arguments) |
Set the arguments, return this for parameter idiom. More... | |
RCLCPP_PUBLIC std::vector< rclcpp::Parameter > & | parameter_overrides () |
Return a reference to the list of parameter overrides. | |
RCLCPP_PUBLIC const std::vector< rclcpp::Parameter > & | parameter_overrides () const |
RCLCPP_PUBLIC NodeOptions & | parameter_overrides (const std::vector< rclcpp::Parameter > ¶meter_overrides) |
Set the parameters overrides, return this for parameter idiom. More... | |
template<typename ParameterT > | |
NodeOptions & | append_parameter_override (const std::string &name, const ParameterT &value) |
Append a single parameter override, parameter idiom style. | |
NodeOptions & | append_parameter_override (const rclcpp::Parameter ¶m) |
Append a single parameter override, parameter idiom style. | |
RCLCPP_PUBLIC bool | use_global_arguments () const |
Return the use_global_arguments flag. | |
RCLCPP_PUBLIC NodeOptions & | use_global_arguments (bool use_global_arguments) |
Set the use_global_arguments flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | enable_rosout () const |
Return the enable_rosout flag. | |
RCLCPP_PUBLIC NodeOptions & | enable_rosout (bool enable_rosout) |
Set the enable_rosout flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | use_intra_process_comms () const |
Return the use_intra_process_comms flag. | |
RCLCPP_PUBLIC NodeOptions & | use_intra_process_comms (bool use_intra_process_comms) |
Set the use_intra_process_comms flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | enable_topic_statistics () const |
Return the enable_topic_statistics flag. | |
RCLCPP_PUBLIC NodeOptions & | enable_topic_statistics (bool enable_topic_statistics) |
Set the enable_topic_statistics flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | start_parameter_services () const |
Return the start_parameter_services flag. | |
RCLCPP_PUBLIC NodeOptions & | start_parameter_services (bool start_parameter_services) |
Set the start_parameter_services flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | enable_logger_service () const |
Return the enable_logger_service flag. | |
RCLCPP_PUBLIC NodeOptions & | enable_logger_service (bool enable_log_service) |
Set the enable_logger_service flag, return this for logger idiom. More... | |
RCLCPP_PUBLIC bool | start_parameter_event_publisher () const |
Return the start_parameter_event_publisher flag. | |
RCLCPP_PUBLIC NodeOptions & | start_parameter_event_publisher (bool start_parameter_event_publisher) |
Set the start_parameter_event_publisher flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC const rcl_clock_type_t & | clock_type () const |
Return a reference to the clock type. | |
RCLCPP_PUBLIC NodeOptions & | clock_type (const rcl_clock_type_t &clock_type) |
Set the clock type. More... | |
RCLCPP_PUBLIC const rclcpp::QoS & | clock_qos () const |
Return a reference to the clock QoS. | |
RCLCPP_PUBLIC NodeOptions & | clock_qos (const rclcpp::QoS &clock_qos) |
Set the clock QoS. More... | |
RCLCPP_PUBLIC bool | use_clock_thread () const |
Return the use_clock_thread flag. | |
RCLCPP_PUBLIC NodeOptions & | use_clock_thread (bool use_clock_thread) |
Set the use_clock_thread flag, return this for parameter idiom. More... | |
RCLCPP_PUBLIC const rclcpp::QoS & | parameter_event_qos () const |
Return a reference to the parameter_event_qos QoS. | |
RCLCPP_PUBLIC NodeOptions & | parameter_event_qos (const rclcpp::QoS ¶meter_event_qos) |
Set the parameter_event_qos QoS, return this for parameter idiom. More... | |
RCLCPP_PUBLIC const rclcpp::QoS & | rosout_qos () const |
Return a reference to the rosout QoS. | |
RCLCPP_PUBLIC NodeOptions & | rosout_qos (const rclcpp::QoS &rosout_qos) |
Set the rosout QoS. More... | |
RCLCPP_PUBLIC const rclcpp::PublisherOptionsBase & | parameter_event_publisher_options () const |
Return a reference to the parameter_event_publisher_options. | |
RCLCPP_PUBLIC NodeOptions & | parameter_event_publisher_options (const rclcpp::PublisherOptionsBase ¶meter_event_publisher_options) |
Set the parameter_event_publisher_options, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | allow_undeclared_parameters () const |
Return the allow_undeclared_parameters flag. | |
RCLCPP_PUBLIC NodeOptions & | allow_undeclared_parameters (bool allow_undeclared_parameters) |
Set the allow_undeclared_parameters, return this for parameter idiom. More... | |
RCLCPP_PUBLIC bool | automatically_declare_parameters_from_overrides () const |
Return the automatically_declare_parameters_from_overrides flag. | |
RCLCPP_PUBLIC NodeOptions & | automatically_declare_parameters_from_overrides (bool automatically_declare_parameters_from_overrides) |
Set the automatically_declare_parameters_from_overrides, return this. More... | |
RCLCPP_PUBLIC const rcl_allocator_t & | allocator () const |
Return the rcl_allocator_t to be used. | |
RCLCPP_PUBLIC NodeOptions & | allocator (rcl_allocator_t allocator) |
Set the rcl_allocator_t to be used, may cause deallocation of existing rcl_node_options_t. More... | |
Encapsulation of options for node initialization.
Definition at line 35 of file node_options.hpp.
|
explicit |
Create NodeOptions with default values, optionally specifying the allocator to use.
Default values for the node options:
[in] | allocator | allocator to use in construction of NodeOptions. |
Definition at line 56 of file node_options.cpp.
NodeOptions & rclcpp::NodeOptions::allocator | ( | rcl_allocator_t | allocator | ) |
Set the rcl_allocator_t to be used, may cause deallocation of existing rcl_node_options_t.
This will cause the internal rcl_node_options_t struct to be invalidated.
Definition at line 393 of file node_options.cpp.
References allocator().
NodeOptions & rclcpp::NodeOptions::allow_undeclared_parameters | ( | bool | allow_undeclared_parameters | ) |
Set the allow_undeclared_parameters, return this for parameter idiom.
If true, allow any parameter name to be set on the node without first being declared. Otherwise, setting an undeclared parameter will raise an exception.
This option being true does not affect parameter_overrides, as the first set action will implicitly declare the parameter and therefore consider any parameter overrides.
Definition at line 365 of file node_options.cpp.
References allow_undeclared_parameters().
NodeOptions & rclcpp::NodeOptions::arguments | ( | const std::vector< std::string > & | arguments | ) |
Set the arguments, return this for parameter idiom.
These arguments are used to extract remappings used by the node and other ROS specific settings, as well as user defined non-ROS arguments.
This will cause the internal rcl_node_options_t struct to be invalidated.
Definition at line 159 of file node_options.cpp.
References arguments().
NodeOptions & rclcpp::NodeOptions::automatically_declare_parameters_from_overrides | ( | bool | automatically_declare_parameters_from_overrides | ) |
Set the automatically_declare_parameters_from_overrides, return this.
If true, automatically iterate through the node's parameter overrides and implicitly declare any that have not already been declared. Otherwise, parameters passed to the node's parameter_overrides, and/or the global arguments (e.g. parameter overrides from a YAML file), which are not explicitly declared will not appear on the node at all, even if allow_undeclared_parameters
is true. Parameter declaration from overrides is done in the node's base constructor, so the user must take care to check if the parameter is already (e.g. automatically) declared before declaring it themselves. Already declared parameters will not be re-declared, and parameters declared in this way will use the default constructed ParameterDescriptor.
Definition at line 378 of file node_options.cpp.
References automatically_declare_parameters_from_overrides().
NodeOptions & rclcpp::NodeOptions::clock_qos | ( | const rclcpp::QoS & | clock_qos | ) |
Set the clock QoS.
The QoS settings to be used for the publisher on /clock topic, if enabled.
Definition at line 298 of file node_options.cpp.
References clock_qos().
NodeOptions & rclcpp::NodeOptions::clock_type | ( | const rcl_clock_type_t & | clock_type | ) |
Set the clock type.
The clock type to be used by the node.
Definition at line 285 of file node_options.cpp.
References clock_type().
NodeOptions & rclcpp::NodeOptions::enable_logger_service | ( | bool | enable_log_service | ) |
Set the enable_logger_service flag, return this for logger idiom.
If true, ROS services are created to allow external nodes to get and set logger levels of this node.
If false, loggers will still be configured and set logger levels locally, but logger levels cannot be changed remotely .
Definition at line 259 of file node_options.cpp.
References enable_logger_service().
Referenced by enable_logger_service().
NodeOptions & rclcpp::NodeOptions::enable_rosout | ( | bool | enable_rosout | ) |
Set the enable_rosout flag, return this for parameter idiom.
If false this will cause the node not to use rosout logging.
Defaults to true for now, as there are still some cases where it is desirable.
Definition at line 206 of file node_options.cpp.
References enable_rosout().
NodeOptions & rclcpp::NodeOptions::enable_topic_statistics | ( | bool | enable_topic_statistics | ) |
Set the enable_topic_statistics flag, return this for parameter idiom.
If true, topic statistics collection and publication will be enabled for all subscriptions. This can be used to override the global topic statistics setting.
Defaults to false.
Definition at line 233 of file node_options.cpp.
References enable_topic_statistics().
const rcl_node_options_t * rclcpp::NodeOptions::get_rcl_node_options | ( | ) | const |
Return the rcl_node_options used by the node.
This data structure is created lazily, on the first call to this function. Repeated calls will not regenerate it unless one of the input settings changed, like arguments, use_global_arguments, or the rcl allocator.
exceptions::UnknownROSArgsError | if there are unknown ROS arguments |
Definition at line 96 of file node_options.cpp.
References rclcpp::QoS::get_rmw_qos_profile(), rcl_node_get_default_options(), rcl_parse_arguments(), RCL_RET_INVALID_ARGUMENT, and RCL_RET_OK.
NodeOptions & rclcpp::NodeOptions::parameter_event_publisher_options | ( | const rclcpp::PublisherOptionsBase & | parameter_event_publisher_options | ) |
Set the parameter_event_publisher_options, return this for parameter idiom.
The QoS settings to be used for the parameter event publisher, if enabled.
Definition at line 351 of file node_options.cpp.
References parameter_event_publisher_options().
NodeOptions & rclcpp::NodeOptions::parameter_event_qos | ( | const rclcpp::QoS & | parameter_event_qos | ) |
Set the parameter_event_qos QoS, return this for parameter idiom.
The QoS settings to be used for the parameter event publisher, if enabled.
Definition at line 324 of file node_options.cpp.
References parameter_event_qos().
NodeOptions & rclcpp::NodeOptions::parameter_overrides | ( | const std::vector< rclcpp::Parameter > & | parameter_overrides | ) |
Set the parameters overrides, return this for parameter idiom.
These parameter overrides are used to change the initial value of declared parameters within the node, overriding hard coded default values if necessary.
Definition at line 179 of file node_options.cpp.
References parameter_overrides().
NodeOptions & rclcpp::NodeOptions::rosout_qos | ( | const rclcpp::QoS & | rosout_qos | ) |
Set the rosout QoS.
The QoS settings to be used for the publisher on /rosout topic, if enabled.
Definition at line 337 of file node_options.cpp.
References rosout_qos().
NodeOptions & rclcpp::NodeOptions::start_parameter_event_publisher | ( | bool | start_parameter_event_publisher | ) |
Set the start_parameter_event_publisher flag, return this for parameter idiom.
If true, a publisher is created on which an event message is published each time a parameter's state changes. This is used for recording and introspection, but is configurable separately from the other parameter services.
Definition at line 272 of file node_options.cpp.
References start_parameter_event_publisher().
NodeOptions & rclcpp::NodeOptions::start_parameter_services | ( | bool | start_parameter_services | ) |
Set the start_parameter_services flag, return this for parameter idiom.
If true, ROS services are created to allow external nodes to list, get, and request to set parameters of this node.
If false, parameters will still work locally, but will not be accessible remotely.
Definition at line 246 of file node_options.cpp.
References start_parameter_services().
NodeOptions & rclcpp::NodeOptions::use_clock_thread | ( | bool | use_clock_thread | ) |
Set the use_clock_thread flag, return this for parameter idiom.
If true, a dedicated thread will be used to subscribe to "/clock" topic.
Definition at line 311 of file node_options.cpp.
References use_clock_thread().
NodeOptions & rclcpp::NodeOptions::use_global_arguments | ( | bool | use_global_arguments | ) |
Set the use_global_arguments flag, return this for parameter idiom.
If true this will cause the node's behavior to be influenced by "global" arguments, i.e. arguments not targeted at specific nodes, as well as the arguments targeted at the current node.
This will cause the internal rcl_node_options_t struct to be invalidated.
Definition at line 192 of file node_options.cpp.
References use_global_arguments().
NodeOptions & rclcpp::NodeOptions::use_intra_process_comms | ( | bool | use_intra_process_comms | ) |
Set the use_intra_process_comms flag, return this for parameter idiom.
If true, messages on topics which are published and subscribed to within this context will go through a special intra-process communication code code path which can avoid serialization and deserialization, unnecessary copies, and achieve lower latencies in some cases.
Defaults to false for now, as there are still some cases where it is not desirable.
Definition at line 220 of file node_options.cpp.
References use_intra_process_comms().