Fix some intrinsic bugs, refactor constructor in shooter

This commit is contained in:
2026-06-03 14:08:49 -05:00
parent a540d333f1
commit d8cf594828
3 changed files with 28 additions and 12 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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;