added loop time fixes

This commit is contained in:
2026-02-10 18:37:06 -06:00
parent 4488fabecf
commit 48b5925b15
4 changed files with 10 additions and 9 deletions

View File

@@ -55,14 +55,14 @@ public class Flywheel {
private double TPS_to_RPM (double TPS) { return (TPS*60.0)/28.0;} private double TPS_to_RPM (double TPS) { return (TPS*60.0)/28.0;}
public double manageFlywheel(double commandedVelocity) { public double manageFlywheel(double commandedVelocity) {
targetVelocity = commandedVelocity;
// Add code here to set PIDF based on desired RPM // Add code here to set PIDF based on desired RPM
robot.shooter1.setPIDFCoefficients(DcMotor.RunMode.RUN_USING_ENCODER, shooterPIDF1); if (targetVelocity != commandedVelocity){
robot.shooter2.setPIDFCoefficients(DcMotor.RunMode.RUN_USING_ENCODER, shooterPIDF2); robot.shooter1.setVelocity(RPM_to_TPS(commandedVelocity));
robot.shooter1.setVelocity(RPM_to_TPS(targetVelocity)); robot.shooter2.setVelocity(RPM_to_TPS(commandedVelocity));
robot.shooter2.setVelocity(RPM_to_TPS(targetVelocity)); }
targetVelocity = commandedVelocity;
// Record Current Velocity // Record Current Velocity
velo1 = TPS_to_RPM(robot.shooter1.getVelocity()); velo1 = TPS_to_RPM(robot.shooter1.getVelocity());

View File

@@ -45,7 +45,7 @@ public class Servos {
return prevSpinPos; return prevSpinPos;
} }
public boolean servoPosEqual(double pos1, double pos2) { public static boolean servoPosEqual(double pos1, double pos2) {
return (Math.abs(pos1 - pos2) < 0.005); return (Math.abs(pos1 - pos2) < 0.005);
} }

View File

@@ -49,6 +49,7 @@ public class Spindexer {
public double spindexerOuttakeWiggle = 0.01; public double spindexerOuttakeWiggle = 0.01;
private double prevPos = 0.0; private double prevPos = 0.0;
public double spindexerPosOffset = 0.00; public double spindexerPosOffset = 0.00;
public static int shootWaitMax = 4;
public Types.Motif desiredMotif = Types.Motif.NONE; public Types.Motif desiredMotif = Types.Motif.NONE;
// For Use // For Use
enum RotatedBallPositionNames { enum RotatedBallPositionNames {
@@ -474,7 +475,6 @@ public class Spindexer {
break; break;
case SHOOTWAIT: case SHOOTWAIT:
double shootWaitMax = 4;
// Stopping when we get to the new position // Stopping when we get to the new position
if (prevIntakeState != currentIntakeState) { if (prevIntakeState != currentIntakeState) {
if (commandedIntakePosition==2) { if (commandedIntakePosition==2) {

View File

@@ -37,7 +37,8 @@ public class Turret {
// TODO: tune these values for limelight // TODO: tune these values for limelight
public static double clampTolerance = 0.03; public static double clampTolerance = 0.03;
public static double B_PID_P = 0.105, B_PID_I = 0.0, B_PID_D = 0.0125; //public static double B_PID_P = 0.105, B_PID_I = 0.0, B_PID_D = 0.0125;
public static double B_PID_P = 0.095, B_PID_I = 0.0, B_PID_D = 0.0090;
Robot robot; Robot robot;
MultipleTelemetry TELE; MultipleTelemetry TELE;
Limelight3A webcam; Limelight3A webcam;