Package ca.team3161.lib.robot.subsystem
Class AbstractIndependentSubsystem
- java.lang.Object
-
- ca.team3161.lib.robot.subsystem.AbstractSubsystem
-
- ca.team3161.lib.robot.subsystem.AbstractIndependentSubsystem
-
- All Implemented Interfaces:
Subsystem
- Direct Known Subclasses:
OneShotIndependentSubsystem
,RepeatingIndependentSubsystem
public abstract class AbstractIndependentSubsystem extends AbstractSubsystem
Abstracts a system which uses resourceLocks and has some task (recurring or one-shot) to be performed. An example is PID control - monitor sensors and periodically set motor values based on this. Independent subsystems do not share a common work queue, and so independent subsystems are suitable for tasks which contain long-running operations (which includes any Thread.sleeps, Timers, while(true) loops, etc), as this will not affect other Subsystems' execution. However, there is more overhead involved with this. If you do not need a Subsystem which is able to execute long-running operations without interfering with other Subsystems, use a PooledSubsystem so that the workload can be shared among threads.- See Also:
AbstractPooledSubsystem
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
AbstractSubsystem.RunTask
-
-
Field Summary
-
Fields inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
job, resourceLocks, THREAD_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractIndependentSubsystem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ScheduledExecutorService
getExecutorService()
Get the executor service which executes this subsystem's tasks.-
Methods inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
acquireResources, cancel, getJob, isCancelled, isScheduled, isStarted, releaseResources, require
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.team3161.lib.robot.subsystem.Subsystem
defineResources, isDone, start, task
-
-
-
-
Method Detail
-
getExecutorService
public java.util.concurrent.ScheduledExecutorService getExecutorService()
Description copied from class:AbstractSubsystem
Get the executor service which executes this subsystem's tasks. This service may or may not be shared with other subsystems; for Independent subsystems it is never shared, and for Pooled subsystems it is always shared.- Specified by:
getExecutorService
in classAbstractSubsystem
- Returns:
- the executor service.
- See Also:
AbstractIndependentSubsystem
,AbstractPooledSubsystem
-
-