Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
you can now reset the IMU!
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyiLin committed Sep 7, 2024
1 parent 2d8df47 commit f91cf1a
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -989,4 +989,11 @@ public Path getCurrentPath() {
public DashboardPoseTracker getDashboardPoseTracker() {
return dashboardPoseTracker;
}

/**
* This resets the IMU, if applicable.
*/
public void resetIMU() {
poseUpdater.resetIMU();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
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;

Expand Down Expand Up @@ -336,4 +338,11 @@ public double getTotalHeading() {
public Localizer getLocalizer() {
return localizer;
}

/**
*
*/
public void resetIMU() {
localizer.resetIMU();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,10 @@ public double getLateralMultiplier() {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}

/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,10 @@ public double getLateralMultiplier() {
public double getTurningMultiplier() {
return otos.getAngularScalar();
}

/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,11 @@ public double getLateralMultiplier() {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}

/**
* This resets the IMU.
*/
public void resetIMU() {
imu.resetYaw();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,10 @@ public double getLateralMultiplier() {
public double getTurningMultiplier() {
return TURN_TICKS_TO_RADIANS;
}

/**
* This does nothing since this localizer does not use the IMU.
*/
public void resetIMU() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,11 @@ public double getLateralMultiplier() {
public double getTurningMultiplier() {
return 1;
}

/**
* This resets the IMU.
*/
public void resetIMU() {
imu.resetYaw();
}
}

0 comments on commit f91cf1a

Please sign in to comment.