Class 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 constructor
      AnchorModule​(edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder, com.kylecorry.pid.PID pid)  
    • 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 encoder
        rightEncoder - the right encoder
        strength - 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 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
      • overridesUser

        public boolean overridesUser()
        Description copied from interface: DriveModule
        Determines if the module should override the user's input
        Specified by:
        overridesUser in interface DriveModule
        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)