#include <bt_factory.h>
Public Member Functions | |
BehaviorTreeFactory () | |
const std::map< std::string, NodeBuilder > & | builders () const |
All the builders. Made available mostly for debug purposes. More... | |
const std::set< std::string > & | builtinNodes () const |
std::unique_ptr< TreeNode > | instantiateTreeNode (const std::string &ID, const std::string &name, const NodeParameters ¶ms, const Blackboard::Ptr &blackboard) const |
instantiateTreeNode creates a TreeNode More... | |
const std::vector< TreeNodeManifest > & | manifests () const |
Manifests of all the registered TreeNodes. More... | |
void | registerBuilder (const TreeNodeManifest &manifest, NodeBuilder builder) |
void | registerFromPlugin (const std::string file_path) |
registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro). More... | |
template<typename T > | |
void | registerNodeType (const std::string &ID) |
void | registerSimpleAction (const std::string &ID, const SimpleActionNode::TickFunctor &tick_functor) |
Register a SimpleActionNode. More... | |
void | registerSimpleCondition (const std::string &ID, const SimpleConditionNode::TickFunctor &tick_functor) |
Register a SimpleConditionNode. More... | |
void | registerSimpleDecorator (const std::string &ID, const SimpleDecoratorNode::TickFunctor &tick_functor) |
Register a SimpleDecoratorNode. More... | |
bool | unregisterBuilder (const std::string &ID) |
Private Types | |
template<typename T > | |
using | has_default_constructor = typename std::is_constructible< T, const std::string & > |
template<typename T > | |
using | has_params_constructor = typename std::is_constructible< T, const std::string &, const NodeParameters & > |
Private Member Functions | |
template<typename T > | |
NodeBuilder | getBuilderImpl (typename std::enable_if< !has_params_constructor< T >::value >::type *=nullptr) |
template<typename T > | |
NodeBuilder | getBuilderImpl (typename std::enable_if< has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *=nullptr) |
template<typename T > | |
NodeBuilder | getBuilderImpl (typename std::enable_if<!has_default_constructor< T >::value &&has_params_constructor< T >::value >::type *=nullptr) |
template<typename T > | |
NodeParameters | getRequiredParamsImpl (typename std::enable_if< has_static_method_requiredParams< T >::value >::type *=nullptr) |
template<typename T > | |
NodeParameters | getRequiredParamsImpl (typename std::enable_if< !has_static_method_requiredParams< T >::value >::type *=nullptr) |
template<typename T > | |
void | registerNodeTypeImpl (const std::string &ID) |
void | sortTreeNodeManifests () |
Private Attributes | |
std::map< std::string, NodeBuilder > | builders_ |
std::set< std::string > | builtin_IDs_ |
std::vector< TreeNodeManifest > | manifests_ |
Definition at line 45 of file bt_factory.h.
|
private |
Definition at line 151 of file bt_factory.h.
|
private |
Definition at line 154 of file bt_factory.h.
BT::BehaviorTreeFactory::BehaviorTreeFactory | ( | ) |
Definition at line 18 of file bt_factory.cpp.
const std::map< std::string, NodeBuilder > & BT::BehaviorTreeFactory::builders | ( | ) | const |
All the builders. Made available mostly for debug purposes.
Definition at line 148 of file bt_factory.cpp.
const std::set< std::string > & BT::BehaviorTreeFactory::builtinNodes | ( | ) | const |
Definition at line 158 of file bt_factory.cpp.
|
inlineprivate |
Definition at line 174 of file bt_factory.h.
|
inlineprivate |
Definition at line 183 of file bt_factory.h.
|
inlineprivate |
Definition at line 197 of file bt_factory.h.
|
inlineprivate |
Definition at line 206 of file bt_factory.h.
|
inlineprivate |
Definition at line 212 of file bt_factory.h.
std::unique_ptr< TreeNode > BT::BehaviorTreeFactory::instantiateTreeNode | ( | const std::string & | ID, |
const std::string & | name, | ||
const NodeParameters & | params, | ||
const Blackboard::Ptr & | blackboard | ||
) | const |
instantiateTreeNode creates a TreeNode
ID | unique ID used to register the node type |
name | name of this particular instance |
params | parameters (usually read from the XML definition) |
Definition at line 125 of file bt_factory.cpp.
const std::vector< TreeNodeManifest > & BT::BehaviorTreeFactory::manifests | ( | ) | const |
Manifests of all the registered TreeNodes.
Definition at line 153 of file bt_factory.cpp.
void BT::BehaviorTreeFactory::registerBuilder | ( | const TreeNodeManifest & | manifest, |
NodeBuilder | builder | ||
) |
More generic way to register your own builder. Most of the time you should use registerSimple???? or registerNodeType<> instead.
Definition at line 61 of file bt_factory.cpp.
void BT::BehaviorTreeFactory::registerFromPlugin | ( | const std::string | file_path | ) |
registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro).
This method may throw.
file_path | path of the file |
Definition at line 107 of file bt_factory.cpp.
|
inline |
registerNodeType is the method to use to register your custom TreeNode.
It accepts only classed derived from either ActionNodeBase, DecoratorNode, ControlNode or ConditionNode.
REMINDER: If you want your derived class to
Definition at line 98 of file bt_factory.h.
|
inlineprivate |
Definition at line 165 of file bt_factory.h.
void BT::BehaviorTreeFactory::registerSimpleAction | ( | const std::string & | ID, |
const SimpleActionNode::TickFunctor & | tick_functor | ||
) |
Register a SimpleActionNode.
Definition at line 85 of file bt_factory.cpp.
void BT::BehaviorTreeFactory::registerSimpleCondition | ( | const std::string & | ID, |
const SimpleConditionNode::TickFunctor & | tick_functor | ||
) |
Register a SimpleConditionNode.
Definition at line 74 of file bt_factory.cpp.
void BT::BehaviorTreeFactory::registerSimpleDecorator | ( | const std::string & | ID, |
const SimpleDecoratorNode::TickFunctor & | tick_functor | ||
) |
Register a SimpleDecoratorNode.
Definition at line 96 of file bt_factory.cpp.
|
private |
Definition at line 163 of file bt_factory.cpp.
bool BT::BehaviorTreeFactory::unregisterBuilder | ( | const std::string & | ID | ) |
Definition at line 50 of file bt_factory.cpp.
|
private |
Definition at line 143 of file bt_factory.h.
|
private |
Definition at line 145 of file bt_factory.h.
|
private |
Definition at line 144 of file bt_factory.h.