368
368
< ul class ="md-nav__list ">
369
369
370
370
< li class ="md-nav__item ">
371
- < a href ="#sequence " title ="Sequence " class ="md-nav__link ">
372
- Sequence
371
+ < a href ="#first-controlnode- sequence " title ="First ControlNode: Sequence " class ="md-nav__link ">
372
+ First ControlNode: Sequence
373
373
</ a >
374
374
375
375
</ li >
382
382
</ li >
383
383
384
384
< li class ="md-nav__item ">
385
- < a href ="#fallback " title ="Fallback " class ="md-nav__link ">
386
- Fallback
385
+ < a href ="#second-controlnode- fallback " title ="Second ControlNode: Fallback " class ="md-nav__link ">
386
+ Second ControlNode: Fallback
387
387
</ a >
388
388
389
389
</ li >
596
596
< ul class ="md-nav__list ">
597
597
598
598
< li class ="md-nav__item ">
599
- < a href ="#sequence " title ="Sequence " class ="md-nav__link ">
600
- Sequence
599
+ < a href ="#first-controlnode- sequence " title ="First ControlNode: Sequence " class ="md-nav__link ">
600
+ First ControlNode: Sequence
601
601
</ a >
602
602
603
603
</ li >
610
610
</ li >
611
611
612
612
< li class ="md-nav__item ">
613
- < a href ="#fallback " title ="Fallback " class ="md-nav__link ">
614
- Fallback
613
+ < a href ="#second-controlnode- fallback " title ="Second ControlNode: Fallback " class ="md-nav__link ">
614
+ Second ControlNode: Fallback
615
615
</ a >
616
616
617
617
</ li >
@@ -651,20 +651,23 @@ <h1 id="introduction-to-bts">Introduction to BTs</h1>
651
651
< p > Unlike a Finite State Machine, a Behaviour Tree is a < strong > tree of hierarchical nodes</ strong >
652
652
that controls the flow of decision and the execution of "tasks" or, as we
653
653
will call them further, "< strong > Actions</ strong > ".</ p >
654
- < p > The < strong > leaves</ strong > of the tree are the actual commands, ie.e the place where
654
+ < p > The < strong > leaves</ strong > of the tree are the actual commands, i.e. the place where
655
655
our coordinating component interacts with the rest of the system.</ p >
656
656
< p > For instance, in a service-oriented architecture, the leaves would contain
657
- the "client" code that triggers an action.</ p >
657
+ the "client" code that communicate with the "server" that performs the
658
+ operation.</ p >
659
+ < p > < img alt ="Leaf To Component Communication " src ="../images/LeafToComponentCommunication.png " /> </ p >
658
660
< p > The other nodes of the tree, those which are not leaves, control the
659
661
"flow of execution".</ p >
660
662
< p > To better understand how this flow takes place , imagine a signal, that we will further
661
- call "< strong > tick</ strong > " that is executed at the < strong > root</ strong > of the tree and propagates through
663
+ call "< strong > tick</ strong > "; it is executed at the < strong > root</ strong > of the tree and propagates through
662
664
the branches until it reaches one or multiple leaves.</ p >
663
- < p > The result of a tick can be either:</ p >
665
+ < p > The < code > tick() </ code > callback returns a < code > NodeStatus </ code > that will be either:</ p >
664
666
< ul >
665
667
< li > < strong > SUCCESS</ strong > </ li >
666
668
< li > < strong > FAILURE</ strong > </ li >
667
669
< li > < strong > RUNNING</ strong > </ li >
670
+ < li > < strong > IDLE</ strong > </ li >
668
671
</ ul >
669
672
< p > The first two, as their names suggest, inform their parent that their operation
670
673
was a success or a failure.</ p >
@@ -689,7 +692,7 @@ <h2 id="learn-by-example">Learn by example</h2>
689
692
examples. For the sake of simplicity we will not take into account what happens
690
693
when an action returns RUNNING.</ p >
691
694
< p > We will assume that each Action is executed atomically and synchronously.</ p >
692
- < h3 id ="sequence "> Sequence</ h3 >
695
+ < h3 id ="first-controlnode- sequence "> First ControlNode: Sequence</ h3 >
693
696
< p > Let's illustrate how a BT works using the most basic and frequently used
694
697
ControlNode: the < a href ="../SequenceNode/ "> SequenceNode</ a > .</ p >
695
698
< p > The children of a ControlNode are always < strong > ordered</ strong > ; it is up to the ControlNode
@@ -727,7 +730,7 @@ <h3 id="sequence">Sequence</h3>
727
730
< p > < strong > But</ strong > there is an error. Can you find it?</ p >
728
731
< details class ="warning "> < summary > Exercise: find the bug! Expand to read the answer.</ summary > < p > If < strong > DoorOpen</ strong > returns FAILURE, we have the desired behaviour.
729
732
But if it returns SUCCESS, the left branch fails and the entire Sequence
730
- is interrupted. </ p > </ details > < h3 id ="fallback "> Fallback</ h3 >
733
+ is interrupted. </ p > </ details > < h3 id ="second-controlnode- fallback "> Second ControlNode: Fallback</ h3 >
731
734
< p > < a href ="../FallbackNode/ "> FallbackNodes</ a > , known also as < strong > "Selector"</ strong > ,
732
735
are nodes that can express, as the name suggests, fallback strategies,
733
736
ie. what to do next if a child returns FAILURE.</ p >
0 commit comments