-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
RoundRobin in recovery is not reset when main branch success #4737
Comments
This seems to be the intended behavior as also evidenced by the documentation: https://docs.nav2.org/behavior_trees/overview/nav2_specific_nodes.html#control-roundrobin, but this is worth some discussion and potential behavior changes (I'd suggest reading this page before continuing, I myself refer to it in these questions). The text below is a bit of my own logical process to document how I came to my conclusions / suggestions for potential improvements. The control node in a BT regulates the execution of the child nodes it has access to (in this case, your RoundRobin control node has child nodes of Recoveries A, B, and C & your RecoveryNode has children of your main action and the RoundRobin). The result of the main action is not communicated to the RoundRobin directly as they are both children of the same parent node and are thus independent of each other to communicate statuses. Rather the handling of RoundRobin's state based on the state of the main action is on the logic of the parent they share, i.e. It sounds like you would like the So it seems that the behavior you want is really tied into the fact that So, I think perhaps adding The follow up question is: should we make this change in the I think ... possibly so, someone might want to maintain some state. But also, if the action is now successful, wouldn't it make sense to start again from the top - given the explicit intent of the Let me know what you think! We'd just need to add a sentence or two to that documentatation I linked above about that behavior & a couple of sentences in the migration guide explicitly telling people this has changed and we should be good to go. |
@tonynajjar what do you think? I know you're thinking about BTs these days |
Bug report
Required Info:
Steps to reproduce issue
In our Behavior Tree, we have a RecoveryNode with a RoundRobin in the recovery branch, structured as follows:
Expected behavior
We expect that each time the main action succeeds, the round_robin is reset. Therefore, the next time the main action fails, the first recovery action is triggered.
This behavior is illustrated by the following sequence:
1 - Main action: Fail
2 - Recovery A: Success
3 - Main action: Fail
4 - Recovery B: Success
5 - Main action: Success
... (later)
6 - Main action: Fail
7 - Recovery A is call
Actual behavior
Currently, we observe that the roundRobin is not reset when the main branch succeeds. Therefore, the next time the main action fails, the roundRobin continues incrementing the child index.
This behavior is illustrated by the following sequence:
1 - Main action: Fail
2 - Recovery A: Success
3 - Main action: Fail
4 - Recovery B: Success
5 - Main action: Success
... (later)
6 - Main action: Fail
7 - Recovery C is call
Additional information
After checking the code, we noticed that the only way to reset the roundRobin is by calling the halt function. However, in the BehaviorTreeCPP library, the halt function is only called when the target node is in the RUNNING state (which seems consistent with the function name). The issue is that the Recovery node does not call the roundRobin's halt function when it is in the RUNNING state.
My question, then, is: Is this the intended behavior? And if so, do you have any suggestions on how to implement the expected behavior sequence?
The text was updated successfully, but these errors were encountered: