Skip to content
New issue

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

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

Already on GitHub? # to your account

Support empty parameter list #227

Open
pele1410 opened this issue Nov 13, 2024 · 0 comments
Open

Support empty parameter list #227

pele1410 opened this issue Nov 13, 2024 · 0 comments

Comments

@pele1410
Copy link

My goal is to be able to provide the infrastructure for a parameter library without requiring actual parameters. This could be because I'm stubbing out a class early in development or if I am just wanting to be consistent and provide an easy place for future work to add to.

Something like:

foo::bar_params: []

I would expect then that accessing the params with get_params() returns an empty list:

param_listener_ = std::make_shared<bar_params::ParamListener>(get_node());
params_ = param_listener_->get_params(); 
// params _is an empty list

The current workaround is to provide a dummy value:

foo::bar_params:
  dummy:
    type: int

but this just leads to cruft that I'd rather not have.
I tried to use the none type to not actually generate the dummy param, but this doesn't compile in C++ due to an unused-variable warning.

foo::bar_params:
  dummy:
    type: none
bar_params.hpp: In member function ‘rcl_interfaces::msg::SetParametersResult foo::bar_params::ParamListener::update(const std::vector<rclcpp::Parameter>&)’:
bar_params.hpp:135:24: error: unused variable ‘param’ [-Werror=unused-variable]
  135 |       for (const auto &param: parameters) {
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant