Decision Module  1.0
ICRA2020 AI Challenge Northwestern Polytechnical University Aoxiang Team Strategy Code
roborts_decision::SelectorNode Class Reference

Behavior tree selector node inherited from CompositeNode. More...

#include <behavior_node.h>

Inheritance diagram for roborts_decision::SelectorNode:
roborts_decision::CompositeNode roborts_decision::BehaviorNode

Public Member Functions

 SelectorNode (std::string name, const Blackboard::Ptr &blackboard_ptr)
 Constructor of SelectorNode. More...
 
virtual ~SelectorNode ()=default
 
virtual void AddChildren (std::initializer_list< std::shared_ptr< AbstractCommonStrategy >> child_node_ptr_list)
 
- Public Member Functions inherited from roborts_decision::CompositeNode
 CompositeNode (std::string name, BehaviorType behavior_type, const Blackboard::Ptr &blackboard_ptr)
 Constructor of CompositeNode. More...
 
virtual ~CompositeNode ()=default
 
virtual void AddChildren (const BehaviorNode::Ptr &child_node_ptr)
 Add child behavior node to the composite node. More...
 
virtual void AddChildren (std::initializer_list< BehaviorNode::Ptr > child_node_ptr_list)
 Add a list of child behavior nodes to the composite node. More...
 
virtual BehaviorNode::Ptr GetChild ()
 Get the child behavior node that it is turn to tick. More...
 
std::vector< BehaviorNode::Ptr > & GetChildren ()
 Get the list of child behavior nodes. More...
 
unsigned int GetChildrenIndex ()
 Get the index of the child behavior node that it is turn to tick. More...
 
unsigned int GetChildrenNum ()
 Get the number of child behavior nodes. More...
 
- Public Member Functions inherited from roborts_decision::BehaviorNode
 BehaviorNode ()
 
 BehaviorNode (std::string name, BehaviorType behavior_type, const Blackboard::Ptr &blackboard_ptr)
 Constructor of BehaviorNode. More...
 
virtual ~BehaviorNode ()=default
 
BehaviorState Run ()
 Run the behavior node. More...
 
virtual void Reset ()
 Reset the behavior node. More...
 
BehaviorType GetBehaviorType ()
 Get the type of the behavior node. More...
 
BehaviorState GetBehaviorState ()
 Get the state of the behavior node. More...
 
std::string GetName ()
 Get the name of the behavior node. More...
 
void SetParent (BehaviorNode::Ptr parent_node_ptr)
 Set the parent of the behavior node. More...
 
BehaviorNode::Ptr GetParent ()
 Get the parent node of the behavior node. More...
 
unsigned int GetLevel ()
 Get the level of the behavior node. More...
 
void SetLevel (unsigned int level)
 Set the level of the behavior node. More...
 

Protected Member Functions

void SetChildrenIndex (unsigned int children_node_index)
 Set the index of the child node to tick. More...
 
virtual void OnInitialize ()
 Initialize something before starting to tick the node. More...
 
virtual BehaviorState Update ()
 Tick the node and update the state of the behavior node. More...
 
std::shared_ptr< AbstractCommonStrategyGetAction ()
 
bool HasActionOnGoing ()
 
void ExitThisAction ()
 
std::shared_ptr< AbstractCommonStrategyChooseActionToExecute ()
 
void OnTerminate (BehaviorState state)
 Recover or reset something After getting the result. More...
 

Private Attributes

std::shared_ptr< AbstractCommonStrategyptr_selector_node_
 
std::vector< std::shared_ptr< AbstractCommonStrategy > > children_node_ptr_vector_
 

Additional Inherited Members

- Public Types inherited from roborts_decision::BehaviorNode
typedef std::shared_ptr< BehaviorNodePtr
 
- Protected Attributes inherited from roborts_decision::CompositeNode
std::vector< BehaviorNode::Ptrchildren_node_ptr_
 the list of child nodes More...
 
unsigned int children_node_index_
 the index of child nodes More...
 
- Protected Attributes inherited from roborts_decision::BehaviorNode
std::string name_
 Node name. More...
 
BehaviorState behavior_state_
 State. More...
 
BehaviorType behavior_type_
 Type. More...
 
Blackboard::Ptr blackboard_ptr_
 Blackboard. More...
 
BehaviorNode::Ptr parent_node_ptr_
 Parent Node Pointer. More...
 
unsigned int level_
 Level of the tree. More...
 

Detailed Description

Behavior tree selector node inherited from CompositeNode.

Constructor & Destructor Documentation

◆ SelectorNode()

roborts_decision::SelectorNode::SelectorNode ( std::string  name,
const Blackboard::Ptr blackboard_ptr 
)
inline

Constructor of SelectorNode.

Parameters
nameName of the behavior node
blackboard_ptrBlackboard of the behavior node

◆ ~SelectorNode()

virtual roborts_decision::SelectorNode::~SelectorNode ( )
virtualdefault

Member Function Documentation

◆ AddChildren()

void SelectorNode::AddChildren ( std::initializer_list< std::shared_ptr< AbstractCommonStrategy >>  child_node_ptr_list)
virtual

◆ ChooseActionToExecute()

std::shared_ptr< AbstractCommonStrategy > SelectorNode::ChooseActionToExecute ( )
protected

◆ ExitThisAction()

void SelectorNode::ExitThisAction ( )
protected

◆ GetAction()

std::shared_ptr< AbstractCommonStrategy > SelectorNode::GetAction ( )
protected

◆ HasActionOnGoing()

bool SelectorNode::HasActionOnGoing ( )
protected

◆ OnInitialize()

virtual void roborts_decision::SelectorNode::OnInitialize ( )
inlineprotectedvirtual

Initialize something before starting to tick the node.

Implements roborts_decision::CompositeNode.

◆ OnTerminate()

void SelectorNode::OnTerminate ( BehaviorState  state)
protectedvirtual

Recover or reset something After getting the result.

Parameters
stateInput behavior state

Implements roborts_decision::CompositeNode.

◆ SetChildrenIndex()

void SelectorNode::SetChildrenIndex ( unsigned int  children_node_index)
protected

Set the index of the child node to tick.

Parameters
children_node_indexThe expected index of the child node to tick

◆ Update()

BehaviorState SelectorNode::Update ( )
protectedvirtual

Tick the node and update the state of the behavior node.

Returns
the state of the behavior node

Implements roborts_decision::CompositeNode.

Member Data Documentation

◆ children_node_ptr_vector_

std::vector<std::shared_ptr<AbstractCommonStrategy> > roborts_decision::SelectorNode::children_node_ptr_vector_
private

◆ ptr_selector_node_

std::shared_ptr<AbstractCommonStrategy> roborts_decision::SelectorNode::ptr_selector_node_
private

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