Class NodeParameters

Inheritance Relationships

Base Type

Class Documentation

class NodeParameters : public rclcpp::node_interfaces::NodeParametersInterface

Implementation of the NodeParameters part of the Node API.

Public Types

using PreSetCallbacksHandleContainer = std::list<PreSetParametersCallbackHandle::WeakPtr>
using OnSetCallbacksHandleContainer = std::list<OnSetParametersCallbackHandle::WeakPtr>
using PostSetCallbacksHandleContainer = std::list<PostSetParametersCallbackHandle::WeakPtr>
using CallbacksContainerType = OnSetCallbacksHandleContainer

Public Functions

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.

virtual ~NodeParameters()
virtual const rclcpp::ParameterValue &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) override

Declare and initialize a parameter.

virtual const rclcpp::ParameterValue &declare_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.

virtual void undeclare_parameter(const std::string &name) override

Undeclare a parameter.

virtual bool has_parameter(const std::string &name) const override

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

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

Set one or more parameters, one at a time.

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

Set one or more parameters, all at once.

virtual std::vector<rclcpp::Parameter> get_parameters(const std::vector<std::string> &names) const override

Get descriptions of parameters given their names.

virtual rclcpp::Parameter get_parameter(const std::string &name) const override

Get the description of one parameter given a name.

virtual bool get_parameter(const std::string &name, rclcpp::Parameter &parameter) const override

Get the description of one parameter given a name.

virtual 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.

virtual std::vector<rcl_interfaces::msg::ParameterDescriptor> describe_parameters(const std::vector<std::string> &names) const override
virtual std::vector<uint8_t> get_parameter_types(const std::vector<std::string> &names) const override
virtual rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector<std::string> &prefixes, uint64_t depth) const override
virtual PreSetParametersCallbackHandle::SharedPtr add_pre_set_parameters_callback(PreSetParametersCallbackType callback) override

Add a callback that gets triggered before parameters are validated.

virtual OnSetParametersCallbackHandle::SharedPtr add_on_set_parameters_callback(OnSetParametersCallbackType callback) override

Add a callback to validate parameters before they are set.

virtual PostSetParametersCallbackHandle::SharedPtr add_post_set_parameters_callback(PostSetParametersCallbackType callback) override

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

virtual void remove_on_set_parameters_callback(const OnSetParametersCallbackHandle *const handler) override

Remove a callback registered with add_on_set_parameters_callback.

virtual void remove_post_set_parameters_callback(const PostSetParametersCallbackHandle *const handler) override

Remove a callback registered with add_post_set_parameters_callback.

virtual void remove_pre_set_parameters_callback(const PreSetParametersCallbackHandle *const handler) override

Remove a callback registered with add_pre_set_parameters_callback.

virtual 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 Functions

void perform_automatically_declare_parameters_from_overrides()