generate_parameter_library
generate_parameter_library copied to clipboard
Undeclaring a parameter throws an unexpected error.
trafficstars
According to the ROS 2 documentation, the undeclare_parameter(const std::string & name) method of rclcpp::node_interfaces::NodeParametersInterface should only throw two types of exceptions:
rclcpp::exceptions::ParameterNotDeclaredException: if the parameter has not been declared.rclcpp::exceptions::ParameterImmutableException: if the parameter was create as read_only (immutable).
I get the following exception when I try to undeclare a parameter.
terminate called after throwing an instance of 'rclcpp::exceptions::InvalidParameterTypeException'
what(): parameter 'pid.elbow_joint.p' has invalid type: cannot undeclare an statically typed parameter
This occurs when setting the parameter like this:
double val = 1.5;
auto parameter = rclcpp::ParameterValue(val);
rcl_interfaces::msg::ParameterDescriptor descriptor;
descriptor.description = "my parameter";
parameters_interface_->declare_parameter("pid.elbow_joint.p", parameter, descriptor);