Get parameter map (#575) (crystal-backport)#619
Conversation
* Add in the ability to get parameters in a map. Any parameters that have a "." in them will be considered to be part of a "map" (though they can also be get and set individually). This PR adds two new template specializations to the public node API so that it can take a map, and store the list of values (so setting the parameter with a name of "foo" and a key of "x" will end up with a parameter of "foo.x"). It also adds an API to get all of the keys corresponding to a prefix, and returing that as a map (so a get of "foo" will get all parameters that begin with "foo."). Note that all parameters within the map must have the same type, otherwise an rclcpp::ParameterTypeException will be thrown. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Fix style problems pointed out by uncrustify/cpplint. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Move tests for set_parameter_if_not_set/get_parameter map to rclcpp. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Rename get_parameter -> get_parameters. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Add in documentation from review. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Is there a specific use case / problem why this additional API is needed in Crystal? |
Yes, it's so that we can release ros2/teleop_twist_joy#8 into Crystal (once it has been approved/merged). |
| rclcpp::Parameter & parameter) const; | ||
|
|
||
| RCLCPP_PUBLIC | ||
| virtual |
There was a problem hiding this comment.
I think adding a virtual method breaks ABI
There was a problem hiding this comment.
Great catch. You are completely right; this does break ABI.
I've been trying to find a workaround here (essentially by bubbling the API up through the layers), but I haven't found anything that works yet. Any thoughts on ways to maybe workaround this (just for the Crystal branch)?
There was a problem hiding this comment.
Never mind, I found another way. Update to this PR coming.
| * \return false otherwise. | ||
| */ | ||
| RCLCPP_PUBLIC | ||
| virtual |
There was a problem hiding this comment.
Same comment about adding a virtual method
This way, we don't break ABI in crystal. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
|
Since this patch has changed from a backport to a modified patch with different logic can you please describe how the backported change is different than what is available on master and if you are planning to update the code on master to match this patch or if it should stay as it is. |
Right. For whatever reason when I did the original patch, I totally missed that list_parameters existed, which more-or-less provides the same functionality as get_parameters_by_prefix. The main benefit to using My view on it is that we should keep |
|
I am not convinced if it is worth introducing a new API into Crystal in a patch release which will not be present in master / future distros. |
But that's not what would happen here. On master, #575 added the following new APIs:
In Crystal, this PR would add the following new APIs:
So the APIs are compatible, its just that code that compiles against master would be able to call |
Do you mean If |
In my mind, the question is really whether we want to add |
* Zero-initialize message_info prior to taking Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Added test for timestamp presence Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * move message_info test to a new test file Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Add conditional timestamp test to normal subscriber test Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Remove dedicated timestamp test Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Use rmw_time_point_value_t instead of rmw_time_t Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Use rcutils for cross-platform compatibility. Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Style fix. Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * More style fix. Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * test fastrtps_dynamic properly; also cmake linter error Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Expect timestamps on cyclonedds as well Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com> * Distinguish received timestamp support. Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>
…the first one. (ros2#619) * Fix --topics flag for ros2 bag play being ignored for all bags after the first one. Signed-off-by: Aleksandr Rozhdestvenskii <hexonxons@gmail.com>
This is the backport of 99dd031 onto the crystal branch, since I'd like to get it into the 2nd crystal sync ros2/ros2#647 . There are no differences between this change and the one that was merged onto master, and this change only adds an API, so there is no API break.
Any parameters that have a "." in them will be considered to
be part of a "map" (though they can also be get and set
individually). This PR adds two new template specializations
to the public node API so that it can take a map, and store
the list of values (so setting the parameter with a name of
"foo" and a key of "x" will end up with a parameter of "foo.x").
It also adds an API to get all of the keys corresponding to
a prefix, and returing that as a map (so a get of "foo" will
get all parameters that begin with "foo."). Note that all
parameters within the map must have the same type, otherwise
an rclcpp::ParameterTypeException will be thrown.
Signed-off-by: Chris Lalancette clalancette@openrobotics.org
Signed-off-by: Chris Lalancette clalancette@openrobotics.org
Signed-off-by: Chris Lalancette clalancette@openrobotics.org
Signed-off-by: Chris Lalancette clalancette@openrobotics.org
Signed-off-by: Chris Lalancette clalancette@openrobotics.org