Functions | Variables
t06_subtree_port_remapping.cpp File Reference
#include "behaviortree_cpp/loggers/bt_cout_logger.h"
#include "behaviortree_cpp/bt_factory.h"
#include "movebase_node.h"
#include "dummy_nodes.h"
Include dependency graph for t06_subtree_port_remapping.cpp:

Go to the source code of this file.

Functions

int main ()
 

Variables

static const char * xml_text
 

Function Documentation

◆ main()

int main ( )

Definition at line 54 of file t06_subtree_port_remapping.cpp.

Variable Documentation

◆ xml_text

const char* xml_text
static
Initial value:
= R"(
<root BTCPP_format="4">
<BehaviorTree ID="MainTree">
<Sequence>
<Script code=" move_goal='1;2;3' " />
<SubTree ID="MoveRobot" target="{move_goal}" result="{move_result}" />
<SaySomething message="{move_result}"/>
</Sequence>
</BehaviorTree>
<BehaviorTree ID="MoveRobot">
<Fallback>
<Sequence>
<MoveBase goal="{target}"/>
<Script code=" result:='goal reached' " />
</Sequence>
<ForceFailure>
<Script code=" result:='error' " />
</ForceFailure>
</Fallback>
</BehaviorTree>
</root>
)"

In the CrossDoor example we did not exchange any information between the Maintree and the DoorClosed subtree.

If we tried to do that, we would have noticed that it can't be done, because each of the tree/subtree has its own Blackboard, to avoid the problem of name clashing in very large trees.

But a SubTree can have its own input/output ports. In practice, these ports are nothing more than "soft links" between the ports inside the SubTree (called "internal") and those in the parent Tree (called "external").

Definition at line 23 of file t06_subtree_port_remapping.cpp.



behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:18