Skip to content

Commit 1e741ac

Browse files
merge changes woohoo
1 parent d626319 commit 1e741ac

File tree

3 files changed

+11
-56
lines changed

3 files changed

+11
-56
lines changed

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

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

77-
(DONE) Make a trigger so then when the current GAME_MODE
78-
is equal to AUTONOMOUS then set the drive speed to MAX_SPEED_METERS_PER_SECOND
79-
80-
(DONE) Create a trigger like the one above so that
81-
while the "a" button is been pressed,
82-
set the drive speed to ALIGNMENT_SPEED
83-
and when the "a" button has not been pressed,
84-
set the drive speed to MAX_TELEOP_SPEED_METERS_PER_SECOND
85-
86-
8777
driver.y().or(driver.x()).onTrue(
8878
Commands.runOnce(() -> swerve.resetOdometry(
8979
new Pose2d(
@@ -99,11 +89,11 @@ private void configureButtonBindings() {
9989
);
10090

10191
driver.a().onTrue(
102-
setDriveSpeed(ALIGNMENT_SPEED)
92+
setDriveSpeed(FieldConstants.ALIGNMENT_SPEED)
10393
);
10494

10595
driver.a().onFalse(
106-
setDriveSpeed(MAX_TELEOP_SPEED_METERS_PER_SECOND)
96+
setDriveSpeed(DriveConstants.MAX_TELEOP_SPEED_METERS_PER_SECOND)
10797
);
10898

10999
driver.leftBumper().onTrue(
@@ -114,28 +104,14 @@ private void configureButtonBindings() {
114104
swerve.toggleSpeed()
115105
);
116106

117-
driver.leftStick().onTrue(
118-
claw.setSpeed(driver.getLeftTriggerAxis)
107+
driver.leftStick().whileTrue(
108+
Commands.runOnce(() -> claw.setSpeed(driver.getLeftTriggerAxis()))
119109
);
120110

121-
driver.rightStick.onTrue(
122-
claw.setSpeed(driver.getRightTriggerAxis)
111+
driver.rightStick().whileTrue(
112+
Commands.runOnce(() -> claw.setSpeed(driver.getRightTriggerAxis()))
123113
);
124114

125-
(DONE)Create a trigger so while the leftBumper is pressed,
126-
run the command in swerve, getSetWheelsX
127-
128-
(DONE) Create another trigger so
129-
the swerve runs the toggleSpeed command in swerve
130-
when the leftStick toggles to true
131-
hint (use the toggleOnTrue method)
132-
133-
134-
(Done)Create two triggers so while the left and right triggers are true,
135-
set the desired claw speed
136-
to their respective left and right trigger axies
137-
138-
139115
}
140116

141117
private CommandBase setDriveSpeed(double desiredSpeedMetersPerSecond) {

src/main/java/frc/robot/commands/Drive.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public Drive(
3939
addRequirements(swerve);
4040
}
4141

42-
public Drive(Swerve swerve, Supplier<ChassisSpeeds> speeds, BooleanSupplier fieldRelativeSupplier,
42+
public Drive(Swerve swerve,
43+
Supplier<ChassisSpeeds> speeds,
44+
BooleanSupplier fieldRelativeSupplier,
4345
BooleanSupplier shouldMirror) {
4446

4547
this.swerve = swerve;

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

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22

33
import com.revrobotics.CANSparkMax;
44
import com.revrobotics.CANSparkMaxLowLevel.PeriodicFrame;
5-
import java.util.function.DoubleSupplier;
6-
7-
import edu.wpi.first.wpilibj2.command.Command;
85
import edu.wpi.first.wpilibj2.command.SubsystemBase;
96
import frc.robot.util.Neo;
107

118
public class Claw extends SubsystemBase {
129

1310
private final CANSparkMax claw;
14-
private double desiredSpeed = 0;
1511

1612
public Claw() {
1713

18-
// TODO: set claw can id
19-
claw = new Neo(100);
14+
set claw can id
15+
claw = new Neo(/*can id goes here*/);
2016
claw.restoreFactoryDefaults();
2117

2218
claw.setSmartCurrentLimit(30);
@@ -29,8 +25,6 @@ public Claw() {
2925

3026
}
3127

32-
33-
3428
public void setSpeed(double speed) {
3529
claw.set(-speed);
3630
}
@@ -42,21 +36,4 @@ public void setBrakeMode() {
4236
public void setCoastMode() {
4337
claw.setIdleMode(CANSparkMax.IdleMode.kCoast);
4438
}
45-
46-
public void setDesiredSpeed(double speed) {
47-
this.desiredSpeed = speed;
48-
}
49-
50-
public void stopClaw() {
51-
this.desiredSpeed = 0;
52-
}
53-
54-
public double getDesiredSpeed() {
55-
return this.desiredSpeed;
56-
}
57-
58-
public Command setDesiredSpeedCommand(DoubleSupplier speed) {
59-
return null;
60-
}
61-
6239
}

0 commit comments

Comments
 (0)