Class IMUCorrector
java.lang.Object
org.firstinspires.ftc.teamcode.fy23.processors.IMUCorrector
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncorrectDTS
(DTS driver) The drive and strafe values will remain unmodified, but the turn power will be replaced by the correction power given by theTunablePID
instance given in the Parameters.double
Returns how far away the heading is from the target (in degrees).double
This is probably only useful for debugging IMUCorrector.double
Returns the target heading (in degrees).boolean
boolean
Returns true if IMUCorrector thinks that the driver is currently trying to turn.void
setTargetHeading
(double targetHeading) Sets the target heading (in degrees).void
squareUp()
Sets the target heading to the nearest cardinal direction.
-
Constructor Details
-
IMUCorrector
-
-
Method Details
-
correctDTS
The drive and strafe values will remain unmodified, but the turn power will be replaced by the correction power given by theTunablePID
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.
-