5 Commits

Author SHA1 Message Date
c01edd9308 worlin 2026-02-27 17:25:50 -06:00
ccfac3e123 Merge remote-tracking branch 'origin/LimelightCoast' 2026-02-27 17:22:38 -06:00
395d4439db Commit working auto front 2026-02-27 17:22:01 -06:00
5f33cb4d41 Add limelight coast at 2 seconds. 2026-02-27 17:13:16 -06:00
e92f11bc69 stash 2026-02-27 16:00:38 -06:00
7 changed files with 82 additions and 44 deletions

View File

@@ -59,19 +59,19 @@ public class Auto_LT_Close extends LinearOpMode {
public static double hood0MoveTime = 2; public static double hood0MoveTime = 2;
public static double spindexerSpeedIncrease = 0.014; public static double spindexerSpeedIncrease = 0.014;
public static double shootAllTime = 10.0; public static double shootAllTime = 6.0;
public static double intake1Time = 3.3; public static double intake1Time = 3.3;
public static double intake2Time = 3.8; public static double intake2Time = 4.2;
public static double intake3Time = 4.2; public static double intake3Time = 5.4;
public static double flywheel0Time = 2.2; public static double flywheel0Time = 1.9;
public static double pickup1Speed = 22; public static double pickup1Speed = 14;
// ---- POSITION TOLERANCES ---- // ---- POSITION TOLERANCES ----
public static double posXTolerance = 5.0; public static double posXTolerance = 5.0;
public static double posYTolerance = 5.0; public static double posYTolerance = 5.0;
// ---- OBELISK DETECTION ---- // ---- OBELISK DETECTION ----
public static double shoot1Time = 3.0; public static double shoot1Time = 2.5;
public static double shoot2Time = 2.5; public static double shoot2Time = 2.5;
public static double shoot3Time = 2.5; public static double shoot3Time = 2.5;
public static double colorSenseTime = 1.2; public static double colorSenseTime = 1.2;
@@ -478,15 +478,15 @@ public class Auto_LT_Close extends LinearOpMode {
if (gateCycle) { if (gateCycle) {
startAutoGate(); startAutoGate();
shoot(); shoot(0.501, 0.501, 0.501);
cycleStackMiddleGate(); cycleStackMiddleGate();
shoot(); shoot(0.501,0.501, 0.501);
while (getRuntime() - stamp < endGateTime) { while (getRuntime() - stamp < endGateTime) {
cycleGateIntake(); cycleGateIntake();
if (getRuntime() - stamp < lastShootTime) { if (getRuntime() - stamp < lastShootTime) {
cycleGateShoot(); cycleGateShoot();
shoot(); shoot(0.501, 0.501, 0.501);
} }
} }
cycleStackCloseIntakeGate(); cycleStackCloseIntakeGate();
@@ -495,25 +495,28 @@ public class Auto_LT_Close extends LinearOpMode {
cycleStackCloseShootGate(); cycleStackCloseShootGate();
} }
shoot(); shoot(0.501, 0.501, 0.501);
} else { } else {
startAuto(); startAuto();
shoot(); shoot(0.501, 0.501,0.501);
if (ballCycles > 0) { if (ballCycles > 0) {
cycleStackClose(); cycleStackClose();
shoot(); shoot(xShoot, yShoot, hShoot);
} }
if (ballCycles > 1) { if (ballCycles > 1) {
cycleStackMiddle(); cycleStackMiddle();
shoot(); shoot(xShoot, yShoot, hShoot);
} }
if (ballCycles > 2) { if (ballCycles > 2) {
cycleStackFar(); cycleStackFar();
shoot(); shoot(xLeave, yLeave, hLeave);
} }
} }
@@ -534,8 +537,8 @@ public class Auto_LT_Close extends LinearOpMode {
} }
void shoot() { void shoot(double x, double y, double z) {
Actions.runBlocking(autoActions.shootAllAuto(shootAllTime, spindexerSpeedIncrease)); Actions.runBlocking(autoActions.shootAllAuto(shootAllTime, spindexerSpeedIncrease, x, y, z));
} }
void startAuto() { void startAuto() {
@@ -545,7 +548,7 @@ public class Auto_LT_Close extends LinearOpMode {
new ParallelAction( new ParallelAction(
shoot0.build(), shoot0.build(),
autoActions.prepareShootAll( autoActions.prepareShootAll(
colorSenseTime, 0.8,
flywheel0Time, flywheel0Time,
motif, motif,
x1, x1,

View File

@@ -321,7 +321,7 @@ public class Auto_LT_Far extends LinearOpMode {
void shoot(){ void shoot(){
Actions.runBlocking( Actions.runBlocking(
new ParallelAction( new ParallelAction(
autoActions.shootAllAuto(shootAllTime, spindexerSpeedIncrease) autoActions.shootAllAuto(shootAllTime, spindexerSpeedIncrease, 0.501, 0.501, 0.501)
) )
); );

View File

@@ -21,6 +21,7 @@ import com.acmerobotics.roadrunner.Pose2d;
import com.qualcomm.robotcore.hardware.NormalizedRGBA; import com.qualcomm.robotcore.hardware.NormalizedRGBA;
import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.firstinspires.ftc.teamcode.constants.Color;
import org.firstinspires.ftc.teamcode.constants.ServoPositions; import org.firstinspires.ftc.teamcode.constants.ServoPositions;
import org.firstinspires.ftc.teamcode.constants.StateEnums; import org.firstinspires.ftc.teamcode.constants.StateEnums;
import org.firstinspires.ftc.teamcode.libs.RR.MecanumDrive; import org.firstinspires.ftc.teamcode.libs.RR.MecanumDrive;
@@ -207,7 +208,8 @@ public class AutoActions {
} else { } else {
firstSpindexShootPos = spindexer_outtakeBall3b; firstSpindexShootPos = spindexer_outtakeBall3b;
shootForward = true; shootForward = true;
spinEndPos = 0.95; } spinEndPos = 0.95;
}
} else if (motif_id == 22) { } else if (motif_id == 22) {
if (mostGreenSlot == 1) { if (mostGreenSlot == 1) {
firstSpindexShootPos = spindexer_outtakeBall3b; firstSpindexShootPos = spindexer_outtakeBall3b;
@@ -253,7 +255,7 @@ public class AutoActions {
}; };
} }
public Action shootAllAuto(double shootTime, double spindexSpeed) { public Action shootAllAuto(double shootTime, double spindexSpeed, double posX, double posY, double posH) {
return new Action() { return new Action() {
int ticker = 1; int ticker = 1;
@@ -275,7 +277,7 @@ public class AutoActions {
if (ticker == 1) { if (ticker == 1) {
stamp = System.currentTimeMillis(); stamp = System.currentTimeMillis();
manageShooter = manageShooterAuto(shootTime, 0.501, 0.501, 0.501, false); manageShooter = manageShooterAuto(shootTime, posX, posY, posH, false);
} }
ticker++; ticker++;
@@ -423,7 +425,8 @@ public class AutoActions {
manageShooter.run(telemetryPacket); manageShooter.run(telemetryPacket);
if ((System.currentTimeMillis() - stamp) > (time * 1000) || spindexer.isFull()) { if ((System.currentTimeMillis() - stamp) > (time * 1000)) {
servos.setSpinPos(spindexer_intakePos1);
return false; return false;
} else { } else {
return true; return true;
@@ -513,14 +516,26 @@ public class AutoActions {
final boolean timeFallback = (time != 0.501); final boolean timeFallback = (time != 0.501);
@Override @Override
public boolean run(@NonNull TelemetryPacket telemetryPacket) { public boolean run(@NonNull TelemetryPacket telemetryPacket) {
drive.updatePoseEstimate(); drive.updatePoseEstimate();
Pose2d currentPose = drive.localizer.getPose(); Pose2d currentPose = drive.localizer.getPose();
if (ticker == 0) { if (ticker == 0) {
stamp = System.currentTimeMillis(); stamp = System.currentTimeMillis();
if (redAlliance) {
turret.pipelineSwitch(4);
light.setManualLightColor(Color.LightRed);
} else {
turret.pipelineSwitch(2);
light.setManualLightColor(Color.LightBlue);
}
} }
ticker++; ticker++;
@@ -535,14 +550,15 @@ public class AutoActions {
double dx = robotX - goalX; // delta x from robot to goal double dx = robotX - goalX; // delta x from robot to goal
double dy = robotY - goalY; // delta y from robot to goal double dy = robotY - goalY; // delta y from robot to goal
Pose2d deltaPose; Pose2d deltaPose;
if (posX != 0.501) { if (posX != 0.501) {
deltaPose = new Pose2d(posX, posY, Math.toRadians(posH)); deltaPose = new Pose2d(posX, posY, Math.toRadians(posH));
Turret.limelightUsed = false;
} else { } else {
deltaPose = new Pose2d(dx, dy, robotHeading); deltaPose = new Pose2d(dx, dy, robotHeading);
Turret.limelightUsed = true;
} }
Turret.limelightUsed = true;
// double distanceToGoal = Math.sqrt(dx * dx + dy * dy); // double distanceToGoal = Math.sqrt(dx * dx + dy * dy);

View File

@@ -5,18 +5,18 @@ import com.acmerobotics.dashboard.config.Config;
@Config @Config
public class ServoPositions { public class ServoPositions {
public static double spindexer_intakePos1 = 0.22; //0.13; public static double spindexer_intakePos1 = 0.18; //0.13;
public static double spindexer_intakePos2 = 0.41; //0.33;//0.5; public static double spindexer_intakePos2 = 0.37; //0.33;//0.5;
public static double spindexer_intakePos3 = 0.60; //0.53;//0.66; public static double spindexer_intakePos3 = 0.56; //0.53;//0.66;
public static double spindexer_outtakeBall3 = 0.88; //0.65; //0.24; public static double spindexer_outtakeBall3 = 0.84; //0.65; //0.24;
public static double spindexer_outtakeBall3b = 0.31; //0.65; //0.24; public static double spindexer_outtakeBall3b = 0.27; //0.65; //0.24;
public static double spindexer_outtakeBall2 = 0.7; //0.46; //0.6; public static double spindexer_outtakeBall2 = 0.66; //0.46; //0.6;
public static double spindexer_outtakeBall1 = 0.51; //0.27; //0.4; public static double spindexer_outtakeBall1 = 0.47; //0.27; //0.4;
public static double spinStartPos = 0.14; public static double spinStartPos = 0.10;
public static double spinEndPos = 0.95; public static double spinEndPos = 0.95;
public static double shootAllSpindexerSpeedIncrease = 0.014; public static double shootAllSpindexerSpeedIncrease = 0.014;

View File

@@ -95,7 +95,10 @@ public class SortingTest extends LinearOpMode {
Actions.runBlocking( Actions.runBlocking(
autoActions.shootAllAuto( autoActions.shootAllAuto(
3.5, 3.5,
0.014 0.014,
0.501,
0.501,
0.501
) )
); );
intaking = true; intaking = true;

View File

@@ -187,7 +187,7 @@ public class Spindexer {
distanceFrontPassenger = (colorFilterAlpha * dFrontPassenger) + ((1-colorFilterAlpha) * distanceFrontPassenger); distanceFrontPassenger = (colorFilterAlpha * dFrontPassenger) + ((1-colorFilterAlpha) * distanceFrontPassenger);
// Position 1 // Position 1
if (distanceRearCenter < 52) { if (distanceRearCenter < 48) {
// Mark Ball Found // Mark Ball Found
newPos1Detection = true; newPos1Detection = true;
@@ -200,9 +200,9 @@ public class Spindexer {
// FIXIT - Add filtering to improve accuracy. // FIXIT - Add filtering to improve accuracy.
if (gP >= 0.38) { if (gP >= 0.38) {
ballPositions[0].ballColor = BallColor.GREEN; // green ballPositions[commandedIntakePosition].ballColor = BallColor.GREEN; // green
} else { } else {
ballPositions[0].ballColor = BallColor.PURPLE; // purple ballPositions[commandedIntakePosition].ballColor = BallColor.PURPLE; // purple
} }
} }
} }
@@ -218,9 +218,9 @@ public class Spindexer {
double gP = color2RGBA.green / (color2RGBA.green + color2RGBA.red + color2RGBA.blue); double gP = color2RGBA.green / (color2RGBA.green + color2RGBA.red + color2RGBA.blue);
if (gP >= 0.4) { if (gP >= 0.4) {
ballPositions[2].ballColor = BallColor.GREEN; // green ballPositions[spindexerBallPos].ballColor = BallColor.GREEN; // green
} else { } else {
ballPositions[2].ballColor = BallColor.PURPLE; // purple ballPositions[spindexerBallPos].ballColor = BallColor.PURPLE; // purple
} }
} }
} else { } else {
@@ -244,10 +244,10 @@ public class Spindexer {
double gP = color3RGBA.green / (color3RGBA.green + color3RGBA.red + color3RGBA.blue); double gP = color3RGBA.green / (color3RGBA.green + color3RGBA.red + color3RGBA.blue);
if (gP >= 0.4) { if (gP >= 0.42) {
ballPositions[1].ballColor = BallColor.GREEN; // green ballPositions[spindexerBallPos].ballColor = BallColor.GREEN; // green
} else { } else {
ballPositions[1].ballColor = BallColor.PURPLE; // purple ballPositions[spindexerBallPos].ballColor = BallColor.PURPLE; // purple
} }
} }
} else { } else {

View File

@@ -59,6 +59,9 @@ public class Turret {
private int prevPipeline = -1; private int prevPipeline = -1;
PIDController bearingPID; PIDController bearingPID;
public int llCoast = 0;
public int LL_COAST_TICKS = 60;
public Turret(Robot rob, MultipleTelemetry tele, Limelight3A cam) { public Turret(Robot rob, MultipleTelemetry tele, Limelight3A cam) {
this.TELE = tele; this.TELE = tele;
this.robot = rob; this.robot = rob;
@@ -271,11 +274,18 @@ public class Turret {
turretAngleDeg += permanentOffset; turretAngleDeg += permanentOffset;
limelightRead(); limelightRead();
// Active correction if we see the target // Active correction if we see the target
if (result.isValid() && !lockOffset && limelightUsed) { if (result.isValid() && !lockOffset && limelightUsed) {
currentTrackOffset += bearingAlign(result); currentTrackOffset += bearingAlign(result);
currentTrackCount++; currentTrackCount++;
TELE.addData("LL Tracking: ", llCoast);
// Assume the last tracked value is always better than
// any previous value, even if its not fully aligned.
llCoast = LL_COAST_TICKS;
// double bearingError = Math.abs(tagBearingDeg); // double bearingError = Math.abs(tagBearingDeg);
// //
// if (bearingError > cameraBearingEqual) { // if (bearingError > cameraBearingEqual) {
@@ -306,9 +316,15 @@ public class Turret {
// if (currentTrackCount > 20) { // if (currentTrackCount > 20) {
// offset = currentTrackOffset; // offset = currentTrackOffset;
// } // }
if (llCoast <= 0) {
TELE.addData("LL No Track: ", llCoast);
lightColor = Color.LightRed; lightColor = Color.LightRed;
currentTrackOffset = 0.0; currentTrackOffset = 0.0;
currentTrackCount = 0; currentTrackCount = 0;
} else {
TELE.addData("LL Coasting: ", llCoast);
llCoast--;
}
} }
// Apply accumulated offset // Apply accumulated offset