ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
Public Types | Public Member Functions | Protected Member Functions | List of all members
rclcpp::node_interfaces::NodeParameters Class Reference

Implementation of the NodeParameters part of the Node API. More...

#include <rclcpp/node_interfaces/node_parameters.hpp>

Inheritance diagram for rclcpp::node_interfaces::NodeParameters:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::node_interfaces::NodeParameters:
Collaboration graph
[legend]

Public Types

using PreSetCallbacksHandleContainer = std::list< PreSetParametersCallbackHandle::WeakPtr >
 
using OnSetCallbacksHandleContainer = std::list< OnSetParametersCallbackHandle::WeakPtr >
 
using PostSetCallbacksHandleContainer = std::list< PostSetParametersCallbackHandle::WeakPtr >
 
using CallbacksContainerType = OnSetCallbacksHandleContainer
 
- Public Types inherited from rclcpp::node_interfaces::NodeParametersInterface
using OnSetParametersCallbackType = OnSetParametersCallbackHandle::OnSetParametersCallbackType
 
using PostSetParametersCallbackType = PostSetParametersCallbackHandle::PostSetParametersCallbackType
 
using PreSetParametersCallbackType = PreSetParametersCallbackHandle::PreSetParametersCallbackType
 

Public Member Functions

RCLCPP_PUBLIC NodeParameters (const node_interfaces::NodeBaseInterface::SharedPtr node_base, const node_interfaces::NodeLoggingInterface::SharedPtr node_logging, const node_interfaces::NodeTopicsInterface::SharedPtr node_topics, const node_interfaces::NodeServicesInterface::SharedPtr node_services, const node_interfaces::NodeClockInterface::SharedPtr node_clock, const std::vector< Parameter > &parameter_overrides, bool start_parameter_services, bool start_parameter_event_publisher, const rclcpp::QoS &parameter_event_qos, const rclcpp::PublisherOptionsBase &parameter_event_publisher_options, bool allow_undeclared_parameters, bool automatically_declare_parameters_from_overrides)
 Constructor. More...
 
RCLCPP_PUBLIC const rclcpp::ParameterValuedeclare_parameter (const std::string &name, const rclcpp::ParameterValue &default_value, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor{}, bool ignore_override=false) override
 Declare and initialize a parameter. More...
 
RCLCPP_PUBLIC const rclcpp::ParameterValuedeclare_parameter (const std::string &name, rclcpp::ParameterType type, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor(), bool ignore_override=false) override
 Declare a parameter. More...
 
RCLCPP_PUBLIC void undeclare_parameter (const std::string &name) override
 Undeclare a parameter. More...
 
RCLCPP_PUBLIC bool has_parameter (const std::string &name) const override
 Return true if the parameter has been declared, otherwise false. More...
 
RCLCPP_PUBLIC std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters (const std::vector< rclcpp::Parameter > &parameters) override
 Set one or more parameters, one at a time. More...
 
RCLCPP_PUBLIC rcl_interfaces::msg::SetParametersResult set_parameters_atomically (const std::vector< rclcpp::Parameter > &parameters) override
 Set one or more parameters, all at once. More...
 
RCLCPP_PUBLIC std::vector< rclcpp::Parameterget_parameters (const std::vector< std::string > &names) const override
 Get descriptions of parameters given their names.
 
RCLCPP_PUBLIC rclcpp::Parameter get_parameter (const std::string &name) const override
 Get the description of one parameter given a name.
 
RCLCPP_PUBLIC bool get_parameter (const std::string &name, rclcpp::Parameter &parameter) const override
 Get the description of one parameter given a name.
 
RCLCPP_PUBLIC bool get_parameters_by_prefix (const std::string &prefix, std::map< std::string, rclcpp::Parameter > &parameters) const override
 Get all parameters that have the specified prefix into the parameters map.
 
RCLCPP_PUBLIC std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters (const std::vector< std::string > &names) const override
 
RCLCPP_PUBLIC std::vector< uint8_t > get_parameter_types (const std::vector< std::string > &names) const override
 
RCLCPP_PUBLIC rcl_interfaces::msg::ListParametersResult list_parameters (const std::vector< std::string > &prefixes, uint64_t depth) const override
 
RCLCPP_PUBLIC RCUTILS_WARN_UNUSED PreSetParametersCallbackHandle::SharedPtr add_pre_set_parameters_callback (PreSetParametersCallbackType callback) override
 Add a callback that gets triggered before parameters are validated. More...
 
RCLCPP_PUBLIC RCUTILS_WARN_UNUSED OnSetParametersCallbackHandle::SharedPtr add_on_set_parameters_callback (OnSetParametersCallbackType callback) override
 Add a callback to validate parameters before they are set. More...
 
RCLCPP_PUBLIC RCUTILS_WARN_UNUSED PostSetParametersCallbackHandle::SharedPtr add_post_set_parameters_callback (PostSetParametersCallbackType callback) override
 Add a callback that gets triggered after parameters are set successfully. More...
 
RCLCPP_PUBLIC void remove_on_set_parameters_callback (const OnSetParametersCallbackHandle *const handler) override
 Remove a callback registered with add_on_set_parameters_callback. More...
 
RCLCPP_PUBLIC void remove_post_set_parameters_callback (const PostSetParametersCallbackHandle *const handler) override
 Remove a callback registered with add_post_set_parameters_callback. More...
 
RCLCPP_PUBLIC void remove_pre_set_parameters_callback (const PreSetParametersCallbackHandle *const handler) override
 Remove a callback registered with add_pre_set_parameters_callback. More...
 
RCLCPP_PUBLIC const std::map< std::string, rclcpp::ParameterValue > & get_parameter_overrides () const override
 Return the initial parameter values used by the NodeParameters to override default values.
 

Protected Member Functions

RCLCPP_PUBLIC void perform_automatically_declare_parameters_from_overrides ()
 

Detailed Description

Implementation of the NodeParameters part of the Node API.

Definition at line 83 of file node_parameters.hpp.

Constructor & Destructor Documentation

◆ NodeParameters()

NodeParameters::NodeParameters ( const node_interfaces::NodeBaseInterface::SharedPtr  node_base,
const node_interfaces::NodeLoggingInterface::SharedPtr  node_logging,
const node_interfaces::NodeTopicsInterface::SharedPtr  node_topics,
const node_interfaces::NodeServicesInterface::SharedPtr  node_services,
const node_interfaces::NodeClockInterface::SharedPtr  node_clock,
const std::vector< Parameter > &  parameter_overrides,
bool  start_parameter_services,
bool  start_parameter_event_publisher,
const rclcpp::QoS parameter_event_qos,
const rclcpp::PublisherOptionsBase parameter_event_publisher_options,
bool  allow_undeclared_parameters,
bool  automatically_declare_parameters_from_overrides 
)

Constructor.

If using automatically_declare_parameters_from_overrides, overrides of get_parameter_overrides(), has_parameter(), declare_parameter() will not be respected. If this is an issue, pass false for automatically_declare_parameters_from_overrides and invoke perform_automatically_declare_parameters_from_overrides() manually after construction.

Definition at line 67 of file node_parameters.cpp.

References rclcpp::PublisherOptionsWithAllocator< Allocator >::allocator, rcl_node_options_s::arguments, declare_parameter(), get_parameter_overrides(), has_parameter(), rcl_node_get_options(), and rcl_node_options_s::use_global_arguments.

Here is the call graph for this function:

Member Function Documentation

◆ add_on_set_parameters_callback()

OnSetParametersCallbackHandle::SharedPtr NodeParameters::add_on_set_parameters_callback ( OnSetParametersCallbackType  callback)
overridevirtual

Add a callback to validate parameters before they are set.

See also
rclcpp::Node::add_on_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1163 of file node_parameters.cpp.

◆ add_post_set_parameters_callback()

PostSetParametersCallbackHandle::SharedPtr NodeParameters::add_post_set_parameters_callback ( PostSetParametersCallbackType  callback)
overridevirtual

Add a callback that gets triggered after parameters are set successfully.

See also
rclcpp::Node::add_post_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1176 of file node_parameters.cpp.

◆ add_pre_set_parameters_callback()

PreSetParametersCallbackHandle::SharedPtr NodeParameters::add_pre_set_parameters_callback ( PreSetParametersCallbackType  callback)
overridevirtual

Add a callback that gets triggered before parameters are validated.

See also
rclcpp::Node::add_pre_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1150 of file node_parameters.cpp.

◆ declare_parameter() [1/2]

const rclcpp::ParameterValue & NodeParameters::declare_parameter ( const std::string &  name,
const rclcpp::ParameterValue default_value,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor{},
bool  ignore_override = false 
)
overridevirtual

Declare and initialize a parameter.

See also
rclcpp::Node::declare_parameter

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 575 of file node_parameters.cpp.

Referenced by NodeParameters().

Here is the caller graph for this function:

◆ declare_parameter() [2/2]

const rclcpp::ParameterValue & NodeParameters::declare_parameter ( const std::string &  name,
rclcpp::ParameterType  type,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor(),
bool  ignore_override = false 
)
overridevirtual

Declare a parameter.

See also
rclcpp::Node::declare_parameter

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 600 of file node_parameters.cpp.

◆ has_parameter()

bool NodeParameters::has_parameter ( const std::string &  name) const
overridevirtual

Return true if the parameter has been declared, otherwise false.

See also
rclcpp::Node::has_parameter

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 661 of file node_parameters.cpp.

Referenced by NodeParameters().

Here is the caller graph for this function:

◆ remove_on_set_parameters_callback()

void NodeParameters::remove_on_set_parameters_callback ( const OnSetParametersCallbackHandle *const  handler)
overridevirtual

Remove a callback registered with add_on_set_parameters_callback.

See also
rclcpp::Node::remove_on_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1110 of file node_parameters.cpp.

◆ remove_post_set_parameters_callback()

void NodeParameters::remove_post_set_parameters_callback ( const PostSetParametersCallbackHandle *const  handler)
overridevirtual

Remove a callback registered with add_post_set_parameters_callback.

See also
rclcpp::Node::remove_post_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1130 of file node_parameters.cpp.

◆ remove_pre_set_parameters_callback()

void NodeParameters::remove_pre_set_parameters_callback ( const PreSetParametersCallbackHandle *const  handler)
overridevirtual

Remove a callback registered with add_pre_set_parameters_callback.

See also
rclcpp::Node::remove_pre_set_parameters_callback

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 1090 of file node_parameters.cpp.

◆ set_parameters()

std::vector< rcl_interfaces::msg::SetParametersResult > NodeParameters::set_parameters ( const std::vector< rclcpp::Parameter > &  parameters)
overridevirtual

Set one or more parameters, one at a time.

See also
rclcpp::Node::set_parameters

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 669 of file node_parameters.cpp.

References set_parameters_atomically().

Here is the call graph for this function:

◆ set_parameters_atomically()

rcl_interfaces::msg::SetParametersResult NodeParameters::set_parameters_atomically ( const std::vector< rclcpp::Parameter > &  parameters)
overridevirtual

Set one or more parameters, all at once.

See also
rclcpp::Node::set_parameters_atomically

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 695 of file node_parameters.cpp.

References rclcpp::Publisher< MessageT, AllocatorT >::publish(), and rclcpp::Parameter::to_parameter_msg().

Referenced by set_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ undeclare_parameter()

void NodeParameters::undeclare_parameter ( const std::string &  name)
overridevirtual

Undeclare a parameter.

See also
rclcpp::Node::undeclare_parameter

Implements rclcpp::node_interfaces::NodeParametersInterface.

Definition at line 636 of file node_parameters.cpp.


The documentation for this class was generated from the following files: