you can now reset the IMU!

This commit is contained in:
brotherhobo
2024-09-07 17:36:52 -04:00
parent 2d8df47c59
commit f91cf1a8bf
8 changed files with 53 additions and 0 deletions

View File

@ -989,4 +989,11 @@ public class Follower {
public DashboardPoseTracker getDashboardPoseTracker() {
return dashboardPoseTracker;
}
/**
* This resets the IMU, if applicable.
*/
public void resetIMU() {
poseUpdater.resetIMU();
}
}

View File

@ -86,4 +86,9 @@ public abstract class Localizer {
* @return returns the turning ticks to radians multiplier
*/
public abstract double getTurningMultiplier();
/**
* This resets the IMU of the localizer, if applicable.
*/
public abstract void resetIMU();
}

View File

@ -5,7 +5,9 @@ import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.IMU;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers.ThreeWheelIMULocalizer;
import org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers.ThreeWheelLocalizer;
import org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers.TwoWheelLocalizer;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.MathFunctions;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Vector;
@ -336,4 +338,11 @@ public class PoseUpdater {
public Localizer getLocalizer() {
return localizer;
}
/**
*
*/
public void resetIMU() {
localizer.resetIMU();
}
}

View File

@ -263,4 +263,10 @@ public class DriveEncoderLocalizer extends Localizer {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}
/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}

View File

@ -209,4 +209,10 @@ public class OTOSLocalizer extends Localizer {
public double getTurningMultiplier() {
return otos.getAngularScalar();
}
/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}

View File

@ -306,4 +306,11 @@ public class ThreeWheelIMULocalizer extends Localizer {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}
/**
* This resets the IMU.
*/
public void resetIMU() {
imu.resetYaw();
}
}

View File

@ -283,4 +283,10 @@ public class ThreeWheelLocalizer extends Localizer {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}
/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}

View File

@ -289,4 +289,11 @@ public class TwoWheelLocalizer extends Localizer { // todo: make two wheel odo w
public double getTurningMultiplier() {
return 1;
}
/**
* This resets the IMU.
*/
public void resetIMU() {
imu.resetYaw();
}
}