Skip to content

Add an option for ignoring parameter overrides #750

@ivanpauno

Description

@ivanpauno

Feature request

Feature description

Follow up of #730 (see #730 (comment)). Currently, the user don't have a way of ignoring a parameter override.

My suggestion is to change:

  RCLCPP_PUBLIC
  const rclcpp::ParameterValue &
  declare_parameter(
    const std::string & name,
    const rclcpp::ParameterValue & default_value = rclcpp::ParameterValue(),
    const rcl_interfaces::msg::ParameterDescriptor & parameter_descriptor =
    rcl_interfaces::msg::ParameterDescriptor());

to

  RCLCPP_PUBLIC
  const rclcpp::ParameterValue &
  declare_parameter(
    const std::string & name,
    const rclcpp::ParameterValue & default_value = rclcpp::ParameterValue(),
    const rcl_interfaces::msg::ParameterDescriptor & parameter_descriptor =
    rcl_interfaces::msg::ParameterDescriptor()
    bool ignore_override = false,
  );

and maybe, also add:

  RCLCPP_PUBLIC
  const rclcpp::ParameterValue &
  declare_parameter(
    const std::string & name,
    const rclcpp::ParameterValue & default_value = rclcpp::ParameterValue(),
    bool ignore_override = false,
  );

When undeclared parameters are allowed and automatically_declare_parameter_overrides is false, the first set_parameter call does not actually set the parameter but it takes the override value (see the second example here).

I don't see much usage of that feature, and I think it's a little confusing. I suggest always ignoring the parameter override in that case. That last change would be an api break, but of something with not much use cases. I don't see much value on adding a ignore_override argument to set_parameter method.

Note: Maybe, we could also add a node option for ignoring all the overrides. But I don't see much usage of that.

Implementation considerations

Should be fairly easy to implement. An equivalent would be needed in rclpy.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions