rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
26 #include "rcl_interfaces/msg/list_parameters_result.hpp"
27 #include "rcl_interfaces/msg/parameter_descriptor.hpp"
28 #include "rcl_interfaces/msg/parameter_event.hpp"
29 #include "rcl_interfaces/msg/set_parameters_result.hpp"
44 namespace node_interfaces
62 : allow_modification_(allow_mod)
64 if (!allow_modification_) {
66 "cannot set or declare a parameter, or change the callback from within set callback");
69 allow_modification_ =
false;
74 allow_modification_ =
true;
78 bool & allow_modification_;
89 const node_interfaces::NodeBaseInterface::SharedPtr node_base,
90 const node_interfaces::NodeLoggingInterface::SharedPtr node_logging,
91 const node_interfaces::NodeTopicsInterface::SharedPtr node_topics,
92 const node_interfaces::NodeServicesInterface::SharedPtr node_services,
93 const node_interfaces::NodeClockInterface::SharedPtr node_clock,
95 bool start_parameter_services,
96 bool start_parameter_event_publisher,
99 bool allow_undeclared_parameters,
100 bool automatically_declare_parameters_from_overrides);
111 const rcl_interfaces::msg::ParameterDescriptor & parameter_descriptor,
112 bool ignore_override)
override;
128 rcl_interfaces::msg::SetParametersResult
161 rcl_interfaces::msg::ListParametersResult
166 OnSetParametersCallbackHandle::SharedPtr
173 [[deprecated(
"use add_on_set_parameters_callback(OnParametersSetCallbackType callback) instead")]]
192 bool parameter_modification_enabled_{
true};
202 bool allow_undeclared_ =
false;
210 node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
211 node_interfaces::NodeClockInterface::SharedPtr node_clock_;
217 #endif // RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
Store the type and value of a parameter.
Definition: parameter_value.hpp:71
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:51
rclcpp::ParameterValue value
Current value of the parameter.
Definition: node_parameters.hpp:51
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
ParameterMutationRecursionGuard(bool &allow_mod)
Definition: node_parameters.hpp:61
Definition: node_parameters.hpp:48
rcl_interfaces::msg::ParameterDescriptor descriptor
A description of the parameter.
Definition: node_parameters.hpp:54
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
Non-templated part of PublisherOptionsWithAllocator<Allocator>.
Definition: publisher_options.hpp:36
Implementation of the NodeParameters part of the Node API.
Definition: node_parameters.hpp:82
OnParametersSetCallbackType set_on_parameters_set_callback(OnParametersSetCallbackType callback) override
Register a callback for when parameters are being set, return an existing one.
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
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.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Definition: node_parameters_interface.hpp:36
Encapsulation of Quality of Service settings.
Definition: qos.hpp:59
void undeclare_parameter(const std::string &name) override
Undeclare a parameter.
std::vector< uint8_t > get_parameter_types(const std::vector< std::string > &names) const override
std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > ¶meters) override
Set one or more parameters, one at a time.
Pure virtual interface class for the NodeParameters part of the Node API.
Definition: node_parameters_interface.hpp:49
void remove_on_set_parameters_callback(const OnSetParametersCallbackHandle *const handler) override
Remove a callback registered with add_on_set_parameters_callback.
Thrown if parameter is modified while in a set callback.
Definition: exceptions.hpp:270
std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const override
#define RCUTILS_WARN_UNUSED
Definition: node_parameters.hpp:58
std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const override
Get descriptions of parameters given their names.
rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > ¶meters) override
Set and initialize a parameter, all at once.
rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const override
const rclcpp::ParameterValue & declare_parameter(const std::string &name, const rclcpp::ParameterValue &default_value, const rcl_interfaces::msg::ParameterDescriptor ¶meter_descriptor, bool ignore_override) override
Declare and initialize a parameter.
virtual ~NodeParameters()
rclcpp::Parameter get_parameter(const std::string &name) const override
Get the description of one parameter given a name.
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:52
std::list< OnSetParametersCallbackHandle::WeakPtr > CallbacksContainerType
Definition: node_parameters.hpp:182
bool get_parameters_by_prefix(const std::string &prefix, std::map< std::string, rclcpp::Parameter > ¶meters) const override
Get all parameters that have the specified prefix into the parameters map.
RCUTILS_WARN_UNUSED OnSetParametersCallbackHandle::SharedPtr add_on_set_parameters_callback(OnParametersSetCallbackType callback) override
Add a callback for when parameters are being set.
~ParameterMutationRecursionGuard()
Definition: node_parameters.hpp:72
bool has_parameter(const std::string &name) const override
Return true if the parameter has been declared, otherwise false.
OnSetParametersCallbackHandle::OnParametersSetCallbackType OnParametersSetCallbackType
Definition: node_parameters_interface.hpp:174
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 > ¶meter_overrides, bool start_parameter_services, bool start_parameter_event_publisher, const rclcpp::QoS ¶meter_event_qos, const rclcpp::PublisherOptionsBase ¶meter_event_publisher_options, bool allow_undeclared_parameters, bool automatically_declare_parameters_from_overrides)