LogicError is related to problems which require code refactoring to be fixed.
RuntimeError is related to problems that are relted to data or conditions that happen only at run-time
createTree
之后的 catch
应该这样用:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15BT::Tree tree;
try{
factory.registerBehaviorTreeFromFile("/home/user/test.xml");
tree = factory.createTree("maintree", maintree_bb);
} catch (BT::RuntimeError &error) {
printf("behavior tree RuntimeError: %s", error.what() );
return false;
} catch (BT::LogicError &error) {
printf("behavior tree LogicError: %s", error.what() );
return false;
}
catch (...) {
printf("create behavior tree failed, check it out");
return false;
}