| 41 | // clang-format on |
| 42 | |
| 43 | int 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 | } |
nothing calls this directly
no test coverage detected