How can I identify the type of parameter event with set_on_parameters_set_callback()

asked 2019-08-12 03:46:08 -0500

xhuan28 gravatar image

updated 2019-08-12 04:09:34 -0500

According to the latest dashing code, it recommends us use set_on_parameters_set_callback() instead of register_param_change_callback(). I am wondering what the benefit it will bring to us, as I find it is hard to identify the type of parameter event(add or change). In contrast, I can easily know the type by ParameterEvent.msg if I use register_param_change_callback().

As mentioned in API docs:

Note that the callback is called when declare_parameter() and its variants are called, and so you cannot assume the parameter has been set before this callback, so when checking a new value against the existing one, you must account for the case where the parameter is not yet set.

However, my question is how can I handle the case where the parameter is not yet set. Is there any example available for reference?

edit retag flag offensive close merge delete