Package org.wildstang.framework.auto
Class AutoProgram
java.lang.Object
org.wildstang.framework.auto.AutoProgram
- Direct Known Subclasses:
Sleeper
Represents a collection of AutoSteps used for a single Autonomous period.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a new AutoStep to the AutoProgram.booleanDetermines if the program's steps have been defined.voidcleanup()Remove all steps from the AutoProgramprotected abstract voidUse this method to set the steps for this program.Returns the current running AutoStep within the AutoProgram.Returns the next AutoStep to run or null if at the last step.voidCollects the defined steps and starts the auto program.booleanReturns true if the AutoProgram is complete.protected voidAdds an AutoStepStopAutonomous after a given AutoStep index from config.abstract StringtoString()Returns the name of the AutoProgram.voidupdate()Update the current running step and move on if necessary.
-
Field Details
-
programSteps
-
currentStep
protected int currentStep -
finishedPreviousStep
protected boolean finishedPreviousStep -
finished
protected boolean finished -
programStarted
protected boolean programStarted
-
-
Constructor Details
-
AutoProgram
public AutoProgram()
-
-
Method Details
-
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
Returns the current running AutoStep within the AutoProgram.- Returns:
- Current running 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
Adds a new AutoStep to the AutoProgram.- Parameters:
newStep- New AutoStep to add.
-
toString
Returns the name of the AutoProgram.
-