personalrobotics / ada_feeding

Robot-assisted feeding demos and projects for the ADA robot
4 stars 4 forks source link

Allow parameter changes while keeping defaults #146

Closed amalnanavati closed 10 months ago

amalnanavati commented 10 months ago

Description

This PR allows us to change non-read-only parameters for create_action_server, have them persist across runs of ada_feeding_launch.xml, but still maintain access to the original parameters (e.g., in case we have to revert them). In practice, only the tree_kwargs are non-read-only.

It achieves this through the following:

  1. Parameters for create_action_server are not defined in two files: (a) ada_feeding_action_servers_default.yaml and (b) ada_feeding_action_servers_current.yaml.
    1. All parameters but the ones for the WatchdogListener are placed under the default namespace in ada_feeding_action_servers_default.yaml.
    2. ada_feeding_action_servers_current.yaml contains parameters in the current namespace: (a) current.overridden_parameters which is a list of the parameters that are overridden, and (b) the values for each of those parameters.
  2. On the node side, all parameters in the default' namespace are declared as read-only. However, for the ones that the node wants to make over-writeable, it declares a read-write version of that parameter in thecurrent` namespace.
  3. When the node receives a set parameter request for a parameter in the current namespace, it does the following:
    1. Checks (e.g., that the parameter type is correct)
    2. Update the parameter. In particularly, since the only non-read-only parameters are tree_kwargs, it re-creates the tree with the new kwargs.
    3. Write the updated overridden parameters to ada_feeding_action_servers_current.yaml in the share folder.

Testing procedure

This was tested in sim.

Before opening a pull request

Before Merging