BehaviorTree.CPP icon indicating copy to clipboard operation
BehaviorTree.CPP copied to clipboard

How to use Parallel node

Open XingbangChan opened this issue 5 years ago • 6 comments

hi, could you please provide an example of using parallel node ,all of your doc only provide the squence, fallback control node example. thx(^o^)/

XingbangChan avatar May 05 '20 14:05 XingbangChan

I will... eventually

facontidavide avatar May 05 '20 17:05 facontidavide

+1 from me. I would like to use this feature with ROS.

gramss avatar May 24 '20 00:05 gramss

Yeah I am a bit confused here by what this 'parallel' means. Is this meant to be 'concurrent' or is there some magic that forces the use of a separate processor we assume to exist.

Otherwise I don't follow what parallel does that is different from corountines or reactiveSequence

albuckley avatar Oct 20 '21 10:10 albuckley

there is indeed a conceptual overlap with reactive nodes.

This is the reason why, if BT.CPP even reaches version 4.0, I will convert the reactive nodes into Parallel ones.

facontidavide avatar Oct 20 '21 13:10 facontidavide

Things are starting to make a little more sense reading into the code.

The comments in some of the bt_navigator plugin control nodes are helpful, explaining the execution flows such as the following from 'round_roboin_node':

 * |    A    |    B    |    C    |
 * --------------------------------
 * |  IDLE   |  IDLE   |  IDLE   |
 * | RUNNING |  IDLE   |  IDLE   |       - at first A gets ticked. Assume it returns RUNNING
 *                                                        - RoundRobin returns RUNNING and no other nodes are ticked.
 * | FAILURE | RUNNING |  IDLE   |  - A returns FAILURE so B gets ticked and returns RUNNING
 *                                                        - RoundRobin returns RUNNING and C is not ticked yet
 * | FAILURE | SUCCESS |  IDLE   |  - B returns SUCCESS, so RoundRobin halts all children and
 *                                                        - returns SUCCESS, next iteration will tick C.
 * | RUNNING |  IDLE   | FAILURE |  - C returns FAILURE, so RoundRobin circles and ticks A.
 *                                                        - A returns RUNNING, so RoundRobin returns RUNNING.

albuckley avatar Oct 20 '21 14:10 albuckley

Yes, at least the doc should refer to its name, as well as ParallelAll, to indicate its existence. I guess this is 3thd most important control node in my opinion. @albuckley https://arxiv.org/pdf/1709.00084.pdf

Lecrapouille avatar Dec 18 '23 15:12 Lecrapouille