WsfAdvancedBehaviorTreeNode

WsfAdvancedBehaviorTreeNode inherits WsfObject

Methods

int Id()

Returns the unique id of the node. The Id is globally unique within the simulation, even nodes of the same type on other agent’s behavior trees have a different Id.

string Type()

Returns the type of the node. This may be a composite node type (parallel, sequence, sequence_with_memory, selector, selector_with_memory, priority_selector, weighted_random, decorator) or a user defined behavior_node type.

int Failure(string aReason)

Always returns the Failure state. Allows the user to specify an optional reason for the node’s failure state. This method is used within a behavior’s ‘precondition’ or ‘execute’ script block to indicate why the node is failing.

int Success(string aReason)

Always returns the Success state. Allows the user to specify an optional reason for the node’s success state. This method is used within a behavior’s ‘precondition’ or ‘execute’ script block to give extra information or indicate why the node succeeded.

int Running(string aReason)

Always returns the Running state. Allows the user to specify an optional reason for the node’s running state. This method is used within a behavior’s ‘execute’ script block to give extra information during execution.

void TurnOff()

Turns the node off. This results in the node never being visited by the tree, nor any of its children.

void TurnOn()

Turns the node on. This method is only useful if a node has previously been turned off, as all nodes start in the “on” setting. Please note that, even if a node is on, it won’t necessarily pass its precondition, it will simply be visited by the tree if appropriate (depending on the structure of the tree).

int State()

Return the current state for the node as an int (RUNNING = 1, SUCCESS = 2, FAILURE = 3, IDLE = 4, HALTED = 5, DISABLED = 6).

string Tree()

Returns the name of the owning tree for the node.

void SetBlackboardVar(string aName, Object aValue)

Store a variable on the blackboard with aName as the key and aValue as the value.

void SetBlackboardTrackVar(string aName, WsfTrack aValue)

Store a WsfTrack variable on the blackboard with aName as the key and aValue as the value.

void SetBlackboardPlatformVar(string aName, WsfPlatform aValue)

Store a WsfPlatform variable on the blackboard with aName as the key and aValue as the value.

Object GetBlackboardVar(string aName)

Return the value of the blackboard variable with name aName if it exists.

bool BlackboardVarExists(string aName)

Return true if the blackboard variable with name aName exists.

void DeleteBlackboardVar(string aName)

Delete the blackboard variable with name aName.

void ShareBlackboard()

Share this node’s blackboard to the behavior tree with its current name. Any other node will be able to access this blackboard using this name with shared blackboard commands.

void ShareBlackboard(string aName)

Share this node’s blackboard to the behavior tree with name aName. Any other node will be able to access this blackboard using this name with shared blackboard commands.

void CreateSharedBlackboard(string aName)

Create a new shared blackboard for the tree with name aName.

void SetSharedBlackboardVar(string aBlackboard, string aName, Object aValue)

Store a variable on the shared blackboard with name aBlackboard, using aName as the key and aValue as the value.

void SetSharedBlackboardTrackVar(string aBlackboard, string aName, WsfTrack aValue)

Store a WsfTrack variable on the shared blackboard with name aBlackboard, using aName as the key and aValue as the value.

void SetSharedBlackboardPlatformVar(string aBlackboard, string aName, WsfPlatform aValue)

Store a WsfPlatform variable on the shared blackboard with name aBlackboard, using aName as the key and aValue as the value.

Object GetSharedBlackboardVar(string aBlackboard, string aName)

Return the value of the shared blackboard variable with name aName if it exists.

bool SharedBlackboardVarExists(string aBlackboard, string aName)

Return true if the shared blackboard variable with name aName exists.

void DeleteSharedBlackboardVar(string aBlackboard, string aName)

This will delete the shared blackboard variable with name aName.

bool SharedBlackboardExists(string aBlackboard)

Return true if the shared blackboard with name aBlackboard exists.