kobuki-base / kobuki_ros

ROS2 runtime libraries, nodes and launchers for the Kobuki
46 stars 27 forks source link

Switch to parameter events for parameter changes #29

Closed clalancette closed 2 years ago

clalancette commented 2 years ago

It turns out that we should not be using parameter change callbacks to update internal variables. That's because parameter change callbacks are really meant to reject parameters that are out-of-bounds, and they can be chained. That means that if a later callback in the chain were to reject the change, the parameter database would not have the update, but we would have updated internal state based on it. That leads to an inconsistent system.

Instead, use the parameter events interface to look at changes to the parameters. This is called after all of the parameter change callbacks have happened, so we know for sure that this update has taken place.

clalancette commented 2 years ago

I'm just going to go ahead and merge this to keep moving. As usual, feel free to take a look and leave comments at any time, I'm happy to revisit.