行为树两个Exception

  • 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BT::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;
}