rcl icon indicating copy to clipboard operation
rcl copied to clipboard

Parse parameter descriptors in yaml

Open bpwilcox opened this issue 5 years ago • 11 comments

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
  • 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 avatar Oct 25 '19 23:10 bpwilcox

@bpwilcox are you planning to circle back on this?

hidmic avatar Jan 07 '20 15:01 hidmic

@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 avatar Jan 08 '20 01:01 bpwilcox

@bpwilcox do you still plan on submitting changes? Or shall I close this patch?

hidmic avatar Feb 12 '21 21:02 hidmic

@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.

bpwilcox avatar Feb 19 '21 21:02 bpwilcox

@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?

bpwilcox avatar Mar 23 '21 04:03 bpwilcox

@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 avatar Mar 29 '21 23:03 bpwilcox

@bpwilcox friendly ping

hidmic avatar Sep 28 '21 22:09 hidmic

Thanks for your feedback @hidmic I will be addressing your feedback soon!

bpwilcox avatar Oct 14 '21 16:10 bpwilcox

Hey @hidmic Could you take another pass through this review since my latest commits?

bpwilcox avatar Jan 31 '22 20:01 bpwilcox

Hi, I'm looking forward to use parameter descriptors in the YAML file. What is the status of this PR?

Shubham2S avatar May 28 '22 14:05 Shubham2S

@bpwilcox are you planning to work on this?

fujitatomoya avatar May 31 '22 21:05 fujitatomoya