Classes | Functions | Variables
t02_basic_ports.cpp File Reference
#include "behaviortree_cpp/bt_factory.h"
#include "dummy_nodes.h"
Include dependency graph for t02_basic_ports.cpp:

Go to the source code of this file.

Classes

class  ThinkWhatToSay
 

Functions

int main ()
 

Variables

static const char * xml_text
 

Function Documentation

◆ main()

int main ( )

Definition at line 66 of file t02_basic_ports.cpp.

Variable Documentation

◆ xml_text

const char* xml_text
static
Initial value:
= R"(
<root BTCPP_format="4" >
<BehaviorTree ID="MainTree">
<Sequence name="root">
<SaySomething message="hello" />
<SaySomething2 message="this works too" />
<ThinkWhatToSay text="{the_answer}"/>
<SaySomething2 message="{the_answer}" />
</Sequence>
</BehaviorTree>
</root>
)"

This tutorial will teach you how basic input/output ports work.

Ports are a mechanism to exchange information between Nodes using a key/value storage called "Blackboard". The type and number of ports of a Node is statically defined.

Input Ports are like "argument" of a functions. Output ports are, conceptually, like "return values".

In this example, a Sequence of 5 Actions is executed:

  • Actions 1 and 4 read the input "message" from a static string.
  • Actions 3 and 5 read the input "message" from an entry in the blackboard called "the_answer".
  • Action 2 writes something into the entry of the blackboard called "the_answer".

Definition at line 28 of file t02_basic_ports.cpp.



behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:08