MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.ROS2 / LoadBehaviorTrees

Function LoadBehaviorTrees

behaviortree_ros2/src/bt_utils.cpp:79–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void 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
101void LoadPlugin(BT::BehaviorTreeFactory& factory, const std::filesystem::path& file_path,
102 BT::RosNodeParams params)

Callers 1

RegisterBehaviorTreesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected