| 77 | } |
| 78 | |
| 79 | void LoadBehaviorTrees(BT::BehaviorTreeFactory& factory, |
| 80 | const std::string& directory_path) |
| 81 | { |
| 82 | using std::filesystem::directory_iterator; |
| 83 | for(const auto& entry : directory_iterator(directory_path)) |
| 84 | { |
| 85 | if(entry.path().extension() == ".xml") |
| 86 | { |
| 87 | try |
| 88 | { |
| 89 | factory.registerBehaviorTreeFromFile(entry.path().string()); |
| 90 | RCLCPP_INFO(kLogger, "Loaded BehaviorTree: %s", entry.path().filename().c_str()); |
| 91 | } |
| 92 | catch(const std::exception& e) |
| 93 | { |
| 94 | RCLCPP_ERROR(kLogger, "Failed to load BehaviorTree: %s \n %s", |
| 95 | entry.path().filename().c_str(), e.what()); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | void LoadPlugin(BT::BehaviorTreeFactory& factory, const std::filesystem::path& file_path, |
| 102 | BT::RosNodeParams params) |
no outgoing calls
no test coverage detected