Class TractionControlModule
- java.lang.Object
-
- com.thegongoliers.output.drivetrain.EncoderStabilityModule
-
- All Implemented Interfaces:
DriveModule
public class TractionControlModule extends java.lang.Object implements DriveModule
A drivetrain module which work to prevent wheel slip while driving straight
-
-
Constructor Summary
Constructors Constructor Description TractionControlModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, double strength, double slipThreshold)Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DriveSpeedrun(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)Run the drive module-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.thegongoliers.output.drivetrain.DriveModule
overridesUser
-
-
-
-
Constructor Detail
-
TractionControlModule
public TractionControlModule(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, double strength, double slipThreshold)Default constructor- Parameters:
leftEncoder- the left encoderrightEncoder- the right encoderstrength- the strength (higher values may become unstable, small values recommended. Values must be greater than or equal to 0)slipThreshold- the maximum slip ratio to consider as slipping
-
-
Method Detail
-
run
public DriveSpeed run(DriveSpeed currentSpeed, DriveSpeed desiredSpeed, double deltaTime)
Description copied from interface:DriveModuleRun the drive module- Specified by:
runin 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
-
-