Interrupting and resuming execution of tree. #635
-
Hi everyone, I'm working with a behavior tree where an action issues a "GoToPosition" command once, and then continually returns a 'running' status until the agent either reaches the desired position or a timeout occurs. I'm trying to figure out the best way to implement an interrupt-resume logic. Let's say there's an external failsafe mechanism that can override the last command from the behavior tree in case of danger. Once the danger is avoided, how do I inform the behavior tree that there was an interruption and that the last command needs to be reissued? One thought is to have the action fail and restart tree from the beginning. But I'm wondering if there's a way to reset the state of the node back to 'idle' and then resume execution from there? Essentially, I'm looking for a way to smoothly transition between the running tree and failsafe/manual operation states. Any insights would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good news: there is a way. You can implement this with your overloaded You can save your state/mission when the node is halted and the next time the node is ticked, you resume operations. |
Beta Was this translation helpful? Give feedback.
Good news: there is a way.
Bad news: YOU are responsible for the implementation.
You can implement this with your overloaded
halt()
method.You can save your state/mission when the node is halted and the next time the node is ticked, you resume operations.