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

Behavior tree base node. More...

#include <behavior_node.h>

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

Public Types

typedef std::shared_ptr< BehaviorNodePtr
 

Public Member Functions

 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...
 
virtual BehaviorNode::Ptr GetChild ()
 Get the child 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

virtual BehaviorState Update ()=0
 Tick the node and update the state of the behavior node. More...
 
virtual void OnInitialize ()=0
 Initialize something before starting to tick the node. More...
 
virtual void OnTerminate (BehaviorState state)=0
 Recover or reset something After getting the result. More...
 

Protected Attributes

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 base node.

@brif Abort Type of behavior tree precondition node

For more information refer to https://docs.unrealengine.com/en-us/Engine/AI/BehaviorTrees/NodeReference/Decorators

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ BehaviorNode() [1/2]

roborts_decision::BehaviorNode::BehaviorNode ( )
inline

◆ BehaviorNode() [2/2]

roborts_decision::BehaviorNode::BehaviorNode ( std::string  name,
BehaviorType  behavior_type,
const Blackboard::Ptr blackboard_ptr 
)
inline

Constructor of BehaviorNode.

Parameters
nameName of the behavior node
behavior_typeType of the behavior node
blackboard_ptrBlackboard of the behavior node

◆ ~BehaviorNode()

virtual roborts_decision::BehaviorNode::~BehaviorNode ( )
virtualdefault

Member Function Documentation

◆ GetBehaviorState()

BehaviorState roborts_decision::BehaviorNode::GetBehaviorState ( )
inline

Get the state of the behavior node.

Returns
The state of the behavior node

◆ GetBehaviorType()

BehaviorType roborts_decision::BehaviorNode::GetBehaviorType ( )
inline

Get the type of the behavior node.

Returns
The type of the behavior node

◆ GetChild()

virtual BehaviorNode::Ptr roborts_decision::BehaviorNode::GetChild ( )
inlinevirtual

Get the child node of the behavior node.

Returns
The child node of the behavior node, for the base class it always returns nullptr

Reimplemented in roborts_decision::CompositeNode.

◆ GetLevel()

unsigned int roborts_decision::BehaviorNode::GetLevel ( )
inline

Get the level of the behavior node.

Returns
The level of the behavior node

◆ GetName()

std::string roborts_decision::BehaviorNode::GetName ( )
inline

Get the name of the behavior node.

Returns
The name of the behavior node

◆ GetParent()

BehaviorNode::Ptr roborts_decision::BehaviorNode::GetParent ( )
inline

Get the parent node of the behavior node.

Returns
The parent node of the behavior node

◆ OnInitialize()

virtual void roborts_decision::BehaviorNode::OnInitialize ( )
protectedpure virtual

Initialize something before starting to tick the node.

Implemented in roborts_decision::CompositeNode, roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

◆ OnTerminate()

virtual void roborts_decision::BehaviorNode::OnTerminate ( BehaviorState  state)
protectedpure virtual

Recover or reset something After getting the result.

Parameters
stateInput behavior state

Implemented in roborts_decision::CompositeNode, roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

◆ Reset()

virtual void roborts_decision::BehaviorNode::Reset ( )
inlinevirtual

Reset the behavior node.

manually invoke the IDLE terminate function when the node is in running status

◆ Run()

BehaviorState roborts_decision::BehaviorNode::Run ( )
inline

Run the behavior node.

Roughly including 3 process

  1. OnInitilaize: Initialize or reset some variables, when tick the node that is not running.
  2. Update: Update and feedback the behavior state.
  3. OnTerminate: Reset or recover after getting the result.
    Returns
    Behavior state

◆ SetLevel()

void roborts_decision::BehaviorNode::SetLevel ( unsigned int  level)
inline

Set the level of the behavior node.

Parameters
levelThe expected level of the behavior node

◆ SetParent()

void roborts_decision::BehaviorNode::SetParent ( BehaviorNode::Ptr  parent_node_ptr)
inline

Set the parent of the behavior node.

Parameters
parent_node_ptr

◆ Update()

virtual BehaviorState roborts_decision::BehaviorNode::Update ( )
protectedpure virtual

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

Returns
the state of the behavior node

Implemented in roborts_decision::CompositeNode, roborts_decision::ParallelNode, and roborts_decision::SelectorNode.

Member Data Documentation

◆ behavior_state_

BehaviorState roborts_decision::BehaviorNode::behavior_state_
protected

State.

◆ behavior_type_

BehaviorType roborts_decision::BehaviorNode::behavior_type_
protected

Type.

◆ blackboard_ptr_

Blackboard::Ptr roborts_decision::BehaviorNode::blackboard_ptr_
protected

◆ level_

unsigned int roborts_decision::BehaviorNode::level_
protected

Level of the tree.

◆ name_

std::string roborts_decision::BehaviorNode::name_
protected

Node name.

◆ parent_node_ptr_

BehaviorNode::Ptr roborts_decision::BehaviorNode::parent_node_ptr_
protected

Parent Node Pointer.


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