LRT14
1.0
|
Base class for all automation tasks. More...
#include <Automation.h>
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. | |
Event * | GetStartEvent () |
Returns the event that started this task. | |
Event * | GetAbortEvent () |
Returns the event that aborted this task. | |
Event * | GetContinueEvent () |
Returns the event that continued this task. | |
Base class for all automation tasks.
Automation::Automation | ( | const char * | name, |
bool | requiresAbortCycles = false , |
||
bool | queueIfBlocked = false , |
||
bool | restartable = false |
||
) |
Creates an automation routine.
name | the name of the routine |
requiresAbortCycles | whether the routine requires multiple cycles to abort |
queueIfBlocked | whether the routine should be queued if blocked |
restartable | whether the routine can be restarted |
|
protectedpure virtual |
Aborts the task.
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.
trigger | the event that fired |
|
protected |
Gets whether this task is aborting (abort event fired and requires abort cycles).
|
protected |
Allocates a resource to be used.
resource | the resource to allocate |
bool Automation::CheckResources | ( | ) |
Allocates resources used by this task. Checks if this task is blocked.
void Automation::ContinueAutomation | ( | Event * | trigger | ) |
Sets the task to continue.
trigger | the event that fired |
|
protected |
Returns whether this task has been continued.
|
protected |
Returns the event that aborted this task.
|
static |
Gets the task that allocated a resource.
resource | the resource to check |
|
protected |
Returns the event that continued this task.
const char * Automation::GetName | ( | ) |
Gets the name of the automation routine.
|
protected |
Returns the event that started this task.
bool Automation::IsRestartable | ( | ) |
Gets whether a task can be restarted (started again when already running).
bool Automation::QueueIfBlocked | ( | ) |
Gets whether a task should continue to be started if blocked.
bool Automation::RequiresAbortCycles | ( | ) |
Gets whether a task requires running cycles before aborting.
|
protectedpure virtual |
Runs one cycle of the task.
Implemented in Sequential, Parallel, Repeating, Arc, LoadLauncher, Pass, Collect, Drive, Fire, ChangeLauncherAngle, Pause, and Turn.
|
protectedpure virtual |
Starts the task.
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.
trigger | the event that fired |
bool Automation::Update | ( | ) |
Updates the task for one cycle, including calling Run().