Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filter chain configuration parameter loading #69

Open
wants to merge 3 commits into
base: ros2
Choose a base branch
from

Conversation

paucarrecardona
Copy link

Trying to use filters_demo_launch.py which has the following (filters)[https://github.com/ANYbotics/grid_map/blob/ros2/grid_map_demos/config/filters_demo_filter_chain.yaml] it fails to load with a runtime error.

The PR allows loading of the configuration. It has also been tested with other configuration parameters successfully.

@jonbinney
Copy link
Contributor

Could you look through CI and address the failing tests? It looks like cpplint is failing, at least on humble.

@paucarrecardona
Copy link
Author

@jonbinney basically there is no longer "parameter redeclaration" and no default values. It creates new parameters with every new filter.
Without the changes it crashes with

terminate called after throwing an instance of 'rclcpp::exceptions::InvalidParameterTypeException'
   what():  parameter 'filters.filter1.name' has invalid type: cannot undeclare an statically typed parameter

// Must be dynamically typed because later we undeclare it and redeclare
// it read-only, but statically typed params cannot be undeclared.
name_desc.dynamic_typing = true;
node_params->declare_parameter(name_desc.name, rclcpp::PARAMETER_STRING);
rcl_interfaces::msg::ParameterDescriptor type_desc;
Copy link

@meyerj meyerj Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type_desc and name_desc are declared and populated, but then unused besides the name. I suggest to use the declare_parameter() overloads that accept a rcl_interfaces::msg::ParameterDescriptor, same as before.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or directly pass the name only without the extra descriptor declarations, if the default descriptors will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants