Skip to content

Commit e815669

Browse files
Merge pull request #73 from FRC5188/R2-154-tuning-pid-constants
R2 154 tuning pid constants
2 parents ad85351 + 3748736 commit e815669

3 files changed

Lines changed: 23 additions & 5 deletions

File tree

src/main/java/frc/robot/Constants.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,14 @@ public final class ShooterConstants {
294294
new RotaryMechCharacteristics(OFFSET, WHEEL_RADIUS, MIN_ANGLE, MAX_ANGLE, STARTING_ANGLE);
295295

296296
public static final double HARD_STOP_CURRENT_LIMIT = 3.0;
297+
298+
public static final double TOWER_ANGLE = 8.9; // degrees // Distance 120.5 Inches
299+
public static final double HUB_ANGLE = 2.3; // degrees // Distance 49.5 inches
300+
public static final double TRENCH_ANGLE = 9.8; // degrees
301+
302+
public static final double ANGLE_AT_96 = 6.8; // degrees // Distance 96 inches
303+
public static final double ANGLE_AT_152 = 12.1; // degrees // Distance 152 inches
304+
public static final double ANGLE_AT_197 = 18.6; // degrees // Distance
297305
}
298306

299307
public class ShooterFlywheelConstants {
@@ -315,7 +323,7 @@ public class ShooterFlywheelConstants {
315323

316324
// Velocity PID
317325
private static Slot0Configs SLOT0CONFIG =
318-
new Slot0Configs().withKP(3.0).withKI(0.15).withKD(0.0).withKV(0.1).withKS(8.5);
326+
new Slot0Configs().withKP(3.5).withKI(0.15).withKD(0.0).withKV(0.1).withKS(8.5);
319327

320328
public static TalonFXConfiguration getFXConfig(boolean invert) {
321329
TalonFXConfiguration config = new TalonFXConfiguration();
@@ -607,7 +615,7 @@ public static VisionSystemSim getSystemSim() {
607615
public class IntakePivotConstants {
608616
public static final String NAME = "Intake";
609617

610-
public static final Angle PICKUP_ANGLE = Degrees.of(106.0);
618+
public static final Angle PICKUP_ANGLE = Degrees.of(130.0);
611619
public static final Angle STOW_ANGLE = Degrees.of(0.0);
612620

613621
public static final Angle TOLERANCE = Degrees.of(1.0);

src/main/java/frc/robot/RobotContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private void configureButtonBindings() {
381381
// controller.x().onTrue(intake.stowAndStopRollers());
382382

383383
// Flywheel
384-
controller.leftBumper().whileTrue(shooter.runFlywheel(RotationsPerSecond.of(20)));
384+
controller.leftBumper().whileTrue(shooter.runFlywheel(RotationsPerSecond.of(100)));
385385
controller.leftBumper().onFalse(shooter.runFlywheel(RotationsPerSecond.of(0)));
386386

387387
// Intake + Spindexer + Tower
@@ -390,7 +390,7 @@ private void configureButtonBindings() {
390390
.whileTrue(
391391
Commands.parallel(
392392
// intake.runRollers(RotationsPerSecond.of(30)),
393-
hopper.runSpindexer(15), shooter.runTower(RotationsPerSecond.of(70))));
393+
hopper.runSpindexer(15), shooter.runTower(RotationsPerSecond.of(30))));
394394

395395
controller
396396
.rightBumper()
@@ -417,7 +417,7 @@ private void configureButtonBindings() {
417417
// controller.y().onFalse(shooter.runTower(RotationsPerSecond.of(0)));
418418

419419
// controller.b().onFalse(shooter.setHoodAngle(ShooterRotaryConstants.STARTING_ANGLE.magnitude()));
420-
// controller.povUp().onTrue(shooter.calibrateHood());
420+
controller.povLeft().onTrue(shooter.calibrateHood());
421421
// controller.povLeft().onTrue(shooter.setHoodAngle(10));
422422
// controller.povDown().onTrue(shooter.setHoodAngle(15));
423423
// controller.povRight().onTrue(shooter.setHoodAngle(20));

src/main/java/frc/robot/subsystems/Shooter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ public boolean hoodAtAngle() {
144144
return Math.abs(hoodAngle - _hood.getPosition().in(Degrees)) < ShooterConstants.HOOD_TOLERANCE;
145145
}
146146

147+
public Command incrementHoodAngle() {
148+
Angle currentHoodAngle = _hood.getPosition().plus(Degrees.of(2.5));
149+
return setHoodAngle(currentHoodAngle.in(Degrees));
150+
}
151+
152+
public Command decrementHoodAngle() {
153+
Angle currentHoodAngle = _hood.getPosition().minus(Degrees.of(0.5));
154+
return setHoodAngle(currentHoodAngle.in(Degrees));
155+
}
156+
147157
public boolean isAboveCurrentLimit() {
148158
if (Math.abs(_hood.getSupplyCurrent().in(Amps)) > ShooterConstants.HARD_STOP_CURRENT_LIMIT) {
149159
return true;

0 commit comments

Comments
 (0)