Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8f693f

Browse files
author
Davide Faconti
committed
Deployed 2a2c34c with MkDocs version: 1.0.4
1 parent 6673038 commit b8f693f

File tree

10 files changed

+139
-111
lines changed

10 files changed

+139
-111
lines changed

BT_basics/index.html

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@
360360
</li>
361361

362362
<li class="md-nav__item">
363-
<a href="#learn-by-example" title="Learn by example" class="md-nav__link">
364-
Learn by example
363+
<a href="#examples" title="Examples" class="md-nav__link">
364+
Examples
365365
</a>
366366

367367
<nav class="md-nav">
@@ -588,8 +588,8 @@
588588
</li>
589589

590590
<li class="md-nav__item">
591-
<a href="#learn-by-example" title="Learn by example" class="md-nav__link">
592-
Learn by example
591+
<a href="#examples" title="Examples" class="md-nav__link">
592+
Examples
593593
</a>
594594

595595
<nav class="md-nav">
@@ -656,13 +656,20 @@ <h1 id="introduction-to-bts">Introduction to BTs</h1>
656656
<p>For instance, in a service-oriented architecture, the leaves would contain
657657
the "client" code that communicate with the "server" that performs the
658658
operation.</p>
659+
<p>In the following example, we can see two Actions executed in a sequence,
660+
<code>DetectObject</code> and <code>GraspObject</code>.</p>
659661
<p><img alt="Leaf To Component Communication" src="../images/LeafToComponentCommunication.png" /></p>
660-
<p>The other nodes of the tree, those which are not leaves, control the
662+
<p>The other nodes of the tree, those which are <strong>not leaves</strong>, control the
661663
"flow of execution".</p>
662-
<p>To better understand how this flow takes place , imagine a signal, that we will further
663-
call "<strong>tick</strong>"; it is executed at the <strong>root</strong> of the tree and propagates through
664-
the branches until it reaches one or multiple leaves.</p>
665-
<p>The <code>tick()</code> callback returns a <code>NodeStatus</code> that will be either:</p>
664+
<p>To better understand how this control flow takes place , imagine a signal
665+
called "<strong>tick</strong>"; it is executed at the <strong>root</strong> of the tree and it propagates
666+
through the branches until it reaches one or multiple leaves.</p>
667+
<div class="admonition note">
668+
<p class="admonition-title">Note</p>
669+
<p>The word <strong>tick</strong> will be often used as a <em>verb</em> (to tick / to be ticked) and it means</p>
670+
<p>"To invoke the callback <code>tick()</code> called of a <code>TreeNode</code>".</p>
671+
</div>
672+
<p>Then a <code>TreeNode</code> is ticked, it returns a <code>NodeStatus</code> that can be either:</p>
666673
<ul>
667674
<li><strong>SUCCESS</strong></li>
668675
<li><strong>FAILURE</strong></li>
@@ -675,7 +682,7 @@ <h1 id="introduction-to-bts">Introduction to BTs</h1>
675682
and they needs more time to return a valid result.</p>
676683
<p>This C++ library provides also the status <strong>IDLE</strong>; it means that the node is ready to
677684
start.</p>
678-
<p>The result of a node is propagated back to the parent, that will decide
685+
<p>The result of a node is propagated back to its parent, that will decide
679686
which child should be ticked next or will return a result to its own parent.</p>
680687
<h2 id="types-of-nodes">Types of nodes</h2>
681688
<p><strong>ControlNodes</strong> are nodes which can have 1 to N children. Once a tick
@@ -687,7 +694,7 @@ <h2 id="types-of-nodes">Types of nodes</h2>
687694
they are always atomic, i.e. they must not return RUNNING. They should not
688695
alter the state of the system.</p>
689696
<p><img alt="UML hierarchy" src="../images/TypeHierarchy.png" /></p>
690-
<h2 id="learn-by-example">Learn by example</h2>
697+
<h2 id="examples">Examples</h2>
691698
<p>To better understand how a BehaviorTrees work, let's focus on some practical
692699
examples. For the sake of simplicity we will not take into account what happens
693700
when an action returns RUNNING.</p>
@@ -703,10 +710,14 @@ <h3 id="first-controlnode-sequence">First ControlNode: Sequence</h3>
703710
<ul>
704711
<li>If a child returns SUCCESS, tick the next one.</li>
705712
<li>If a child returns FAILURE, then no more children are ticked and the Sequence returns FAILURE.</li>
706-
<li>If all the children return SUCCESS, then the Sequence returns SUCCESS too.</li>
713+
<li>If <strong>all</strong> the children return SUCCESS, then the Sequence returns SUCCESS too.</li>
707714
</ul>
708-
<details class="warning"><summary>Exercise: find the bug! Expand to read the answer.</summary><p>If the action <strong>GrabBeer</strong> fails, the door of the
709-
fridge would remain open, since the last action <strong>CloseDoor</strong> is skipped.</p></details><h3 id="decorators">Decorators</h3>
715+
<div class="admonition warning">
716+
<p class="admonition-title">Have you spotted the bug?</p>
717+
<p>If the action <strong>GrabBeer</strong> fails, the door of the
718+
fridge would remain open, since the last action <strong>CloseFridge</strong> is skipped.</p>
719+
</div>
720+
<h3 id="decorators">Decorators</h3>
710721
<p>The goal of a <a href="../DecoratorNode/">DecoratorNode</a> is either to transform the result it received
711722
from the child, to terminate the child,
712723
or repeat ticking of the child, depending on the type of Decorator.</p>
@@ -727,10 +738,15 @@ <h3 id="first-controlnode-sequence">First ControlNode: Sequence</h3>
727738
</pre></div>
728739

729740

730-
<p><strong>But</strong> there is an error. Can you find it?</p>
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.
741+
<p>But...</p>
742+
<div class="admonition warning">
743+
<p class="admonition-title">Have you spotted the bug?</p>
744+
<p>If <strong>DoorOpen</strong> returns FAILURE, we have the desired behaviour.
732745
But if it returns SUCCESS, the left branch fails and the entire Sequence
733-
is interrupted. </p></details><h3 id="second-controlnode-fallback">Second ControlNode: Fallback</h3>
746+
is interrupted.</p>
747+
<p>We will see later how we can improve this tree. </p>
748+
</div>
749+
<h3 id="second-controlnode-fallback">Second ControlNode: Fallback</h3>
734750
<p><a href="../FallbackNode/">FallbackNodes</a>, known also as <strong>"Selector"</strong>,
735751
are nodes that can express, as the name suggests, fallback strategies,
736752
ie. what to do next if a child returns FAILURE.</p>
@@ -743,27 +759,31 @@ <h3 id="first-controlnode-sequence">First ControlNode: Sequence</h3>
743759
<p>In the next example, you can see how Sequence and Fallbacks can be combined:</p>
744760
<p><img alt="FallbackNodes" src="../images/FallbackBasic.png" /> </p>
745761
<blockquote>
746-
<p>In the door open?</p>
747-
<p>I not, try to open the door.</p>
762+
<p>Is the door open?</p>
763+
<p>If not, try to open the door.</p>
748764
<p>Otherwise, if you have a key, unlock and open the door.</p>
749765
<p>Otherwise, smash the door. </p>
750-
<p>If any of these actions succeeded, then enter the room.</p>
766+
<p>If <strong>any</strong> of these actions succeeded, then enter the room.</p>
751767
</blockquote>
752768
<h3 id="fetch-me-a-beer-revisited">"Fetch me a beer" revisited</h3>
753-
<p>We can now improve the "Fetch Me a Beer" example, which leaves the door open
754-
if the beer was not there.</p>
755-
<p>We use the color "green" to represent nodes which will return
769+
<p>We can now improve the "Fetch Me a Beer" example, which left the door open
770+
if the beer was not inside the fridge.</p>
771+
<p>We use the color "green" to represent nodes which return
756772
SUCCESS and "red" for those which return FAILURE. Black nodes are never executed. </p>
757773
<p><img alt="FetchBeer failure" src="../images/FetchBeerFails.png" /></p>
758774
<p>Let's create an alternative tree that closes the door even when <strong>GrabBeer</strong>
759775
returns FAILURE.</p>
760776
<p><img alt="FetchBeer failure" src="../images/FetchBeer.png" /></p>
761-
<p>Both the trees will close the door of the fridge, eventually, but:</p>
777+
<p>Both these trees will close the door of the fridge, eventually, but:</p>
762778
<ul>
763-
<li>the tree on the <strong>left</strong> side will always return SUCCESS if we managed to
764-
open and close the fridge.</li>
765-
<li>the tree on the <strong>right</strong> side will return SUCCESS if the beer was there,
766-
FAILURE otherwise.</li>
779+
<li>
780+
<p>the tree on the <strong>left</strong> side will always return SUCCESS if we managed to
781+
open and close the fridge.</p>
782+
</li>
783+
<li>
784+
<p>the tree on the <strong>right</strong> side will return SUCCESS if the beer was there,
785+
FAILURE otherwise.</p>
786+
</li>
767787
</ul>
768788
<p>Everything works as expected if <strong>GrabBeer</strong> returns SUCCESS.</p>
769789
<p><img alt="FetchBeer success" src="../images/FetchBeer2.png" /></p>

index.html

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,15 @@
325325
</li>
326326

327327
<li class="md-nav__item">
328-
<a href="#the-problem" title="The problem" class="md-nav__link">
329-
The problem
328+
<a href="#what-is-a-behavior-tree" title="What is a Behavior Tree?" class="md-nav__link">
329+
What is a Behavior Tree?
330330
</a>
331331

332332
</li>
333333

334334
<li class="md-nav__item">
335-
<a href="#what-is-a-behavior-tree" title="What is a Behavior Tree?" class="md-nav__link">
336-
What is a Behavior Tree?
335+
<a href="#ok-but-why-do-we-need-behaviortrees-or-fsm" title=""Ok, but WHY do we need BehaviorTrees (or FSM)?"" class="md-nav__link">
336+
"Ok, but WHY do we need BehaviorTrees (or FSM)?"
337337
</a>
338338

339339
</li>
@@ -557,15 +557,15 @@
557557
</li>
558558

559559
<li class="md-nav__item">
560-
<a href="#the-problem" title="The problem" class="md-nav__link">
561-
The problem
560+
<a href="#what-is-a-behavior-tree" title="What is a Behavior Tree?" class="md-nav__link">
561+
What is a Behavior Tree?
562562
</a>
563563

564564
</li>
565565

566566
<li class="md-nav__item">
567-
<a href="#what-is-a-behavior-tree" title="What is a Behavior Tree?" class="md-nav__link">
568-
What is a Behavior Tree?
567+
<a href="#ok-but-why-do-we-need-behaviortrees-or-fsm" title=""Ok, but WHY do we need BehaviorTrees (or FSM)?"" class="md-nav__link">
568+
"Ok, but WHY do we need BehaviorTrees (or FSM)?"
569569
</a>
570570

571571
</li>
@@ -605,42 +605,14 @@ <h2 id="about-this-library">About this library</h2>
605605
to visualize, record, replay and analyze state transitions.</li>
606606
</ul>
607607
<p><img alt="ReadTheDocs" src="images/ReadTheDocs.png" /> </p>
608-
<h2 id="the-problem">The problem</h2>
609-
<p>Many software systems, being robotics a notable example, are inherently
610-
complex.</p>
611-
<p>The usual approach to manage complexity, heterogeneity and scalability is to
612-
use the concept of
613-
<a href="https://en.wikipedia.org/wiki/Component-based_software_engineering">Component Base Software Engineering</a>.</p>
614-
<p>Any existing middleware for robotics took this approach either informally or formally,
615-
being <a href="http://www.ros.org">ROS</a>, <a href="http://www.yarp.it">YARP</a> and
616-
<a href="http://www.servicerobotik-ulm.de">SmartSoft</a> some notable examples.</p>
617-
<p>A "good" software architecture should have the following characteristics:</p>
618-
<ul>
619-
<li>Modularity.</li>
620-
<li>Reusability of components.</li>
621-
<li>Composability.</li>
622-
<li>Good separation of concerns. </li>
623-
</ul>
624-
<p>If we don't keep these concepts in mind from the very beginning, we create
625-
software modules/components which are highly coupled to a particular application,
626-
instead of being reusable.</p>
627-
<p>Frequently, the concern of <strong>Coordination</strong> is mixed with <strong>Computation</strong>.
628-
In other words, people address the problems of coordinating actions and take decisions
629-
locally.</p>
630-
<p>The business logic becomes "spread" in many locations and it is <strong>hard for the developer
631-
to reason about it and to debug errors</strong> in the control flow.</p>
632-
<p>To achieve strong separation of concerns it is better to centralize
633-
the business logic in a single location. </p>
634-
<p><strong>Finite State Machines</strong> were created specifically with this goal in mind, but in
635-
the recent years <strong>Behavior Trees</strong> gained popularity, especially in the game industry.</p>
636608
<h2 id="what-is-a-behavior-tree">What is a Behavior Tree?</h2>
637609
<p>A Behavior Tree (<strong>BT</strong>) is a way to structure the switching between different
638610
tasks in an autonomous agent, such as a robot or a virtual entity in a computer game.</p>
639611
<p>BTs are a very efficient way of creating complex systems that are both modular and reactive.
640612
These properties are crucial in many applications, which has led to the spread
641613
of BT from computer game programming to many branches of AI and Robotics. </p>
642614
<p>If you are already familiar with Finite State Machines (<strong>FSM</strong>), you will
643-
easily grasp most of the concepts but, hopefully, you will find that BTs
615+
easily grasp most of the concepts but, hopefully, you will find that BTs
644616
are more expressive and easier to reason about.</p>
645617
<p>The main advantages of Behavior Trees, when compared to FSMs are:</p>
646618
<ul>
@@ -662,6 +634,34 @@ <h2 id="what-is-a-behavior-tree">What is a Behavior Tree?</h2>
662634
"vocabulary" with his/her own custom nodes.</p>
663635
</li>
664636
</ul>
637+
<h2 id="ok-but-why-do-we-need-behaviortrees-or-fsm">"Ok, but WHY do we need BehaviorTrees (or FSM)?"</h2>
638+
<p>Many software systems, being robotics a notable example, are inherently
639+
complex.</p>
640+
<p>The usual approach to manage complexity, heterogeneity and scalability is to
641+
use the concept of
642+
<a href="https://en.wikipedia.org/wiki/Component-based_software_engineering">Component Base Software Engineering</a>.</p>
643+
<p>Any existing middleware for robotics took this approach either informally or formally,
644+
being <a href="http://www.ros.org">ROS</a>, <a href="http://www.yarp.it">YARP</a> and
645+
<a href="http://www.servicerobotik-ulm.de">SmartSoft</a> some notable examples.</p>
646+
<p>A "good" software architecture should have the following characteristics:</p>
647+
<ul>
648+
<li>Modularity.</li>
649+
<li>Reusability of components.</li>
650+
<li>Composability.</li>
651+
<li>Good separation of concerns. </li>
652+
</ul>
653+
<p>If we don't keep these concepts in mind from the very beginning, we create
654+
software modules/components which are highly coupled to a particular application,
655+
instead of being reusable.</p>
656+
<p>Frequently, the concern of <strong>Coordination</strong> is mixed with <strong>Computation</strong>.
657+
In other words, people address the problems of coordinating actions and take decisions
658+
locally.</p>
659+
<p>The business logic becomes "spread" in many locations and it is <strong>hard for the developer
660+
to reason about it and to debug errors</strong> in the control flow.</p>
661+
<p>To achieve strong separation of concerns it is better to centralize
662+
the business logic in a single location. </p>
663+
<p><strong>Finite State Machines</strong> were created specifically with this goal in mind, but in
664+
the recent years <strong>Behavior Trees</strong> gained popularity, especially in the game industry.</p>
665665

666666

667667

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,62 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
<url>
44
<loc>None</loc>
5-
<lastmod>2018-10-17</lastmod>
5+
<lastmod>2018-10-19</lastmod>
66
<changefreq>daily</changefreq>
77
</url>
88
<url>
99
<loc>None</loc>
10-
<lastmod>2018-10-17</lastmod>
10+
<lastmod>2018-10-19</lastmod>
1111
<changefreq>daily</changefreq>
1212
</url>
1313
<url>
1414
<loc>None</loc>
15-
<lastmod>2018-10-17</lastmod>
15+
<lastmod>2018-10-19</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818
<url>
1919
<loc>None</loc>
20-
<lastmod>2018-10-17</lastmod>
20+
<lastmod>2018-10-19</lastmod>
2121
<changefreq>daily</changefreq>
2222
</url>
2323
<url>
2424
<loc>None</loc>
25-
<lastmod>2018-10-17</lastmod>
25+
<lastmod>2018-10-19</lastmod>
2626
<changefreq>daily</changefreq>
2727
</url>
2828
<url>
2929
<loc>None</loc>
30-
<lastmod>2018-10-17</lastmod>
30+
<lastmod>2018-10-19</lastmod>
3131
<changefreq>daily</changefreq>
3232
</url>
3333
<url>
3434
<loc>None</loc>
35-
<lastmod>2018-10-17</lastmod>
35+
<lastmod>2018-10-19</lastmod>
3636
<changefreq>daily</changefreq>
3737
</url>
3838
<url>
3939
<loc>None</loc>
40-
<lastmod>2018-10-17</lastmod>
40+
<lastmod>2018-10-19</lastmod>
4141
<changefreq>daily</changefreq>
4242
</url>
4343
<url>
4444
<loc>None</loc>
45-
<lastmod>2018-10-17</lastmod>
45+
<lastmod>2018-10-19</lastmod>
4646
<changefreq>daily</changefreq>
4747
</url>
4848
<url>
4949
<loc>None</loc>
50-
<lastmod>2018-10-17</lastmod>
50+
<lastmod>2018-10-19</lastmod>
5151
<changefreq>daily</changefreq>
5252
</url>
5353
<url>
5454
<loc>None</loc>
55-
<lastmod>2018-10-17</lastmod>
55+
<lastmod>2018-10-19</lastmod>
5656
<changefreq>daily</changefreq>
5757
</url>
5858
<url>
5959
<loc>None</loc>
60-
<lastmod>2018-10-17</lastmod>
60+
<lastmod>2018-10-19</lastmod>
6161
<changefreq>daily</changefreq>
6262
</url>
6363
</urlset>

sitemap.xml.gz

0 Bytes
Binary file not shown.

tutorial_A_create_trees/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ <h2 id="how-to-create-your-own-actionnodes">How to create your own ActionNodes</
637637
It must return a NodeStatus, i.e. RUNNING, SUCCESS or FAILURE. </p>
638638
</li>
639639
<li>
640-
<p>The method <strong>halt()</strong> is used to stop an asynchronous Action. ApproachObject
640+
<p>The method <strong>halt()</strong> is used to stop an <strong>asynchronous Action</strong>. ApproachObject
641641
doesn't need it.</p>
642642
</li>
643643
</ul>
@@ -759,7 +759,7 @@ <h2 id="a-dynamically-created-tree">A dynamically created Tree</h2>
759759
and then load the XML from file or text.</p>
760760
<p>The identifier used in the XML must coincide with those used to register
761761
the TreeNodes.</p>
762-
<p>The attribute "name" represent the name of the instance and it is optional.</p>
762+
<p>The attribute "name" represents the name of the instance and it is optional.</p>
763763
<div class="codehilite"><pre><span></span><span class="cp">#include</span> <span class="cpf">&quot;behavior_tree_core/xml_parsing.h&quot;</span><span class="cp"></span>
764764
<span class="cp">#include</span> <span class="cpf">&quot;Blackboard/blackboard_local.h&quot;</span><span class="cp"></span>
765765
<span class="cp">#include</span> <span class="cpf">&quot;dummy_nodes.h&quot;</span><span class="cp"></span>

0 commit comments

Comments
 (0)