Class TractionControlModule

  • 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
    • 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 encoder
        rightEncoder - the right encoder
        strength - 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: DriveModule
        Run the drive module
        Specified by:
        run in interface DriveModule
        Parameters:
        currentSpeed - the current speed of the drivetrain
        desiredSpeed - the desired speed of the drivetrain
        deltaTime - the delta time since the last call in seconds
        Returns:
        the speed the drivetrain should set