Package org.hyperonline.hyperlib.auto
Class AutonomousRoutine
- java.lang.Object
-
- edu.wpi.first.wpilibj.SendableBase
-
- org.hyperonline.hyperlib.auto.AutonomousRoutine
-
- All Implemented Interfaces:
edu.wpi.first.wpilibj.Sendable
,java.lang.AutoCloseable
public abstract class AutonomousRoutine extends edu.wpi.first.wpilibj.SendableBase
TheAutonomousRoutine
class contains all the information needed for a particular autonomous routine. It contains the code to build the command, as well as information about what preferences need to be set, and what other routines may be called as subroutines. Logic for deciding which routine should be placed in the AutonomousStrategy class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
UNNAMED
-
Constructor Summary
Constructors Constructor Description AutonomousRoutine()
Construct a new AutonomousRoutine.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected DoublePreference
addDoublePreference(java.lang.String name)
Add a preference of type double to the routine.protected AutonomousRoutine
addSubroutine(AutonomousRoutine routine)
Indicate that another routine is a subroutine of this one.abstract void
build(CommandBuilder builder)
Abstract method for implementing the actual logic of the command.boolean
equals(java.lang.Object other)
Two AutonomousRoutines are considered to be equal if they have the same name, with the exception that two unnamed routines are equivalent iff they occupy the same memory location.java.util.List<AutonomousRoutine>
getSubroutines()
Get a list of all routines which are included as subroutines in this routine.java.util.List<AutonomousPreference>
getSupportedPreferences()
Get a list of the preferences that this routine requires.int
hashCode()
void
initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder builder)
-
Methods inherited from class edu.wpi.first.wpilibj.SendableBase
addChild, close, free, getName, getSubsystem, setName, setName, setName, setSubsystem
-
-
-
-
Field Detail
-
UNNAMED
public static final java.lang.String UNNAMED
- See Also:
- Constant Field Values
-
-
Method Detail
-
build
public abstract void build(CommandBuilder builder)
Abstract method for implementing the actual logic of the command. Ideally, this would use the preferences and subroutines that have already been declared.- Parameters:
builder
- The CommandBuilder object to use in building the command.
-
getSupportedPreferences
public java.util.List<AutonomousPreference> getSupportedPreferences()
Get a list of the preferences that this routine requires.- Returns:
- A list of AutonomousPreference objects
-
addDoublePreference
protected DoublePreference addDoublePreference(java.lang.String name)
Add a preference of type double to the routine.- Parameters:
name
- The name of the preference- Returns:
- {DoublePreference}
-
addSubroutine
protected AutonomousRoutine addSubroutine(AutonomousRoutine routine)
Indicate that another routine is a subroutine of this one. This does not affect the execution of code, but is used to display preferences to the driver station. Adding two subroutines with the same name has no effect.- Parameters:
routine
- The subroutine to add.- Returns:
- {AutonomousRoutine}
-
getSubroutines
public java.util.List<AutonomousRoutine> getSubroutines()
Get a list of all routines which are included as subroutines in this routine.- Returns:
- A list of AutonomousRoutine objects
-
initSendable
public void initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder builder)
-
equals
public boolean equals(java.lang.Object other)
Two AutonomousRoutines are considered to be equal if they have the same name, with the exception that two unnamed routines are equivalent iff they occupy the same memory location.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
equals(java.lang.Object)
-
-