Skip to content

Commit

Permalink
Tuesday fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheExoneratedManiac committed Mar 5, 2024
1 parent 2f0a6a0 commit 02e3a34
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static final class ModuleConstants {

public static final class OIConstants {
public static final int driverControllerPort = 1;
public static final double driveDeadband = 0.05;
public static final double driveDeadband = 1;
public static final int leftJoystickPort = 2;
public static final int rightJoystickPort = 3;
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,16 @@ public void robotInit() {
* {@link JoystickButton}.
*/
private void configureButtonBindings() {
new JoystickButton(driverController, PS4Controller.Button.kR2.value)
new JoystickButton(driverController, PS4Controller.Button.kCross.value)
.and(DriverStation::isTeleop)
.whileTrue(drive.setXCommand());
new JoystickButton(driverController, PS4Controller.Button.kL1.value)
.whileTrue(shooter.manualShootCommand().deadlineWith(leds.rainbowFlagScroll()));
new JoystickButton(driverController, PS4Controller.Button.kTriangle.value).whileTrue(intermediary.intermediaryCommand()).whileFalse(intermediary.intermediaryReverseCommand());
new JoystickButton(driverController, PS4Controller.Button.kTriangle.value).whileTrue(intermediary.intermediaryCommand()).whileTrue(intake.intakeCommand()).whileFalse(intermediary.intermediaryReverseCommand());
new JoystickButton(driverController, PS4Controller.Button.kSquare.value)
.whileTrue(
intake
.intakeCommand()
shooter
.ampCommand()
.deadlineWith(leds.blinkPurple()));
new JoystickButton(driverController, PS4Controller.Button.kCross.value)
.and(DriverStation::isTest)
Expand All @@ -161,8 +162,10 @@ private void configureButtonBindings() {
.andThen(drive.sysIdDynamic(Direction.kReverse))
.andThen(drive.sysIdQuasistatic(Direction.kReverse)));
new JoystickButton(driverController, PS4Controller.Button.kCircle.value).whileTrue(intake.spinReverseCommand());
new JoystickButton(driverController, PS4Controller.Button.kR1.value).whileTrue(shooter.ampCommand());
}


/**
* Gets the command to run in autonomous based on user selection in a dashboard.
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/drive/DriveSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ public Command driveWithJoysticks(DoubleSupplier x, DoubleSupplier y, DoubleSupp
var omegaSpeed = MutableMeasure.zero(RadiansPerSecond);

return run(() -> {
xSpeed.mut_setMagnitude(-x.getAsDouble() * DriveConstants.maxSpeed.in(MetersPerSecond));
ySpeed.mut_setMagnitude(-y.getAsDouble() * DriveConstants.maxSpeed.in(MetersPerSecond));
xSpeed.mut_setMagnitude(MathUtil.applyDeadband(x.getAsDouble(), 0.01) * DriveConstants.maxSpeed.in(MetersPerSecond));
ySpeed.mut_setMagnitude(MathUtil.applyDeadband(y.getAsDouble(), 0.01) * DriveConstants.maxSpeed.in(MetersPerSecond));
omegaSpeed.mut_setMagnitude(
-omega.getAsDouble() * DriveConstants.maxAngularSpeed.in(RadiansPerSecond));

Expand Down
11 changes: 10 additions & 1 deletion src/main/java/frc/robot/subsystems/shooter/ShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ public ShooterSubsystem() {
public void spin() {
// spark.setVoltage(SmartDashboard.getNumber("Spin voltage", 0));
rSpark.setVoltage(12);
lSpark.setVoltage(12);
lSpark.setVoltage(11);
System.out.println("spinning motors");
}

public void ampShot() {
rSpark.setVoltage(3);
lSpark.setVoltage(2);
}

public void stopSpin() {
rSpark.set(0);
lSpark.set(0);
Expand Down Expand Up @@ -59,6 +64,10 @@ public Command stopSpinCommand() {
return runOnce(this::stopSpin);
}

public Command ampCommand() {
return run(this::ampShot).finallyDo(interrupted -> stopSpin());
}

@Override
public void periodic() {
SmartDashboard.putNumber("Left velocity", lSpark.getEncoder().getVelocity());
Expand Down

0 comments on commit 02e3a34

Please sign in to comment.