From d39ae30645218d7fff75452f4ea690f5e99603f1 Mon Sep 17 00:00:00 2001 From: David Tian Date: Sun, 10 Nov 2024 23:50:55 -0800 Subject: [PATCH] End of season --- src/main/deploy/pathplanner/autos/Blue - D_54.auto | 8 +++++++- .../java/com/team841/calliope/RobotContainer.java | 7 +++++-- .../java/com/team841/calliope/drive/BioDrive.java | 11 ++++------- .../calliope/superstructure/shooter/Shooter.java | 2 ++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/deploy/pathplanner/autos/Blue - D_54.auto b/src/main/deploy/pathplanner/autos/Blue - D_54.auto index d60de85..1d9961c 100644 --- a/src/main/deploy/pathplanner/autos/Blue - D_54.auto +++ b/src/main/deploy/pathplanner/autos/Blue - D_54.auto @@ -1,6 +1,12 @@ { "version": 1.0, - "startingPose": null, + "startingPose": { + "position": { + "x": 1.53, + "y": 3.33 + }, + "rotation": 180.0 + }, "command": { "type": "sequential", "data": { diff --git a/src/main/java/com/team841/calliope/RobotContainer.java b/src/main/java/com/team841/calliope/RobotContainer.java index 7be5a75..db252f9 100644 --- a/src/main/java/com/team841/calliope/RobotContainer.java +++ b/src/main/java/com/team841/calliope/RobotContainer.java @@ -139,8 +139,7 @@ public RobotContainer() { () -> -sticksPS5[0].getLeftX() * Swerve.MaxSpeed, () -> -sticksPS5[0].getRightX() * Swerve.MaxAngularRate, () -> sticksPS5[0].L2().getAsBoolean(), - () -> sticksXbox[0].rightBumper().getAsBoolean(), - () -> -sticksXbox[0].getRightX() * 2 * Math.PI); + () -> -sticksXbox[0].getLeftX()); @@ -317,6 +316,10 @@ private void configureDuoStick() { .a() .onTrue(new InstantCommand(shooter::trapShot)) .onFalse(new InstantCommand(shooter::stopShooter)); + + sticksXbox[0].rightBumper() + .whileTrue(new InstantCommand(shooter::flyShot2)) + .onFalse(new InstantCommand(shooter::stopShooter)); } private void registerNamedCommands(){ diff --git a/src/main/java/com/team841/calliope/drive/BioDrive.java b/src/main/java/com/team841/calliope/drive/BioDrive.java index f993c72..d09883d 100644 --- a/src/main/java/com/team841/calliope/drive/BioDrive.java +++ b/src/main/java/com/team841/calliope/drive/BioDrive.java @@ -24,11 +24,10 @@ public class BioDrive extends Command { */ - public BioDrive(Drivetrain drivetrain, DoubleSupplier velocityXGetter, DoubleSupplier velocityYGetter, DoubleSupplier velocityOmegaGetter, BooleanSupplier faceSpeakerGetter, BooleanSupplier overRideTurn, DoubleSupplier overrideVelocity) { + public BioDrive(Drivetrain drivetrain, DoubleSupplier velocityXGetter, DoubleSupplier velocityYGetter, DoubleSupplier velocityOmegaGetter, BooleanSupplier faceSpeakerGetter, DoubleSupplier overrideVelocity) { this(drivetrain, velocityXGetter, velocityYGetter, velocityOmegaGetter, faceSpeakerGetter); - this.Override = overRideTurn; this.vOverride = overrideVelocity; } @@ -56,14 +55,13 @@ public BioDrive(Drivetrain drivetrain, DoubleSupplier velocityXGetter, DoubleSup private Command shootCommand; private DoubleSupplier mVelocityX, mVelocityY, mVelocityOmega, vOverride; - private BooleanSupplier mFaceSpeaker, mAutoShoot, Override; + private BooleanSupplier mFaceSpeaker, mAutoShoot; private boolean faceSpeaker = false; private double velocity_y = 0.0; private double velocity_x = 0.0; private double velocity_omega = 0.0; private boolean autoShoot = false; - private boolean overRide = false; private double overrideVelocity = 0.0; private Drivetrain drivetrain; @@ -92,7 +90,6 @@ public void execute() { this.velocity_y = mVelocityY.getAsDouble(); this.velocity_omega = mVelocityOmega.getAsDouble(); //this.autoShoot = mAutoShoot.getAsBoolean(); - this.overRide = Override.getAsBoolean(); this.overrideVelocity = vOverride.getAsDouble(); Logger.recordOutput("BioDrive/FaceSpeaker", this.faceSpeaker); @@ -110,8 +107,8 @@ public void execute() { this.drivetrain.setControl(fieldCentricFacingAngle.withVelocityX(-this.velocity_x).withVelocityY(-this.velocity_y).withTargetDirection(angle)); */ - } else if (overRide) { - this.drivetrain.setControl(fieldCentricDrive.withVelocityX(-this.velocity_x).withVelocityY(-this.velocity_y).withRotationalRate(this.overrideVelocity)); + } else if (Math.abs(overrideVelocity) > 0.15) { + this.drivetrain.setControl(fieldCentricDrive.withVelocityX(-this.velocity_x).withVelocityY(-this.velocity_y).withRotationalRate(-this.overrideVelocity * 2 * Math.PI)); } else { this.drivetrain.setControl(fieldCentricDrive.withVelocityX(-this.velocity_x).withVelocityY(-this.velocity_y).withRotationalRate(this.velocity_omega)); } diff --git a/src/main/java/com/team841/calliope/superstructure/shooter/Shooter.java b/src/main/java/com/team841/calliope/superstructure/shooter/Shooter.java index a358692..5b84213 100644 --- a/src/main/java/com/team841/calliope/superstructure/shooter/Shooter.java +++ b/src/main/java/com/team841/calliope/superstructure/shooter/Shooter.java @@ -49,6 +49,8 @@ public void flyShot() { io.setMotionMagicVelocityVoltageOutput(70); } + public void flyShot2() {io.setMotionMagicVelocityVoltageOutput(50);} + public void disruptshot() { io.setMotionMagicVelocityVoltageOutput(12.5); }