Class MecanumDrivetrain
- 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.MecanumDrivetrain
-
- All Implemented Interfaces:
LifecycleListener
,Subsystem
,ComposedComponent<java.lang.Object>
public class MecanumDrivetrain extends AbstractDrivetrainBase implements ComposedComponent<java.lang.Object>
A prepackaged mecanum drive solution, suitable for 4-wheeled Mecanum drivetrains. SeeVelocityController
for a recommended SpeedController to use for each wheel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MecanumDrivetrain.Builder
A Builder for mecanum 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<java.lang.Object>
getComposedComponents()
Get the composed components within this one.void
setForwardTarget(double forwardTarget)
Set the "forward target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward, -1.0 representing full speed backward, and 0 representing no forward or backward movement.void
setRotateTarget(double rotateTarget)
Set the "rotate target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed clockwise, -1.0 representing full speed counterclockwise, and 0 representing no rotation.void
setStrafeTarget(double strafeTarget)
Set the "strafe target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed right, -1.0 representing full speed left, and 0 representing no strafing.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)
-
setForwardTarget
public void setForwardTarget(double forwardTarget)
Set the "forward target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed forward, -1.0 representing full speed backward, and 0 representing no forward or backward movement.- Parameters:
forwardTarget
- the forward target
-
setStrafeTarget
public void setStrafeTarget(double strafeTarget)
Set the "strafe target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed right, -1.0 representing full speed left, and 0 representing no strafing.- Parameters:
strafeTarget
- the forward target
-
setRotateTarget
public void setRotateTarget(double rotateTarget)
Set the "rotate target", which is a value in the range [-1.0, 1.0]; 1.0 representing full speed clockwise, -1.0 representing full speed counterclockwise, and 0 representing no rotation.- Parameters:
rotateTarget
- the forward 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<java.lang.Object> getComposedComponents()
Get the composed components within this one.- Specified by:
getComposedComponents
in interfaceComposedComponent<java.lang.Object>
- Returns:
- the composed components.
-
-