Skip to content

Commit d626319

Browse files
Merge pull request #5 from Patribots4738/3-group-2-triggers
3 group 2 triggers to main
2 parents 7278bb4 + 95f98a5 commit d626319

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

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

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,16 @@ private void configureButtonBindings() {
7474
.onTrue(
7575
setDriveSpeed(DriveConstants.MAX_TELEOP_SPEED_METERS_PER_SECOND));
7676

77-
Make a trigger so then when the current GAME_MODE
77+
(DONE) Make a trigger so then when the current GAME_MODE
7878
is equal to AUTONOMOUS then set the drive speed to MAX_SPEED_METERS_PER_SECOND
7979

80-
Create a trigger like the one above so that
80+
(DONE) Create a trigger like the one above so that
8181
while the "a" button is been pressed,
8282
set the drive speed to ALIGNMENT_SPEED
8383
and when the "a" button has not been pressed,
8484
set the drive speed to MAX_TELEOP_SPEED_METERS_PER_SECOND
8585

86+
8687
driver.y().or(driver.x()).onTrue(
8788
Commands.runOnce(() -> swerve.resetOdometry(
8889
new Pose2d(
@@ -97,18 +98,44 @@ private void configureButtonBindings() {
9798
swerve.getSetWheelsXCommand()
9899
);
99100

100-
Create a trigger so while the leftBumper is pressed,
101+
driver.a().onTrue(
102+
setDriveSpeed(ALIGNMENT_SPEED)
103+
);
104+
105+
driver.a().onFalse(
106+
setDriveSpeed(MAX_TELEOP_SPEED_METERS_PER_SECOND)
107+
);
108+
109+
driver.leftBumper().onTrue(
110+
swerve.getSetWheelsXCommand()
111+
);
112+
113+
driver.leftStick().toggleOnTrue(
114+
swerve.toggleSpeed()
115+
);
116+
117+
driver.leftStick().onTrue(
118+
claw.setSpeed(driver.getLeftTriggerAxis)
119+
);
120+
121+
driver.rightStick.onTrue(
122+
claw.setSpeed(driver.getRightTriggerAxis)
123+
);
124+
125+
(DONE)Create a trigger so while the leftBumper is pressed,
101126
run the command in swerve, getSetWheelsX
102127

103-
Create another trigger so
128+
(DONE) Create another trigger so
104129
the swerve runs the toggleSpeed command in swerve
105130
when the leftStick toggles to true
106131
hint (use the toggleOnTrue method)
132+
107133

108-
Create two triggers so while the left and right triggers are true,
134+
(Done)Create two triggers so while the left and right triggers are true,
109135
set the desired claw speed
110136
to their respective left and right trigger axies
111137

138+
112139
}
113140

114141
private CommandBase setDriveSpeed(double desiredSpeedMetersPerSecond) {

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ public Claw() {
2929

3030
}
3131

32-
@Override
33-
public void periodic() {
34-
set the current speed of the motors to the desired speed
32+
3533

36-
}
37-
38-
private void setSpeed(double speed) {
34+
public void setSpeed(double speed) {
3935
claw.set(-speed);
4036
}
4137

0 commit comments

Comments
 (0)