Repository navigation
test: a reactive node must not restart its RUNNING child - #1258
Merged
Merged
Conversation
Pin the behavior of master that a fix for #1031 must keep: - In ReactiveSequence / ReactiveFallback, the children before the RUNNING one are re-ticked on every tick. When they complete immediately (a check implemented as a StatefulActionNode or a CoroActionNode), the RUNNING child keeps running: it is neither halted nor started again. - A control node that keeps several children running at once, like nav2's PipelineSequence, does not get them halted when one of them starts. All three tests pass on master and fail on the current #1217 branch (the RUNNING action is started 5 times and halted 4 times in 5 ticks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Quchaosheng
added a commit
to Quchaosheng/BehaviorTree.CPP
that referenced
this pull request
Oct 28, 2026
The previous version halted the running siblings from inside the asynchronous node, whenever it left IDLE. That cannot be made to work: before onStart() runs, a check that will return SUCCESS and a new action that will keep running look identical, so the rule has to guess from the shape of the tree. It also misses ThreadedAction, whose executeTick() is final and does not run the body of TreeNode::executeTick(). Replace it with a decorator that answers the question where the answer is known. Preempt wraps the action that starts the new branch; on its first tick, before ticking its child, it halts the RUNNING child of every reactive ancestor it is not itself inside. Children of a Parallel are not touched, since that node is allowed to keep several of them RUNNING. ReactiveSequence and ReactiveFallback now share a ReactiveControlNode base that owns the running child index and can let go of it on request, so the index stays consistent with the child that is actually RUNNING. The base adds state and non-virtual members only: no existing vtable changes, and the parent pointer lives in the existing PImpl. Tests: both fallbacks, an action inside a SubTree, a ThreadedAction, and a Parallel inside the new branch whose children must keep running together. The three cases pinned by BehaviorTree#1258 pass, as does the rest of the suite (591 passed, 2 skipped). Suggested-by: Davide Faconti <davide.faconti@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds three tests pinning behavior that master already has and that a fix for #1031 must keep. Tests only, no change to the library.
ReactiveSequence_CompletedSiblingsDoNotRestartRunningChildandReactiveFallback_CompletedSiblingsDoNotRestartRunningChild: the children before the RUNNING one are re-ticked on every tick. When they complete immediately (a check implemented as aStatefulActionNodeor aCoroActionNode), the RUNNING child keeps running: it is neither halted nor started again.ConcurrentChildrenOfCustomControlAreNotHalted: a control node that keeps several children running at once, like nav2'sPipelineSequence, doesn't get them halted when one of them starts.All three pass on master. Applied on top of the current #1217 branch, all three fail: the RUNNING action is started 5 times and halted 4 times in 5 ticks.
🤖 Generated with Claude Code