Package org.wildstang.framework.auto
Class AutoProgram
- java.lang.Object
-
- org.wildstang.framework.auto.AutoProgram
-
- Direct Known Subclasses:
Sleeper
public abstract class AutoProgram extends java.lang.ObjectRepresents a collection of AutoSteps used for a single Autonomous period.
-
-
Field Summary
Fields Modifier and Type Field Description protected intcurrentStepprotected booleanfinishedprotected booleanfinishedPreviousStepprotected booleanprogramStartedprotected java.util.List<AutoStep>programSteps
-
Constructor Summary
Constructors Constructor Description AutoProgram()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddStep(AutoStep newStep)Adds a new AutoStep to the AutoProgram.booleanareStepsDefined()Determines if the program's steps have been defined.voidcleanup()Remove all steps from the AutoProgramprotected abstract voiddefineSteps()Use this method to set the steps for this program.AutoStepgetCurrentStep()Returns the current running AutoStep within the AutoProgram.AutoStepgetNextStep()Returns the next AutoStep to run or null if at the last step.voidinitialize()Collects the defined steps and starts the auto program.booleanisFinished()Returns true if the AutoProgram is complete.protected voidloadStopPosition()Adds an AutoStepStopAutonomous after a given AutoStep index from config.abstract java.lang.StringtoString()Returns the name of the AutoProgram.voidupdate()Update the current running step and move on if necessary.
-
-
-
Field Detail
-
programSteps
protected final java.util.List<AutoStep> programSteps
-
currentStep
protected int currentStep
-
finishedPreviousStep
protected boolean finishedPreviousStep
-
finished
protected boolean finished
-
programStarted
protected boolean programStarted
-
-
Method Detail
-
defineSteps
protected abstract void defineSteps()
Use this method to set the steps for this program. Programs execute the steps in the array programSteps serially. Remember to clear everything before all of your steps are finished, because once they are, it immediately drops into Sleeper.
-
initialize
public void initialize()
Collects the defined steps and starts the auto program.
-
cleanup
public void cleanup()
Remove all steps from the AutoProgram
-
areStepsDefined
public boolean areStepsDefined()
Determines if the program's steps have been defined.- Returns:
- Returns true if there are any steps.
-
update
public void update()
Update the current running step and move on if necessary.
-
getCurrentStep
public AutoStep getCurrentStep()
Returns the current running AutoStep within the AutoProgram.- Returns:
- Current running AutoStep.
-
getNextStep
public AutoStep getNextStep()
Returns the next AutoStep to run or null if at the last step.- Returns:
- Next AutoStep or null if no more steps.
-
loadStopPosition
protected void loadStopPosition()
Adds an AutoStepStopAutonomous after a given AutoStep index from config. This allows insertion of a force stop of autonomous into a program via config.
-
isFinished
public boolean isFinished()
Returns true if the AutoProgram is complete.- Returns:
- True if the AutoProgram is complete.
-
addStep
protected void addStep(AutoStep newStep)
Adds a new AutoStep to the AutoProgram.- Parameters:
newStep- New AutoStep to add.
-
toString
public abstract java.lang.String toString()
Returns the name of the AutoProgram.- Overrides:
toStringin classjava.lang.Object- Returns:
- Name of the AutoProgram.
-
-