some changes

This commit is contained in:
2026-06-02 18:22:28 -05:00
parent 946deca751
commit 5c9ebf6eac
2 changed files with 47 additions and 46 deletions

View File

@@ -33,17 +33,17 @@ import org.firstinspires.ftc.teamcode.utils.Turret;
import java.util.List; import java.util.List;
@Config @Config
@Autonomous (preselectTeleOp = "TeleopV3") @Autonomous (preselectTeleOp = "TeleopV4")
public class Auto12BallPedroPathing extends LinearOpMode { public class Auto12BallPedroPathing extends LinearOpMode {
Robot robot; Robot robot;
MultipleTelemetry TELE; MultipleTelemetry TELE;
Flywheel flywheel; // Flywheel flywheel;
Targeting targeting; // Targeting targeting;
Targeting.Settings targetingSettings; // Targeting.Settings targetingSettings;
Follower follower; Follower follower;
Turret turret; // Turret turret;
Spindexer spindexer; // Spindexer spindexer;
Servos servos; // Servos servos;
MeasuringLoopTimes loopTimes; MeasuringLoopTimes loopTimes;
// Wait Times // Wait Times
@@ -222,10 +222,10 @@ public class Auto12BallPedroPathing extends LinearOpMode {
driveShoot(PathState.WAIT_SHOOT3, currentTime); driveShoot(PathState.WAIT_SHOOT3, currentTime);
break; break;
case WAIT_SHOOT3: case WAIT_SHOOT3:
if (spindexer.shootAllComplete()){ // if (spindexer.shootAllComplete()){
spindexer.resetSpindexer(); // spindexer.resetSpindexer();
TELE.addLine("Done Auto"); // TELE.addLine("Done Auto");
} // }
break; break;
default: default:
break; break;
@@ -237,21 +237,21 @@ public class Auto12BallPedroPathing extends LinearOpMode {
private void intakePowerDown(double stamp, double currentTime) { private void intakePowerDown(double stamp, double currentTime) {
double pow = (stamp - currentTime) / 2; // adjust denominator to see how much time to adjust double pow = (stamp - currentTime) / 2; // adjust denominator to see how much time to adjust
if (pow < -1) {pow = 0;} if (pow < -1) {pow = 0;}
spindexer.setIntakePower(pow); // spindexer.setIntakePower(pow);
} }
private void driveShoot(PathState nextState, double currentTime){ private void driveShoot(PathState nextState, double currentTime){
if (!follower.isBusy()){ if (!follower.isBusy()){
pathState = nextState; pathState = nextState;
timeStamp = currentTime; timeStamp = currentTime;
spindexer.prepareShootAllContinous(); // spindexer.prepareShootAllContinous();
} }
} }
private void waitShoot(PathState nextState, PathChain nextPath, double currentTime) { private void waitShoot(PathState nextState, PathChain nextPath, double currentTime) {
if (spindexer.shootAllComplete() || currentTime - timeStamp > shootTime) { if (currentTime - timeStamp > shootTime) { // spindexer.shootAllComplete() ||
spindexer.resetSpindexer(); // spindexer.resetSpindexer();
pathState = nextState; pathState = nextState;
follower.followPath(nextPath, true); follower.followPath(nextPath, true);
spindexer.setIntakePower(1); // spindexer.setIntakePower(1);
} }
} }
private void drivePickup(PathState nextState, PathChain nextPath) { private void drivePickup(PathState nextState, PathChain nextPath) {
@@ -292,18 +292,18 @@ public class Auto12BallPedroPathing extends LinearOpMode {
hub.setBulkCachingMode(LynxModule.BulkCachingMode.MANUAL); hub.setBulkCachingMode(LynxModule.BulkCachingMode.MANUAL);
} }
TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry()); TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
flywheel = new Flywheel(hardwareMap); // flywheel = new Flywheel(hardwareMap);
targeting = new Targeting(); // targeting = new Targeting();
targetingSettings = new Targeting.Settings(0,0); // targetingSettings = new Targeting.Settings(0,0);
follower = Constants.createFollower(hardwareMap); follower = Constants.createFollower(hardwareMap);
follower.setStartingPose(new Pose(72,72,0)); follower.setStartingPose(new Pose(72,72,0));
turret = new Turret(robot, TELE, robot.limelight); // turret = new Turret(robot, TELE, robot.limelight);
spindexer = new Spindexer(hardwareMap); // spindexer = new Spindexer(hardwareMap);
servos = new Servos(hardwareMap); // servos = new Servos(hardwareMap);
loopTimes = new MeasuringLoopTimes(); loopTimes = new MeasuringLoopTimes();
loopTimes.init(); loopTimes.init();
robot.light.setPosition(Color.LightRed); // robot.light.setPosition(Color.LightRed);
boolean initializeRobot = false; boolean initializeRobot = false;
while (opModeInInit()){ while (opModeInInit()){
@@ -311,11 +311,11 @@ public class Auto12BallPedroPathing extends LinearOpMode {
if (gamepad1.crossWasPressed() && !initializeRobot){ if (gamepad1.crossWasPressed() && !initializeRobot){
Color.redAlliance = !Color.redAlliance; Color.redAlliance = !Color.redAlliance;
if (Color.redAlliance){ // if (Color.redAlliance){
robot.light.setPosition(Color.LightRed); // robot.light.setPosition(Color.LightRed);
} else { // } else {
robot.light.setPosition(Color.LightBlue); // robot.light.setPosition(Color.LightBlue);
} // }
double[] xPoses = {startPoseX, shoot0X, double[] xPoses = {startPoseX, shoot0X,
drivePickup1X, pickup1X, shoot1X, drivePickup1X, pickup1X, shoot1X,
@@ -338,8 +338,8 @@ public class Auto12BallPedroPathing extends LinearOpMode {
buildPaths(); buildPaths();
sleep(2000); sleep(2000);
turret.setTurret(turrDefault); // turret.setTurret(turrDefault);
servos.setSpinPos(spinStartPos); // servos.setSpinPos(spinStartPos);
} }
TELE.addData("Red Alliance?", Color.redAlliance); TELE.addData("Red Alliance?", Color.redAlliance);
@@ -352,27 +352,27 @@ public class Auto12BallPedroPathing extends LinearOpMode {
if (isStopRequested()) return; if (isStopRequested()) return;
robot.transfer.setPower(1); // robot.transfer.setPower(1);
limelightUsed = false; limelightUsed = false;
while (opModeIsActive()){ while (opModeIsActive()){
follower.update(); follower.update();
pathStateMachine(); pathStateMachine();
Pose currentPose = follower.getPose(); Pose currentPose = follower.getPose();
teleStartPoseX = currentPose.getX(); // teleStartPoseX = currentPose.getX();
teleStartPoseY = currentPose.getY(); // teleStartPoseY = currentPose.getY();
teleStartPoseH = Math.toDegrees(currentPose.getHeading()); // teleStartPoseH = Math.toDegrees(currentPose.getHeading());
//
turret.trackGoal(new Pose(shootX, shootY, Math.toRadians(shootH))); // turret.trackGoal(new Pose(shootX, shootY, Math.toRadians(shootH)));
targetingSettings = targeting.calculateSettings(shootX, shootY, Math.toRadians(shootH), 0, turretInterpolate); // targetingSettings = targeting.calculateSettings(shootX, shootY, Math.toRadians(shootH), 0, turretInterpolate);
//
double voltage = robot.voltage.getVoltage(); // double voltage = robot.voltage.getVoltage();
flywheel.setPIDF(Robot.shooterPIDF_P, Robot.shooterPIDF_I, Robot.shooterPIDF_D, Robot.shooterPIDF_F / voltage); // flywheel.setPIDF(Robot.shooterPIDF_P, Robot.shooterPIDF_I, Robot.shooterPIDF_D, Robot.shooterPIDF_F / voltage);
flywheel.manageFlywheel(targetingSettings.flywheelRPM); // flywheel.manageFlywheel(targetingSettings.flywheelRPM);
servos.setHoodPos(targetingSettings.hoodAngle); // servos.setHoodPos(targetingSettings.hoodAngle);
//
if (driveToShoot()){servos.setSpinPos(spinStartPos);} // if (driveToShoot()){servos.setSpinPos(spinStartPos);}
else {spindexer.processIntake();} // else {spindexer.processIntake();}
for (LynxModule hub : allHubs) { for (LynxModule hub : allHubs) {
hub.clearBulkCache(); hub.clearBulkCache();

View File

@@ -1,5 +1,6 @@
package org.firstinspires.ftc.teamcode.tests; package org.firstinspires.ftc.teamcode.tests;
import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.config.Config; import com.acmerobotics.dashboard.config.Config;
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry; import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
@@ -51,7 +52,7 @@ public class Hardware_Tester extends LinearOpMode {
@Override @Override
public void runOpMode() throws InterruptedException { public void runOpMode() throws InterruptedException {
robot = new Robot(hardwareMap); robot = new Robot(hardwareMap);
TELE = new MultipleTelemetry(); TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
robot.shooter1.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); robot.shooter1.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
robot.shooter2.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); robot.shooter2.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);