Skip to main content

SharedResourcesNode Class Template

The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More...

Declaration

template <typename BehaviorTreeNodeT>
class moveit_pro::behaviors::SharedResourcesNode<BehaviorTreeNodeT> { ... }

Included Headers

#include <shared_resources_node.hpp>

Base class

classBehaviorTreeNodeT

Public Constructors Index

template <typename BehaviorTreeNodeT>
SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &behavior_context)

Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node. More...

Public Member Functions Index

template <typename BehaviorTreeNodeT>
auto getBehaviorContext () const -> const std::shared_ptr< BehaviorContext > &

Private Member Attributes Index

template <typename BehaviorTreeNodeT>
std::shared_ptr< BehaviorContext >behavior_context_

Description

The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node.

The purpose of this class is to let Behaviors access shared objects without resorting to using the BehaviorTree.Cpp port interface. In combination with the loader plugin architecture provided by SharedResourcesNodeLoaderBase, this allows us to write Behaviors that use constructors with signatures that are different from the normal signature of BehaviorTree.Cpp nodes, while still allowing the library responsible for creating the behavior tree to work without directly linking against Behavior libraries provided by downstream developers.

Note that classes inheriting from SharedResourcesNode cannot be registered with BT::BehaviorTreeFactory using the BT_REGISTER_NODES macro, since that macro only handles registering nodes with the default constructor signature. They must instead be registered within a behavior loader plugin inheriting from SharedResourcesNodeLoaderBase.

Template Parameters
BehaviorTreeNodeT

A BehaviorTree.Cpp node type. The constructor for this type must have the signature (const std::string&, const BT::NodeConfiguration&).

Definition at line 35 of file shared_resources_node.hpp.

Public Constructors

SharedResourcesNode()

template <typename BehaviorTreeNodeT>
moveit_pro::behaviors::SharedResourcesNode< BehaviorTreeNodeT >::SharedResourcesNode (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & behavior_context)

Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.

Parameters
name

Name of the behavior, which is generated by the factory.

config

Configuration of the behavior, which is generated by the factory.

behavior_context

A shared_ptr to an instance of BehaviorContext. When this behavior is created using moveit_studio::objective_server::ObjectiveServerNode, this will point to an instance of BehaviorContext owned by ObjectiveServerNode.

Declaration at line 47 of file shared_resources_node.hpp, definition at line 13 of file shared_resources_node.cpp.

Public Member Functions

getBehaviorContext()

template <typename BehaviorTreeNodeT>
const std::shared_ptr< BehaviorContext > & moveit_pro::behaviors::SharedResourcesNode< BehaviorTreeNodeT >::getBehaviorContext ()

Declaration at line 50 of file shared_resources_node.hpp, definition at line 21 of file shared_resources_node.cpp.

Private Member Attributes

behavior_context_

template <typename BehaviorTreeNodeT>
std::shared_ptr<BehaviorContext> moveit_pro::behaviors::SharedResourcesNode< BehaviorTreeNodeT >::behavior_context_

Definition at line 53 of file shared_resources_node.hpp.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.