rcl
rcl copied to clipboard
Parse parameter descriptors in yaml
This PR addresses the feature request in #481, namely parsing parameter descriptor keys in the yaml file. This feature will enable parameter descriptors to be added into nodes at run-time.
Overview of additions are:
- New struct types to contain parameter descriptor information (in alignment with the
ParameterDescriptor.msg
)-
rcl_param_descriptor_t
,rcl_node_params_descriptor_t
- descriptor keys are compared for assignment into struct
-
- Added map level for
MAP_PARAM_DESCRIPTORS_LVL
to parse descriptors- new map level is triggered when the
'parameter__descriptors'
key is parsed by the yaml event - some added API to handle descriptor keys/values
- new map level is triggered when the
- Independent allocation/access to parameters and parameter descriptors in the
params_t
struct- each node will have its list of parameters as well as descriptors
- parameter descriptors may be added in yaml file without corresponding parameter or mixed
The proposed syntax for this PR is:
node1:
ros__parameters:
foo: 42
bar: 25.0
param1: 10
parameter__descriptors:
param1:
type: 2
min_value: 5
max_value: 100
step: 5
read_only: false
description: "int parameter"
additional_constraints: "only multiples of 5"
param2:
min_value: 1.0
max_value: 10.0
description: "double parameter"
I've made accompanying changes in rclcpp to extract the parameter descriptors struct into a ParameterDescriptor.msg
which will override when calling declare_parameter
(or if the overrides are automatically declared). I will submit that PR to the rclcpp repo soon, though this is a pre-requisite.
@bpwilcox are you planning to circle back on this?
@hidmic Yes, I'd started some local changes before the new year but had been preoccupied since. Most notably, as suggested I'm intending to move the ros__parameters and ros__parameter_descriptors to be at sibling levels. With regards to removing parameter names from the descriptor type, I'm not sure if that is worthwhile as it breaks some of the intended code similarity I'd added intentionally before. I'll try to get an update in next week or so.
@bpwilcox do you still plan on submitting changes? Or shall I close this patch?
@bpwilcox do you still plan on submitting changes? Or shall I close this patch?
Yes, I believe I should have some more cycles to work on this in the near future.
@hidmic I've re-done this work and addressed feedback on a separate branch. It was easier and cleaner than trying to resolve all of the merge conflicts considering the many changes since I've last touched this PR. Would it be better to close this PR and open a new one, or to force push/reset that branch onto this one?
@mjeronimo I reset this branch with commits from my revised branch. This way the previous PR comments can be referenced. Maybe we can get some re-reviews of this work while I push ahead in this next month on the rclcpp layer in https://github.com/ros2/rclcpp/pull/909
@bpwilcox friendly ping
Thanks for your feedback @hidmic I will be addressing your feedback soon!
Hey @hidmic Could you take another pass through this review since my latest commits?
Hi, I'm looking forward to use parameter descriptors in the YAML file. What is the status of this PR?
@bpwilcox are you planning to work on this?