Class TankDrivetrain
- java.lang.Object
-
- ca.team3161.lib.robot.subsystem.AbstractSubsystem
-
- ca.team3161.lib.robot.subsystem.AbstractPooledSubsystem
-
- ca.team3161.lib.robot.subsystem.RepeatingPooledSubsystem
-
- ca.team3161.lib.robot.motion.drivetrains.AbstractDrivetrainBase
-
- ca.team3161.lib.robot.motion.drivetrains.TankDrivetrain
-
- All Implemented Interfaces:
LifecycleListener
,Subsystem
,ComposedComponent<SpeedControllerGroup>
public class TankDrivetrain extends AbstractDrivetrainBase implements ComposedComponent<SpeedControllerGroup>
A prepackaged tankdrive solution, suitable for standard 4, 6, or even 8-wheeled tank drive variants. Various types and numbers of speed controllers can be used by providing different customized SpeedControllers. SeeSpeedControllerGroup
,VelocityController
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TankDrivetrain.Builder
A Builder for tank drivetrains.-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineResources()
Define the set of resourceLocks required for this Subsystem's task.java.util.Collection<SpeedControllerGroup>
getComposedComponents()
Get the composed components within this one.void
setLeftTarget(double leftTarget)
Set the "left target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward on the left side of the drivetrain, -1.0 representing full speed backward on the left side of the drivetrain, and 0 representing no movement on the left side of the drivetrain.void
setRightTarget(double rightTarget)
Set the "right target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward on the right side of the drivetrain, -1.0 representing full speed backward on the right side of the drivetrain, and 0 representing no movement on the right side of the drivetrain.void
stop()
Stop all movement by setting all motor target values to 0 and disabling them.void
task()
The background task to run.-
Methods inherited from class ca.team3161.lib.robot.motion.drivetrains.AbstractDrivetrainBase
onLifecycleChange
-
Methods inherited from class ca.team3161.lib.robot.subsystem.RepeatingPooledSubsystem
isDone, start
-
Methods inherited from class ca.team3161.lib.robot.subsystem.AbstractPooledSubsystem
getExecutorService
-
Methods inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
acquireResources, cancel, getJob, isCancelled, isScheduled, isStarted, releaseResources, require
-
-
-
-
Method Detail
-
defineResources
public void defineResources()
Define the set of resourceLocks required for this Subsystem's task.- Specified by:
defineResources
in interfaceSubsystem
- See Also:
AbstractSubsystem.require(Object)
-
setLeftTarget
public void setLeftTarget(double leftTarget)
Set the "left target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward on the left side of the drivetrain, -1.0 representing full speed backward on the left side of the drivetrain, and 0 representing no movement on the left side of the drivetrain.- Parameters:
leftTarget
- the left target
-
setRightTarget
public void setRightTarget(double rightTarget)
Set the "right target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward on the right side of the drivetrain, -1.0 representing full speed backward on the right side of the drivetrain, and 0 representing no movement on the right side of the drivetrain.- Parameters:
rightTarget
- the left target
-
stop
public void stop()
Stop all movement by setting all motor target values to 0 and disabling them.- Specified by:
stop
in classAbstractDrivetrainBase
-
task
public void task() throws java.lang.Exception
The background task to run.
-
getComposedComponents
public java.util.Collection<SpeedControllerGroup> getComposedComponents()
Get the composed components within this one.- Specified by:
getComposedComponents
in interfaceComposedComponent<SpeedControllerGroup>
- Returns:
- the composed components.
-
-