LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Automation Class Referenceabstract

Base class for all automation tasks. More...

#include <Automation.h>

Inheritance diagram for Automation:

Public Member Functions

 Automation (const char *name, bool requiresAbortCycles=false, bool queueIfBlocked=false, bool restartable=false)
 Creates an automation routine.
 
bool Update ()
 Updates the task for one cycle, including calling Run().
 
bool StartAutomation (Event *trigger=NULL)
 Tries to start this task.
 
bool AbortAutomation (Event *trigger=NULL)
 Tries to aborts this task.
 
void ContinueAutomation (Event *trigger)
 Sets the task to continue.
 
bool CheckResources ()
 Allocates resources used by this task. Checks if this task is blocked.
 
virtual void AllocateResources ()=0
 Calls AllocateResource() on resources used in by this task.
 
void DeallocateResources ()
 Clears all resources allocated by this task.
 
bool IsRestartable ()
 Gets whether a task can be restarted (started again when already running).
 
bool QueueIfBlocked ()
 Gets whether a task should continue to be started if blocked.
 
bool RequiresAbortCycles ()
 Gets whether a task requires running cycles before aborting.
 
const char * GetName ()
 Gets the name of the automation routine.
 

Static Public Member Functions

static bool GetAllocation (ControlResource::Enum resource)
 Gets the task that allocated a resource.
 

Protected Member Functions

virtual bool Start ()=0
 Starts the task.
 
virtual bool Abort ()=0
 Aborts the task.
 
virtual bool Run ()=0
 Runs one cycle of the task.
 
bool AllocateResource (ControlResource::Enum resource)
 Allocates a resource to be used.
 
bool Aborting ()
 Gets whether this task is aborting (abort event fired and requires abort cycles).
 
bool Continued ()
 Returns whether this task has been continued.
 
EventGetStartEvent ()
 Returns the event that started this task.
 
EventGetAbortEvent ()
 Returns the event that aborted this task.
 
EventGetContinueEvent ()
 Returns the event that continued this task.
 

Detailed Description

Base class for all automation tasks.

Constructor & Destructor Documentation

Automation::Automation ( const char *  name,
bool  requiresAbortCycles = false,
bool  queueIfBlocked = false,
bool  restartable = false 
)

Creates an automation routine.

Parameters
namethe name of the routine
requiresAbortCycleswhether the routine requires multiple cycles to abort
queueIfBlockedwhether the routine should be queued if blocked
restartablewhether the routine can be restarted

Member Function Documentation

virtual bool Automation::Abort ( )
protectedpure virtual

Aborts the task.

Returns
true if task can be aborted, false otherwise

Implemented in Sequential, Parallel, Repeating, Arc, LoadLauncher, Pass, Collect, Drive, Fire, ChangeLauncherAngle, Pause, and Turn.

bool Automation::AbortAutomation ( Event trigger = NULL)

Tries to aborts this task.

Parameters
triggerthe event that fired
Returns
if the task successfully aborted

Here is the caller graph for this function:

bool Automation::Aborting ( )
protected

Gets whether this task is aborting (abort event fired and requires abort cycles).

Returns
whether the task is aborting

Here is the caller graph for this function:

bool Automation::AllocateResource ( ControlResource::Enum  resource)
protected

Allocates a resource to be used.

Parameters
resourcethe resource to allocate
Returns
if the allocation was successful

Here is the caller graph for this function:

bool Automation::CheckResources ( )

Allocates resources used by this task. Checks if this task is blocked.

Returns
if this task is blocked
void Automation::ContinueAutomation ( Event trigger)

Sets the task to continue.

Parameters
triggerthe event that fired
bool Automation::Continued ( )
protected

Returns whether this task has been continued.

Returns
whether this task has been continued
Event * Automation::GetAbortEvent ( )
protected

Returns the event that aborted this task.

Returns
the event that aborted this task, or NULL if this task was not aborted by an event

Here is the caller graph for this function:

bool Automation::GetAllocation ( ControlResource::Enum  resource)
static

Gets the task that allocated a resource.

Parameters
resourcethe resource to check
Returns
the task that allocated the resource, or NULL if the resource is not allocated

Here is the caller graph for this function:

Event * Automation::GetContinueEvent ( )
protected

Returns the event that continued this task.

Returns
the event that continued this task, or NULL if this task has not been continued
const char * Automation::GetName ( )

Gets the name of the automation routine.

Returns
the name of the routine
Event * Automation::GetStartEvent ( )
protected

Returns the event that started this task.

Returns
the event that started this task, or NULL if this task was not started by an event

Here is the caller graph for this function:

bool Automation::IsRestartable ( )

Gets whether a task can be restarted (started again when already running).

Returns
whether the task can be restarted
bool Automation::QueueIfBlocked ( )

Gets whether a task should continue to be started if blocked.

Returns
whether the task should be queued if blocked
bool Automation::RequiresAbortCycles ( )

Gets whether a task requires running cycles before aborting.

Returns
whether the task requires abort cycles
virtual bool Automation::Run ( )
protectedpure virtual

Runs one cycle of the task.

Returns
true if completed, false otherwise

Implemented in Sequential, Parallel, Repeating, Arc, LoadLauncher, Pass, Collect, Drive, Fire, ChangeLauncherAngle, Pause, and Turn.

virtual bool Automation::Start ( )
protectedpure virtual

Starts the task.

Returns
true if task is able to start, false otherwise

Implemented in Sequential, Parallel, Repeating, Arc, LoadLauncher, Pass, Autonomous, Collect, Drive, Fire, ChangeLauncherAngle, Pause, and Turn.

bool Automation::StartAutomation ( Event trigger = NULL)

Tries to start this task.

Parameters
triggerthe event that fired
Returns
if the task successfully started

Here is the caller graph for this function:

bool Automation::Update ( )

Updates the task for one cycle, including calling Run().

Returns
true if task has completed, false otherwise

Here is the caller graph for this function:


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