RAIN.Action.TeleoReactiveActionExecutor Class Reference

TeleoReactiveActionExecutor is an ActionExecutor that attempts to execute a set of Actions as a simple "fallback" plan. At each step, the "best case" Action is selected and attempted to execute. If that Action fails, the next best case is chosen. If any Action succeeds, the executor immediately returns SUCCESS. Action selection is carried out by choosing the last item in the execution list. Selection proceeds by continuing to select the prior action in the sequence until SUCCESS or no Actions remain. To build an Action stack, add the most basic Action as element 0. Add the next as element 1, etc. The created stack can be considered a "plan" to the extent that executing Action 0 creates necessary preconditions for the success of Action 1. Action 1 creates necessary preconditions for the success of Action 2, etc. The created stack can be considered "TeleoReactive" to the extent that execution is opportunistic. The executor always attempts to carry out the last Actions in the sequence, "just in case" they may work. More...

Inheritance diagram for RAIN.Action.TeleoReactiveActionExecutor:
RAIN.Action.Action RAIN.Action.IActionExecutor

List of all members.

Classes

class  ActionBundle

Public Member Functions

 TeleoReactiveActionExecutor ()
 Default constructor.
void Clear ()
 Clear will reset to initial state, removing all Actions from the plan.
void Reset (Agent actor)
 Reset will clear any saved state and reset the ActionContext.
void Reset (Agent actor, ActionContext context)
 Reset will clear any saved state and reset the ActionContext to the given context.
override void SetActionContext (ActionContext context)
 SetActionContext clears state and resets the ActionContext for all contained Actions.
override ActionResult Start (Agent agent, float deltaTime)
 Implementation of Action.Start() Performs initialization.
override ActionResult Execute (Agent agent, float deltaTime)
 Implementation of Action.Execute() Considers each Action from last to first. If any Action succeeds, returns SUCCESS immediately. If any Action remains RUNNING returns RUNNING. If any Action fails, the prior Action is tried. Returns FAILURE ony if all Actions fail.
override Action.ActionResult Stop (Agent agent, float deltaTime)
 Implementation of Action.Stop() Performs cleanup.
void AddAction (Action action, float delay)
 Add an action to the end of the Action list.
void InsertAction (Action action, int sequence)
 Insert an action into the teleoreactive list. If an action is inserted at a sequence position matching another action, then the action will be inserted at the lower sequence number and all other sequences will move up.
void RemoveAction (string actionName)
 Remove an action from the ActionExecutor. This will cause the Action to be Stopped and unloaded if it is currently executing.
void Pause ()
 Pause will pause execution until Unpause is called or the ActionContext is reset.
void Unpause (float delay)
 Unpause will cause execution to resume after a Pause call. Execution can be delayed by passing in a positive number value for delay.

Public Attributes

string executorName
 executorName holds the name of this executor, useful for debugging purposes.

Detailed Description

TeleoReactiveActionExecutor is an ActionExecutor that attempts to execute a set of Actions as a simple "fallback" plan. At each step, the "best case" Action is selected and attempted to execute. If that Action fails, the next best case is chosen. If any Action succeeds, the executor immediately returns SUCCESS. Action selection is carried out by choosing the last item in the execution list. Selection proceeds by continuing to select the prior action in the sequence until SUCCESS or no Actions remain. To build an Action stack, add the most basic Action as element 0. Add the next as element 1, etc. The created stack can be considered a "plan" to the extent that executing Action 0 creates necessary preconditions for the success of Action 1. Action 1 creates necessary preconditions for the success of Action 2, etc. The created stack can be considered "TeleoReactive" to the extent that execution is opportunistic. The executor always attempts to carry out the last Actions in the sequence, "just in case" they may work.


Constructor & Destructor Documentation

RAIN.Action.TeleoReactiveActionExecutor.TeleoReactiveActionExecutor ( )

Default constructor.


Member Function Documentation

void RAIN.Action.TeleoReactiveActionExecutor.AddAction ( Action  action,
float  delay 
)

Add an action to the end of the Action list.

Parameters:
actionAn Action to add
delayA time delay in seconds to wait for before allowing execution of the Action

Implements RAIN.Action.IActionExecutor.

void RAIN.Action.TeleoReactiveActionExecutor.Clear ( )

Clear will reset to initial state, removing all Actions from the plan.

Implements RAIN.Action.IActionExecutor.

override ActionResult RAIN.Action.TeleoReactiveActionExecutor.Execute ( Agent  agent,
float  deltaTime 
) [virtual]

Implementation of Action.Execute() Considers each Action from last to first. If any Action succeeds, returns SUCCESS immediately. If any Action remains RUNNING returns RUNNING. If any Action fails, the prior Action is tried. Returns FAILURE ony if all Actions fail.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
SUCCESS if any action succeeds, FAILURE if all Actions fail, or RUNNING if more work should be done

Reimplemented from RAIN.Action.Action.

void RAIN.Action.TeleoReactiveActionExecutor.InsertAction ( Action  action,
int  sequence 
)

Insert an action into the teleoreactive list. If an action is inserted at a sequence position matching another action, then the action will be inserted at the lower sequence number and all other sequences will move up.

Sequences are a set of steps. For TeleoReactive execution, the highest sequence action that can be executed is chosen. Lower sequence actions are disregarded unless higher sequence actions fail

Parameters:
actionAn Action to insert
sequenceThe index in the Action list to insert the Action

Implements RAIN.Action.IActionExecutor.

void RAIN.Action.TeleoReactiveActionExecutor.Pause ( )

Pause will pause execution until Unpause is called or the ActionContext is reset.

Implements RAIN.Action.IActionExecutor.

void RAIN.Action.TeleoReactiveActionExecutor.RemoveAction ( string  actionName)

Remove an action from the ActionExecutor. This will cause the Action to be Stopped and unloaded if it is currently executing.

Parameters:
actionNameThe name of the Action to remove. If more than one Action is loaded with a matching name, all matches will be removed.

Implements RAIN.Action.IActionExecutor.

void RAIN.Action.TeleoReactiveActionExecutor.Reset ( Agent  actor)

Reset will clear any saved state and reset the ActionContext.

Parameters:
actorThe AI Agent owning this executor

Implements RAIN.Action.IActionExecutor.

void RAIN.Action.TeleoReactiveActionExecutor.Reset ( Agent  actor,
ActionContext  context 
)

Reset will clear any saved state and reset the ActionContext to the given context.

Parameters:
actorThe AI Agent owning this executor
contextThe context to use after clearing state

Implements RAIN.Action.IActionExecutor.

override void RAIN.Action.TeleoReactiveActionExecutor.SetActionContext ( ActionContext  context) [virtual]

SetActionContext clears state and resets the ActionContext for all contained Actions.

Parameters:
contextThe ActionContext to set

Reimplemented from RAIN.Action.Action.

override ActionResult RAIN.Action.TeleoReactiveActionExecutor.Start ( Agent  agent,
float  deltaTime 
) [virtual]

Implementation of Action.Start() Performs initialization.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
Returns SUCCESS or FAILURE

Reimplemented from RAIN.Action.Action.

override Action.ActionResult RAIN.Action.TeleoReactiveActionExecutor.Stop ( Agent  agent,
float  deltaTime 
) [virtual]

Implementation of Action.Stop() Performs cleanup.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
Returns SUCCESS or FAILURE

Reimplemented from RAIN.Action.Action.

void RAIN.Action.TeleoReactiveActionExecutor.Unpause ( float  delay)

Unpause will cause execution to resume after a Pause call. Execution can be delayed by passing in a positive number value for delay.

Parameters:
delayThe amount of time to wait before resuming execution.

Implements RAIN.Action.IActionExecutor.


Member Data Documentation

executorName holds the name of this executor, useful for debugging purposes.