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.


2 Answers 2


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

  • Disallow a parameter to be changed,
  • Automatically also change other parameters when a parameter is changed,
  • Define values or ranges to which a parameter must comply,
  • Etc.

You just need to define a pre_set-, on_set- and/or post_set_parameters_callback callback.

The names of these callbacks are imo. a bit ill-chosen; this is what they are intended for:

  • pre_set_parameters_callback:

    • Allows to modify upcoming parameter changes by changing, adding or removing entries of the Parameter list,
    • Should not alter the state of the node,
  • on_set_parameters_callback:

    • Allows to inspect the upcoming change to the parameters and explicitly approve or reject the change. If the change is rejected, no parameters are changed.
    • Should not alter the state of the node,
  • post_set_parameters_callback:

    • Allows to react to parameter changes that have been approved,
    • Can alter the state of the node.

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.