java.lang.Object
org.firstinspires.ftc.teamcode.fy23.processors.IMUCorrector

public class IMUCorrector extends Object
Uses the IMU to actively maintain the current heading unless a deliberate turn is detected. Also lets you "square up", or use the IMU to accurately turn to the nearest cardinal direction.
  • Constructor Details

  • Method Details

    • correctDTS

      public DTS correctDTS(DTS driver)
      The drive and strafe values will remain unmodified, but the turn power will be replaced by the correction power given by the TunablePID instance given in the Parameters.
      Parameters:
      driver - The DTS that represents what the driver wants to do (i.e. the requested turn power).
    • squareUp

      public void squareUp()
      Sets the target heading to the nearest cardinal direction.
    • getTargetHeading

      public double getTargetHeading()
      Returns the target heading (in degrees).
    • setTargetHeading

      public void setTargetHeading(double targetHeading)
      Sets the target heading (in degrees).
    • getHeadingError

      public double getHeadingError()
      Returns how far away the heading is from the target (in degrees).
    • getLastHeadingError

      public double getLastHeadingError()
      This is probably only useful for debugging IMUCorrector.
    • hasHitTarget

      public boolean hasHitTarget()
    • isTurning

      public boolean isTurning()
      Returns true if IMUCorrector thinks that the driver is currently trying to turn.