9 Commits

Author SHA1 Message Date
KeshavAnandCode
7043274ebd test commit 3 2026-03-18 15:15:38 -05:00
KeshavAnandCode
bd05090afe test commit 2 2026-03-18 15:08:27 -05:00
KeshavAnandCode
369e379eb4 test comit 2026-03-18 15:05:37 -05:00
Keshav Anand
41853e9ad1 Testing new commit stattion 2026-03-09 16:42:00 -05:00
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
9 changed files with 94 additions and 65 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

@@ -45,9 +45,9 @@ public class TeleopV3 extends LinearOpMode {
public double vel = 3000; public double vel = 3000;
public boolean autoVel = true; public boolean autoVel = true;
public boolean targetingHood = true; public boolean targetingHood = true;
// public boolean autoHood = true; // public boolean autoHood = true;
public double shootStamp = 0.0; public double shootStamp = 0.0;
// boolean fixedTurret = false; // boolean fixedTurret = false;
Robot robot; Robot robot;
MultipleTelemetry TELE; MultipleTelemetry TELE;
Light light; Light light;
@@ -66,10 +66,10 @@ public class TeleopV3 extends LinearOpMode {
double xOffset = 0.0; double xOffset = 0.0;
double yOffset = 0.0; double yOffset = 0.0;
double hOffset = 0.0; double hOffset = 0.0;
// double headingOffset = 0.0; // double headingOffset = 0.0;
int ticker = 0; int ticker = 0;
// boolean autoSpintake = false; // boolean autoSpintake = false;
boolean enableSpindexerManager = true; boolean enableSpindexerManager = true;
// boolean overrideTurr = false; // boolean overrideTurr = false;
@@ -142,12 +142,7 @@ public class TeleopV3 extends LinearOpMode {
//DRIVETRAIN: //DRIVETRAIN:
drivetrain.drive( drivetrain.drive(-gamepad1.right_stick_y, gamepad1.right_stick_x, gamepad1.left_stick_x, gamepad1.left_trigger);
-gamepad1.right_stick_y,
gamepad1.right_stick_x,
gamepad1.left_stick_x,
gamepad1.left_trigger
);
if (gamepad1.right_bumper) { if (gamepad1.right_bumper) {
@@ -156,10 +151,10 @@ public class TeleopV3 extends LinearOpMode {
light.setState(StateEnums.LightState.BALL_COUNT); light.setState(StateEnums.LightState.BALL_COUNT);
} else if (gamepad2.triangle){ } else if (gamepad2.triangle) {
light.setState(StateEnums.LightState.BALL_COLOR); light.setState(StateEnums.LightState.BALL_COLOR);
} else { } else {
light.setState(StateEnums.LightState.GOAL_LOCK); light.setState(StateEnums.LightState.GOAL_LOCK);
} }
@@ -182,17 +177,16 @@ public class TeleopV3 extends LinearOpMode {
// double distanceToGoal = Math.sqrt(dx * dx + dy * dy); // double distanceToGoal = Math.sqrt(dx * dx + dy * dy);
targetingSettings = targeting.calculateSettings targetingSettings = targeting.calculateSettings(robotX, robotY, robotHeading, 0.0, turretInterpolate);
(robotX, robotY, robotHeading, 0.0, turretInterpolate);
//RELOCALIZATION //RELOCALIZATION
if (gamepad2.squareWasPressed()){ if (gamepad2.squareWasPressed()) {
relocalize = !relocalize; relocalize = !relocalize;
gamepad2.rumble(500); gamepad2.rumble(500);
} }
if (relocalize){ if (relocalize) {
turret.relocalize(); turret.relocalize();
xOffset = -((turret.getLimelightZ() * 39.3701) + Turret.limelightPosOffset) - robX; xOffset = -((turret.getLimelightZ() * 39.3701) + Turret.limelightPosOffset) - robX;
yOffset = (turret.getLimelightX() * 39.3701) - robY; yOffset = (turret.getLimelightX() * 39.3701) - robY;
@@ -231,6 +225,7 @@ public class TeleopV3 extends LinearOpMode {
//HOOD: //HOOD:
if (targetingHood) { if (targetingHood) {
servo.setHoodPos(targetingSettings.hoodAngle + autoHoodOffset); servo.setHoodPos(targetingSettings.hoodAngle + autoHoodOffset);
} else { } else {
@@ -267,7 +262,6 @@ public class TeleopV3 extends LinearOpMode {
} }
if (enableSpindexerManager) { if (enableSpindexerManager) {
//if (!shootAll) { //if (!shootAll) {
spindexer.processIntake(); spindexer.processIntake();
@@ -299,7 +293,7 @@ public class TeleopV3 extends LinearOpMode {
if (shooterTicker == 0) { if (shooterTicker == 0) {
spindexer.prepareShootAllContinous(); spindexer.prepareShootAllContinous();
//TELE.addLine("preparing to shoot"); //TELE.addLine("preparing to shoot");
// } else if (shooterTicker == 2) { // else if (shooterTicker == 2) {
// //servo.setTransferPos(transferServo_in); // //servo.setTransferPos(transferServo_in);
// spindexer.shootAll(); // spindexer.shootAll();
// TELE.addLine("starting to shoot"); // TELE.addLine("starting to shoot");

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;
// } // }
lightColor = Color.LightRed; if (llCoast <= 0) {
currentTrackOffset = 0.0; TELE.addData("LL No Track: ", llCoast);
currentTrackCount = 0; lightColor = Color.LightRed;
currentTrackOffset = 0.0;
currentTrackCount = 0;
} else {
TELE.addData("LL Coasting: ", llCoast);
llCoast--;
}
} }
// Apply accumulated offset // Apply accumulated offset

View File

@@ -6,7 +6,6 @@ repositories {
maven { url = 'https://maven.brott.dev/' } //RR maven { url = 'https://maven.brott.dev/' } //RR
maven { url = "https://maven.rowanmcalpin.com/" } //Next FTC maven { url = "https://maven.rowanmcalpin.com/" } //Next FTC
maven { url = "https://repo.dairy.foundation/releases" } //AS maven { url = "https://repo.dairy.foundation/releases" } //AS
} }
dependencies { dependencies {
@@ -25,8 +24,6 @@ dependencies {
implementation 'com.pedropathing:ftc:2.0.6' //PedroCore implementation 'com.pedropathing:ftc:2.0.6' //PedroCore
implementation 'com.pedropathing:telemetry:1.0.0' //PedroTele implementation 'com.pedropathing:telemetry:1.0.0' //PedroTele
implementation 'com.bylazar:fullpanels:1.0.2' //Panels implementation 'com.bylazar:fullpanels:1.0.2' //Panels
implementation 'org.ftclib.ftclib:core:2.1.1' // FTC LIB implementation 'org.ftclib.ftclib:core:2.1.1' // FTC LIB
implementation 'com.rowanmcalpin.nextftc:core:0.6.2' //NEXT FTC implementation 'com.rowanmcalpin.nextftc:core:0.6.2' //NEXT FTC