From d8cf5948282cccb1e5a5f143fbec7dc541cf5b4c Mon Sep 17 00:00:00 2001 From: Keshav Anand Date: Wed, 3 Jun 2026 14:08:49 -0500 Subject: [PATCH] Fix some intrinsic bugs, refactor constructor in shooter --- .../ftc/teamcode/teleop/TeleopV4.java | 8 +++++++- .../ftc/teamcode/tests/NewShooterTest.java | 15 ++++++++++++--- .../ftc/teamcode/utilsv2/Shooter.java | 17 +++++++++-------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/TeleopV4.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/TeleopV4.java index a061c24..2e604b3 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/TeleopV4.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/TeleopV4.java @@ -25,6 +25,8 @@ public class TeleopV4 extends LinearOpMode { MultipleTelemetry TELE; Follower follower; SpindexerTransferIntake spindexerTransferIntake; + Turret turret; + Flywheel flywheel; @Override public void runOpMode() throws InterruptedException { @@ -40,7 +42,11 @@ public class TeleopV4 extends LinearOpMode { Pose start = new Pose(teleStartPoseX, teleStartPoseY, Math.toRadians(teleStartPoseH)); follower.setStartingPose(start); - shooter = new Shooter(robot, TELE, follower, Color.redAlliance); + flywheel = new Flywheel(robot); + turret = new Turret(robot); + + + shooter = new Shooter(robot, TELE, follower, Color.redAlliance, turret, flywheel); shooter.setState(Shooter.ShooterState.TRACK_GOAL); spindexerTransferIntake = new SpindexerTransferIntake(robot, TELE); spindexerTransferIntake.setSpindexerMode(SpindexerTransferIntake.SpindexerMode.RAPID); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tests/NewShooterTest.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tests/NewShooterTest.java index fafc88c..3ab756f 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tests/NewShooterTest.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tests/NewShooterTest.java @@ -8,14 +8,18 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import org.firstinspires.ftc.teamcode.constants.ServoPositions; import org.firstinspires.ftc.teamcode.pedroPathing.Constants; +import org.firstinspires.ftc.teamcode.utilsv2.Flywheel; import org.firstinspires.ftc.teamcode.utilsv2.Robot; import org.firstinspires.ftc.teamcode.utilsv2.Shooter; +import org.firstinspires.ftc.teamcode.utilsv2.Turret; @Config @TeleOp public class NewShooterTest extends LinearOpMode { Robot robot; + Flywheel flywheel; + Turret turret; public static boolean intake = true; public static boolean shoot = false; @@ -24,7 +28,7 @@ public class NewShooterTest extends LinearOpMode { public static double transferIntakePower = -1.0; public static double turretPos = 0.51; public static double hoodPos = 0.51; - public static double flywheel = 0; + public static double flywheel_velo = 0; private enum ShootState { IDLE, @@ -42,6 +46,9 @@ public class NewShooterTest extends LinearOpMode { robot = Robot.getInstance(hardwareMap); + flywheel = new Flywheel(robot); + turret = new Turret(robot); + Shooter shooter = new Shooter( robot, new MultipleTelemetry( @@ -49,7 +56,9 @@ public class NewShooterTest extends LinearOpMode { FtcDashboard.getInstance().getTelemetry() ), Constants.createFollower(hardwareMap), - true + true, + turret, + flywheel ); shooter.setState(Shooter.ShooterState.MANUAL); @@ -62,7 +71,7 @@ public class NewShooterTest extends LinearOpMode { robot.setHoodPos(hoodPos); shooter.setTurretPosition(turretPos); - shooter.setFlywheelVelocity(flywheel); + shooter.setFlywheelVelocity(flywheel_velo); robot.setSpinPos(ServoPositions.spindexer_A2); if (intake && !shoot) { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utilsv2/Shooter.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utilsv2/Shooter.java index 068aea2..3e4c735 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utilsv2/Shooter.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utilsv2/Shooter.java @@ -21,16 +21,21 @@ public class Shooter { Follower follow; - public Shooter(Robot rob, MultipleTelemetry TELE, Follower follower, boolean redAlliance) { + public Shooter(Robot rob, MultipleTelemetry TELE, Follower follower, boolean redAlliance, Turret turret, Flywheel flywheel) { this.robot = rob; - this.fly = new Flywheel(rob); - this.turr = new Turret(rob); + this.fly = flywheel; + this.turr = turret; this.follow = follower; this.commander = new VelocityCommander(); setRedAlliance(redAlliance); - if (redAlliance) { + } + + public void setRedAlliance(boolean input) { + this.red = input; + + if (this.red) { goalX = 144; } else { goalX = 0; @@ -38,10 +43,6 @@ public class Shooter { goalY = 144; } - public void setRedAlliance(boolean input) { - this.red = input; - } - private double flywheelVelocity = 0.0; private double turretPosition = 0.5;