ros2 / ros2/rclcpp

add_on_set_parameters_callback callback takes vector of parameters but only returns a single SetParametersResult

Open
#1,550 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

more-information-needed question
Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

https://github.com/ros2/rclcpp/blob/d9377dc740d4424d0740131e79cfdb2a31dcf87c/rclcpp/include/rclcpp/node_interfaces/node_parameters_interface.hpp#L40-L46

SetParameters
# A list of parameters to set.
Parameter[] parameters

---
# Indicates whether setting each parameter succeeded or not and why.
SetParametersResult[] results
SetParametersResult
# A true value of the same index indicates that the parameter was set
# successfully. A false value indicates the change was rejected.
bool successful

# Reason why the setting was either successful or a failure. This should only be
# used for logging and user interfaces.
string reason

This is probably already a known issue. It seems like there is a mismatch between this interface and the message/service interface in the rcl_interfaces repo. In my testing on foxy it seems that when you send it a vector of parameters to set it calls the callback once for each one (each time with the vector containing only one parameter).

Because this is an interface issue it'll probably have to be fixed over major releases to avoid breaking the most code. What I think should change is the callback interface should return a vector of SetParametsResult to match the service interface.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the callback declaration at rclcpp/include/rclcpp/node_interfaces/node_parameters_interface.hpp#L40-L46 and compare it with the SetParameters service and SetParametersResult definitions in rcl_interfaces. Trace how a vector of parameters is passed on Foxy, then determine the compatibility and release implications; done means the callback and service semantics are consistently specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.