-
Notifications
You must be signed in to change notification settings - Fork 466
Fix issue when a callback returns false, other callbacks are not triggered #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…gered Signed-off-by: Steve Macenski <[email protected]>
I will say that the current behavior is by design (though we can consider changing the design). The thinking here is that there really should be no state in these particular callbacks; they should really only validate whether the new parameter value is valid or not. That's why the return value is merely a boolean. That said, maybe there is a use-case here. Can you explain more fully what your use is? |
Its being reported to me because some algorithms are sensitively logging/ This is a bug in the object (that I'm about to fix once I finish writing this up) since I agree with you that that object shouldn't be My belief is that the state of one callback shouldn't impact the allowable triggering of other callbacks. Otherwise, the ordering of the registration of the dynamic parameter callbacks has a meaningful impact on the system's configurations in these situations (where some have been called and possibly stored the new value; others haven't been; and we don't know which is which). To resolve that, I think we'd need to set priority levels to trigger the calls or allow the user explicitly set the ordering, but I think its better to just call them all so that the state is always known and consistent. |
I think this is the major disconnect. These callbacks absolutely should not be changing state, for exactly the reason listed here. To give a more concrete example, suppose you have callbacks A, B, and C (registered in that order). A parameter change comes in, which calls A. A accepts the change, and updates some internal state based on that. B accepts the change. Then C rejects the change, which causes the parameter database in the node to not be updated. At this point, you have a completely inconsistent system. Some internal state has been changed because A accepted the change, but a Even if we were to accept this change, the situation above will still arise, because the internal node database still won't take the change (since it has been rejected by at least one callback). So I'm not sure that this is a net win. For what it is worth, if you do want to make internal state changes when parameters change, you can use the |
Sure but there are alot of examples of this, especially for applications that are attempting to have ROS wrappers around core algorithms instead of letting ROS be down to the algorithm level. We want often for member variables for parameters to be updated here because we don't use Ex.
I understand that That would resolve the need for this PR, I agree.
With that said, I would consider this to be a net win even with this all considered because of historical legacy of people not making the changes / aware of the change with the I leave it to you about whether to move forward or close this PR - I appreciate the time 😄 |
Nav2 ticket for visibility: ros-navigation/navigation2#4907 |
Closing this one out as the changes will be applied downstream. Edit: Forgot to add that we discussed this during our triage meeting and agreed that it's best to update nav2 to rely on post_set_parameters_callbacks. |
Sure thing 🙂 |
As brought up to me by a Nav2 contributor, when a dynamic parameter callback returns false because it can't / doesn't want to deal with the parameter, it prevents all other callbacks from triggering because any returned false. For example, we have nodes with multiple dynamic callbacks registered for different composed objects to adjust their respective parameters.
I think this is a bug because each of the callbacks should be independent and whos state call shouldn't be dependent on other callbacks, who has no method of reordering or setting priority.
Instead, if any return false, we store it and set it at the end, but give all callbacks a chance to trigger. This results in the same behavior, but all callbacks are processed.