Is there any way to gray out/ disable a dynamic reconfigure parameter? I would like to freeze certain parameters based on the value of other parameters.
Here is a related question but without an answer.
EDIT: I did not see the ros-noetic tag at first. Below answer is for ROS 2.
You can easily define rules on parameters, e.g.:
You just need to define a
The names of these callbacks are imo. a bit ill-chosen; this is what they are intended for:
For an example, see the
SetParametersCallback node in the demos repository.
The API has no mechanism for a ros node to indicate to a dynamic-reconfigure client that a field is "disabled".
However, for the node being reconfigured, internally it can ignore the new value that is passed in.
Now ideally you'd be able to "correct" the field value sent to all the clients if it's not valid. For c++, I don't see a method to do that. But in python, the server-side callback is supposed to return an updated config, so I assume you can use that. (I've never tried to do this myself.)