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

Function main

examples/t12_default_ports.cpp:108–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106};
107
108int main()
109{
110 std::string xml_txt = R"(
111 <root BTCPP_format="4" >
112 <BehaviorTree>
113 <NodeWithDefaultPoints input="-1,-2"/>
114 </BehaviorTree>
115 </root>)";
116
117 JsonExporter::get().addConverter<Point2D>();
118
119 BehaviorTreeFactory factory;
120 factory.registerNodeType<NodeWithDefaultPoints>("NodeWithDefaultPoints");
121 auto tree = factory.createTreeFromText(xml_txt);
122
123 tree.subtrees.front()->blackboard->set<Point2D>("point", Point2D{ 3, 4 });
124 tree.subtrees.front()->blackboard->set<Point2D>("pointD", Point2D{ 7, 8 });
125
126 BT::NodeStatus status = tree.tickOnce();
127 std::cout << "Result: " << toStr(status) << std::endl;
128
129 return 0;
130}

Callers

nothing calls this directly

Calls 4

createTreeFromTextMethod · 0.80
tickOnceMethod · 0.80
getFunction · 0.50
toStrFunction · 0.50

Tested by

no test coverage detected