Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.

Commit 847a180

Browse files
committed
fix(intake): Rumble on note.
1 parent 953ec1f commit 847a180

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package frc.robot;
22

3+
import edu.wpi.first.wpilibj.XboxController;
4+
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
35
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
46
import edu.wpi.first.wpilibj2.command.Command;
7+
import edu.wpi.first.wpilibj2.command.Commands;
58
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
9+
import edu.wpi.first.wpilibj2.command.button.Trigger;
610
import frc.lib.Telemetry;
711
import frc.robot.arm.Arm;
812
import frc.robot.auto.Auto;
@@ -29,6 +33,8 @@ public class RobotContainer {
2933

3034
private final CommandXboxController driverController, operatorController;
3135

36+
private final XboxController rumbleController;
37+
3238
/** Creates a new instance of the robot container. */
3339
private RobotContainer() {
3440
arm = Arm.getInstance();
@@ -41,6 +47,7 @@ private RobotContainer() {
4147

4248
driverController = new CommandXboxController(0);
4349
operatorController = new CommandXboxController(1);
50+
rumbleController = new XboxController(1);
4451

4552
initializeTelemetry();
4653
configureDefaultCommands();
@@ -88,6 +95,20 @@ private void configureBindings() {
8895
operatorController.a().onTrue(superstructure.amp());
8996
operatorController.x().onTrue(superstructure.stow());
9097
operatorController.y().onTrue(superstructure.climb());
98+
99+
new Trigger(intake::rollerNote).onTrue(rumbleOn()).onFalse(rumbleOff());
100+
}
101+
102+
public void rumble(double value) {
103+
rumbleController.setRumble(RumbleType.kBothRumble, value);
104+
}
105+
106+
public Command rumbleOn() {
107+
return Commands.runOnce(() -> rumble(1));
108+
}
109+
110+
public Command rumbleOff() {
111+
return Commands.runOnce(() -> rumble(0));
91112
}
92113

93114
/**

src/main/java/frc/robot/intake/Intake.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ public void addToShuffleboard(ShuffleboardTab tab) {
6464
VelocityControllerIO.addToShuffleboard(tab, "Front Roller", frontRollerValues);
6565
VelocityControllerIO.addToShuffleboard(tab, "Back Roller", backRollerValues);
6666

67-
tab.addBoolean("Roller Stuck?", this::rollerStuck);
67+
tab.addBoolean("Roller Note?", this::rollerNote);
6868
}
6969

7070
public boolean frontRollerStuck() {
71-
return frontRollerValues.motorAmps > FrontRollerConstants.STUCK_AMPS;
71+
return frontRollerValues.motorAmps > FrontRollerConstants.NOTE_AMPS;
7272
}
7373

7474
public boolean backRollerStuck() {
75-
return backRollerValues.motorAmps > BackRollerConstants.STUCK_AMPS;
75+
return backRollerValues.motorAmps > BackRollerConstants.NOTE_AMPS;
7676
}
7777

78-
public boolean rollerStuck() {
78+
public boolean rollerNote() {
7979
return frontRollerStuck() || backRollerStuck();
8080
}
8181

src/main/java/frc/robot/intake/IntakeConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static class FrontRollerConstants {
3737
/** Maximum speed of the roller in rotations per second. */
3838
public static final double MAXIMUM_SPEED = 67;
3939

40-
public static final double STUCK_AMPS = 100;
40+
public static final double NOTE_AMPS = 20;
4141
}
4242

4343
/** Constants for the back roller. */
@@ -71,6 +71,6 @@ public static class BackRollerConstants {
7171
/** Maximum speed of the roller in rotations per second. */
7272
public static final double MAXIMUM_SPEED = 67;
7373

74-
public static final double STUCK_AMPS = 80;
74+
public static final double NOTE_AMPS = 20;
7575
}
7676
}

0 commit comments

Comments
 (0)