Skip to content

Mismatch between documentation and implementation of rclcpp::ParameterEventHandler::get_parameter_from_event #1921

@viccie30

Description

@viccie30

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • 9.2.0-1focal.20220211.031858
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

Call rclcpp::ParameterEventHandler::get_parameter_from_event(const rcl_interfaces::msg::ParameterEvent & event, const std::string parameter_name, const std::string node_name) for a non-existent parameter.

Expected behavior

According to

* The user is responsible to check if the returned parameter has been properly assigned.
* By default, if the requested parameter is not found in the event, the returned parameter
* has parameter value of type rclcpp::PARAMETER_NOT_SET.
, if the requested parameter is not found, a not-set Parameter is returned.

Actual behavior

The function throws an exception and does not return normally. See

if (!get_parameter_from_event(event, p, parameter_name, node_name)) {
throw std::runtime_error(
"Parameter '" + parameter_name + "' of node '" + node_name +
"' is not part of parameter event");
}
.

Additional information

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions