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.Object
Represents a collection of AutoSteps used for a single Autonomous period.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentStep
protected boolean
finished
protected boolean
finishedPreviousStep
protected boolean
programStarted
protected 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 void
addStep(AutoStep newStep)
Adds a new AutoStep to the AutoProgram.boolean
areStepsDefined()
Determines if the program's steps have been defined.void
cleanup()
Remove all steps from the AutoProgramprotected abstract void
defineSteps()
Use this method to set the steps for this program.AutoStep
getCurrentStep()
Returns the current running AutoStep within the AutoProgram.AutoStep
getNextStep()
Returns the next AutoStep to run or null if at the last step.void
initialize()
Collects the defined steps and starts the auto program.boolean
isFinished()
Returns true if the AutoProgram is complete.protected void
loadStopPosition()
Adds an AutoStepStopAutonomous after a given AutoStep index from config.abstract java.lang.String
toString()
Returns the name of the AutoProgram.void
update()
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:
toString
in classjava.lang.Object
- Returns:
- Name of the AutoProgram.
-
-