Package ca.team3161.lib.robot.subsystem
Interface Subsystem
-
- All Known Implementing Classes:
AbstractController,AbstractDrivetrainBase,AbstractIndependentSubsystem,AbstractPooledSubsystem,AbstractPositionEstimator,AbstractSubsystem,ArcadeDrivetrain,BlinkinLEDController,DualSmartDashboardTuner,LogitechAttack3,LogitechDualAction,MecanumDrivetrain,MecanumPositionEstimator,OneShotIndependentSubsystem,OneShotPooledSubsystem,PIDDrivetrain,RepeatingIndependentSubsystem,RepeatingPooledSubsystem,SkidSteerPositionEstimator,SmartDashboardTuner,SmartPIDTuner,TankDrivetrain,WPISmartPIDTuner
public interface SubsystemAn interface for defining structures which require use of some (physical) resources, and which performs a specific task with these resources, either once or periodically.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()Stop this Subsystem's background task.voiddefineResources()Define the set of resourceLocks required for this Subsystem's task.java.util.concurrent.Future<?>getJob()Get the job representing the execution of this Subsystem's task.booleanisCancelled()Check if this subsystem's task has been cancelled.booleanisDone()Check if this subsystem's task has been completed.booleanisScheduled()Check if this subsystem's task is scheduled to execute.booleanisStarted()Check if this subsystem's task has been started.voidrequire(java.lang.Object resource)Define a resource which this Subsystem requires exclusive access to while its task runs.voidstart()Start (or restart) this Subsystem's background task.voidtask()The background task to run.
-
-
-
Method Detail
-
require
void require(java.lang.Object resource)
Define a resource which this Subsystem requires exclusive access to while its task runs.- Parameters:
resource- the required resource.
-
isCancelled
boolean isCancelled()
Check if this subsystem's task has been cancelled.- Returns:
- true iff cancelled.
-
isStarted
boolean isStarted()
Check if this subsystem's task has been started.- Returns:
- true iff started.
-
isScheduled
boolean isScheduled()
Check if this subsystem's task is scheduled to execute.- Returns:
- true iff scheduled.
-
isDone
boolean isDone()
Check if this subsystem's task has been completed. This is never true for repeating subsystems, which are always "Not Started", "Scheduled", or "Cancelled".- Returns:
- true iff completed.
-
cancel
void cancel()
Stop this Subsystem's background task. If this is a one-shot subsystem, the task will never be run if it has not already started. If it has already started, the task may be cancelled partway through execution. If it has already completed, this has no effect. For repeating subsystems, tasks in progress may be cancelled partway through execution, and in any case, future tasks will no longer be run.
-
start
void start()
Start (or restart) this Subsystem's background task.
-
defineResources
void defineResources()
Define the set of resourceLocks required for this Subsystem's task.- See Also:
AbstractSubsystem.require(Object)
-
task
void task() throws java.lang.Exception
The background task to run.- Throws:
java.lang.Exception- in case the defined task throws any Exceptions
-
getJob
java.util.concurrent.Future<?> getJob()
Get the job representing the execution of this Subsystem's task.- Returns:
- the Future job.
-
-