Go to the documentation of this file.
26 add_field(
"x", &pos.x);
27 add_field(
"y", &pos.y);
48 return { BT::OutputPort<Position2D>(
"pos") };
58 <root BTCPP_format="4">
60 <BehaviorTree ID="MainTree">
62 <Script code="door_open:=false" />
63 <UpdatePosition pos="{pos_2D}" />
68 <SubTree ID="DoorClosed" _autoremap="true" door_open="{door_open}"/>
74 <BehaviorTree ID="DoorClosed">
75 <Fallback name="tryOpen" _onSuccess="door_open:=true">
77 <RetryUntilSuccessful num_attempts="5">
79 </RetryUntilSuccessful>
106 BT::RegisterJsonDefinition<Position2D>();
110 std::cout <<
"----------- XML file ----------\n"
112 <<
"--------------------------------\n";
116 const unsigned port = 1667;
128 std::cout <<
"Start" << std::endl;
130 tree.tickWhileRunning();
131 std::this_thread::sleep_for(std::chrono::milliseconds(2000));
Tree createTree(const std::string &tree_name, Blackboard::Ptr blackboard=Blackboard::create())
const NodeConfig & config() const
BT_JSON_CONVERTER(Position2D, pos)
BT::NodeStatus tick() override
Method to be implemented by the user.
std::string WriteTreeToXML(const Tree &tree, bool add_metadata, bool add_builtin_models)
WriteTreeToXML create a string that contains the XML that corresponds to a given tree....
std::unordered_map< std::string, PortInfo > PortsList
void registerNodes(BT::BehaviorTreeFactory &factory)
void registerNodeType(const std::string &ID, const PortsList &ports, ExtraArgs... args)
SyncActionNode(const std::string &name, const NodeConfig &config)
The Groot2Publisher is used to create an interface between your BT.CPP executor and Groot2.
static const char * xml_text
The FileLogger2 is a logger that saves the tree as XML and all the transitions. Data is written to fi...
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Result setOutput(const std::string &key, const T &value)
setOutput modifies the content of an Output port
const std::string & name() const
Name of the instance, not the type.
void registerBehaviorTreeFromText(const std::string &xml_text)
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
std::string writeTreeNodesModelXML(const BehaviorTreeFactory &factory, bool include_builtin=false)
writeTreeNodesModelXML generates an XMl that contains the manifests in the <TreeNodesModel>
UpdatePosition(const std::string &name, const BT::NodeConfig &config)
static BT::PortsList providedPorts()