MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / main

Function main

examples/t05_crossdoor.cpp:43–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41// clang-format on
42
43int main()
44{
45 BT::BehaviorTreeFactory factory;
46
47 CrossDoor cross_door;
48 cross_door.registerNodes(factory);
49
50 // In this example a single XML contains multiple <BehaviorTree>
51 // To determine which one is the "main one", we should first register
52 // the XML and then allocate a specific tree, using its ID
53
54 factory.registerBehaviorTreeFromText(xml_text);
55 auto tree = factory.createTree("MainTree");
56
57 // helper function to print the tree
58 BT::printTreeRecursively(tree.rootNode());
59
60 // Tick multiple times, until either FAILURE of SUCCESS is returned
61 tree.tickWhileRunning();
62
63 return 0;
64}

Callers

nothing calls this directly

Calls 6

printTreeRecursivelyFunction · 0.85
registerNodesMethod · 0.80
createTreeMethod · 0.80
rootNodeMethod · 0.80
tickWhileRunningMethod · 0.80

Tested by

no test coverage detected