Integrate shootAll on the Robot. This version was working except with 1 ball.

This commit is contained in:
2026-01-28 17:33:37 -06:00
parent 641d947ec6
commit 159b130b5f
3 changed files with 27 additions and 27 deletions

View File

@@ -5,16 +5,16 @@ import com.acmerobotics.dashboard.config.Config;
@Config @Config
public class ServoPositions { public class ServoPositions {
public static double spindexer_intakePos1 = 0.00; //0.13; public static double spindexer_intakePos1 = 0.05; //0.13;
public static double spindexer_intakePos2 = 0.19; //0.33;//0.5; public static double spindexer_intakePos2 = 0.24; //0.33;//0.5;
public static double spindexer_intakePos3 = 0.38; //0.53;//0.66; public static double spindexer_intakePos3 = 0.43; //0.53;//0.66;
public static double spindexer_outtakeBall3 = 0.65; //0.65; //0.24; public static double spindexer_outtakeBall3 = 0.70; //0.65; //0.24;
public static double spindexer_outtakeBall2 = 0.46; //0.46; //0.6; public static double spindexer_outtakeBall2 = 0.51; //0.46; //0.6;
public static double spindexer_outtakeBall1 = 0.27; //0.27; //0.4; public static double spindexer_outtakeBall1 = 0.32; //0.27; //0.4;
public static double spinStartPos = spindexer_outtakeBall3 - 0.1; public static double spinStartPos = spindexer_outtakeBall3 - 0.1;

View File

@@ -633,25 +633,25 @@ public class TeleopV3 extends LinearOpMode {
// TELE.addLine("shooting"); // TELE.addLine("shooting");
// } // }
if (shooterTicker == 0) { if (shooterTicker == 0) {
shooterTicker++;
spindexer.prepareShootAll(); spindexer.prepareShootAll();
TELE.addLine("preparing to shoot");
} else if (shooterTicker == 2) {
robot.transferServo.setPosition(transferServo_in);
spindexer.shootAll();
TELE.addLine("starting to shoot"); TELE.addLine("starting to shoot");
} else if (!spindexer.shootAllComplete()) { } else if (!spindexer.shootAllComplete()) {
robot.transferServo.setPosition(transferServo_in); robot.transferServo.setPosition(transferServo_in);
shooterTicker++;
spindexer.shootAll();
TELE.addLine("shoot"); TELE.addLine("shoot");
} else { } else {
robot.transferServo.setPosition(transferServo_out); robot.transferServo.setPosition(transferServo_out);
//spindexPos = spindexer_intakePos1; //spindexPos = spindexer_intakePos1;
shootAll = false; shootAll = false;
spindexer.resetSpindexer(); spindexer.resetSpindexer();
//spindexer.processIntake(); //spindexer.processIntake();
TELE.addLine("stop shooting"); TELE.addLine("stop shooting");
} }
spindexer.processIntake(); shooterTicker++;
//spindexer.processIntake();
} }
if (gamepad1.left_stick_button){ if (gamepad1.left_stick_button){

View File

@@ -343,21 +343,21 @@ public class Spindexer {
// Find Next Open Position and start movement // Find Next Open Position and start movement
double currentSpindexerPos = servos.getSpinPos(); double currentSpindexerPos = servos.getSpinPos();
double commandedtravelDistance = 2.0; double commandedtravelDistance = 2.0;
//double proposedTravelDistance = Math.abs(intakePositions[0] - currentSpindexerPos); double proposedTravelDistance = Math.abs(intakePositions[0] - currentSpindexerPos);
//if (ballPositions[0].isEmpty && (proposedTravelDistance < commandedtravelDistance)) { //if (ballPositions[0].isEmpty && (proposedTravelDistance < commandedtravelDistance)) {
if (ballPositions[0].isEmpty) { if (ballPositions[0].isEmpty) {
// Position 1 // Position 1
commandedIntakePosition = 0; commandedIntakePosition = 0;
currentIntakeState = Spindexer.IntakeState.MOVING; currentIntakeState = Spindexer.IntakeState.MOVING;
} }
//proposedTravelDistance = Math.abs(intakePositions[1] - currentSpindexerPos); proposedTravelDistance = Math.abs(intakePositions[1] - currentSpindexerPos);
//if (ballPositions[1].isEmpty && (proposedTravelDistance < commandedtravelDistance)) { //if (ballPositions[1].isEmpty && (proposedTravelDistance < commandedtravelDistance)) {
if (ballPositions[1].isEmpty) { if (ballPositions[1].isEmpty) {
// Position 2 // Position 2
commandedIntakePosition = 1; commandedIntakePosition = 1;
currentIntakeState = Spindexer.IntakeState.MOVING; currentIntakeState = Spindexer.IntakeState.MOVING;
} }
//proposedTravelDistance = Math.abs(intakePositions[2] - currentSpindexerPos); proposedTravelDistance = Math.abs(intakePositions[2] - currentSpindexerPos);
if (ballPositions[2].isEmpty) { if (ballPositions[2].isEmpty) {
// Position 3 // Position 3
commandedIntakePosition = 2; commandedIntakePosition = 2;
@@ -416,18 +416,18 @@ public class Spindexer {
case SHOOTNEXT: case SHOOTNEXT:
// Find Next Open Position and start movement // Find Next Open Position and start movement
if (!ballPositions[0].isEmpty) { if (!ballPositions[1].isEmpty) {
// Position 1 // Position 1
commandedIntakePosition = 0;
currentIntakeState = Spindexer.IntakeState.SHOOTMOVING;
} else if (!ballPositions[1].isEmpty) { // Possible error: should it be !ballPosition[1].isEmpty?
// Position 2
commandedIntakePosition = 1; commandedIntakePosition = 1;
currentIntakeState = Spindexer.IntakeState.SHOOTMOVING; currentIntakeState = Spindexer.IntakeState.SHOOTMOVING;
} else if (!ballPositions[2].isEmpty) { // Possible error: should it be !ballPosition[2].isEmpty? } else if (!ballPositions[2].isEmpty) {
// Position 3 // Position 2
commandedIntakePosition = 2; commandedIntakePosition = 2;
currentIntakeState = Spindexer.IntakeState.SHOOTMOVING; currentIntakeState = Spindexer.IntakeState.SHOOTMOVING;
} else if (!ballPositions[0].isEmpty) {
// Position 3
commandedIntakePosition = 0;
currentIntakeState = Spindexer.IntakeState.SHOOTMOVING;
} else { } else {
// Empty return to intake state // Empty return to intake state
currentIntakeState = IntakeState.FINDNEXT; currentIntakeState = IntakeState.FINDNEXT;
@@ -452,16 +452,16 @@ public class Spindexer {
} else { } else {
shootWaitCount++; shootWaitCount++;
} }
// wait 3 cycles // wait 10 cycles
if ((shootWaitCount > 15) && (servos.spinEqual(outakePositions[commandedIntakePosition]))) { if (shootWaitCount > 2) {
currentIntakeState = Spindexer.IntakeState.SHOOTNEXT; currentIntakeState = Spindexer.IntakeState.SHOOTNEXT;
ballPositions[commandedIntakePosition].isEmpty = true; ballPositions[commandedIntakePosition].isEmpty = true;
shootWaitCount = 0;
//stopSpindexer(); //stopSpindexer();
//detectBalls(true, false); //detectBalls(true, false);
} else {
// Keep moving the spindexer
moveSpindexerToPos(outakePositions[commandedIntakePosition]);
} }
// Keep moving the spindexer
moveSpindexerToPos(outakePositions[commandedIntakePosition]+(shootWaitCount*0.01));
break; break;
default: default: