15#include "auto_apms_behavior_tree_core/node/node_registration_from_library_adapter.hpp"
17#include "auto_apms_behavior_tree_core/exceptions.hpp"
18#include "behaviortree_cpp/utils/shared_library.h"
23bool NodeRegistrationFromLibraryAdapter::requiresRosNodeContext()
const {
return false; }
25void NodeRegistrationFromLibraryAdapter::registerWithBehaviorTreeFactory(
26 BT::BehaviorTreeFactory & factory,
const std::string & name,
27 const auto_apms_behavior_tree::core::RosNodeContext *
const )
const
33 BT::BehaviorTreeFactory temp_factory;
35 temp_factory.registerFromPlugin(lib_path);
36 }
catch (
const std::exception & e) {
37 throw exceptions::NodeRegistrationError(
38 "Failed to load plugin library '" + lib_path +
"' for node registration name '" + name +
"': " + e.what());
42 const auto & manifests = temp_factory.manifests();
43 const auto manifest_it = manifests.find(name);
44 if (manifest_it == manifests.end()) {
45 throw exceptions::NodeRegistrationError(
46 "Node registration name '" + name +
"' not found in plugin library '" + lib_path +
"'.");
48 factory.registerBuilder(manifest_it->second, temp_factory.builders().at(name));
virtual std::string getPluginLibraryPath() const =0
Get the library path that exports the node registration function associated with this class.
Core API for AutoAPMS's behavior tree implementation.