Class AnchorModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.AnchorModule
-
- All Implemented Interfaces:
DriveModule
public class AnchorModule extends java.lang.Object implements DriveModule
A drivetrain module which will lock the drivetrain in place while a trigger condition is met
-
-
Constructor Summary
Constructors Constructor Description AnchorModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, double strength)
Default constructorAnchorModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, com.kylecorry.pid.PID pid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
holdPosition()
boolean
overridesUser()
Determines if the module should override the user's inputDriveSpeed
run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Run the drive modulevoid
setLeftEncoder(edu.wpi.first.wpilibj.Encoder leftEncoder)
void
setPID(com.kylecorry.pid.PID pid)
void
setRightEncoder(edu.wpi.first.wpilibj.Encoder rightEncoder)
void
stopHoldingPosition()
-
-
-
Constructor Detail
-
AnchorModule
public AnchorModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, double strength)
Default constructor- Parameters:
leftEncoder
- the left encoderrightEncoder
- the right encoderstrength
- the fortify strength (higher values may become unstable, small values recommended. Values must be greater than or equal to 0)
-
AnchorModule
public AnchorModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, com.kylecorry.pid.PID pid)
-
-
Method Detail
-
run
public DriveSpeed run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Description copied from interface:DriveModule
Run the drive module- Specified by:
run
in interfaceDriveModule
- Parameters:
currentSpeed
- the current speed of the drivetraindesiredSpeed
- the desired speed of the drivetraindeltaTime
- the delta time since the last call in seconds- Returns:
- the speed the drivetrain should set
-
overridesUser
public boolean overridesUser()
Description copied from interface:DriveModule
Determines if the module should override the user's input- Specified by:
overridesUser
in interfaceDriveModule
- Returns:
- true if it overrides the user's input
-
holdPosition
public void holdPosition()
-
stopHoldingPosition
public void stopHoldingPosition()
-
setLeftEncoder
public void setLeftEncoder(edu.wpi.first.wpilibj.Encoder leftEncoder)
-
setRightEncoder
public void setRightEncoder(edu.wpi.first.wpilibj.Encoder rightEncoder)
-
setPID
public void setPID(com.kylecorry.pid.PID pid)
-
-