Skip to content

Commit a7ec007

Browse files
committed
Feat: added tramp commands
1 parent 4529bd8 commit a7ec007

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.team1540.robot2024.commands;
2+
3+
import org.team1540.robot2024.subsystems.tramp.Tramp;
4+
5+
import edu.wpi.first.wpilibj2.command.Command;
6+
7+
public class TrampCommand extends Command {
8+
9+
private final Tramp tramp;
10+
11+
public TrampCommand(Tramp tramp) {
12+
this.tramp = tramp;
13+
addRequirements(tramp);
14+
}
15+
16+
public void getNote(Tramp tramp) {
17+
if (tramp.isBeamBreakBlocked()) {
18+
tramp.end();
19+
} else {
20+
tramp.scoreTrampCommand();
21+
}
22+
}
23+
24+
public void shootTramp(Tramp tramp) {
25+
tramp.scoreTrampCommand();
26+
}
27+
28+
}

src/main/java/org/team1540/robot2024/commands/climb/TrapAndClimbSequence.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public TrapAndClimbSequence(Elevator elevator, Hooks hooks, Tramp tramp) {
1919
new ElevatorSetpointCommand(elevator, ElevatorState.TRAP),
2020
new ParallelDeadlineGroup(
2121
new WaitCommand(Constants.Tramp.TRAP_SCORING_TIME_SECONDS),
22-
tramp.scoreInTrapCommand() //TODO: Do whatever to this but not my job
22+
tramp.scoreTrampCommand() //TODO: Do whatever to this but not my job
2323
),
2424
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM)
2525
);

src/main/java/org/team1540/robot2024/subsystems/tramp/Tramp.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ public void setPercent(double percentage) {
2020
public boolean isBeamBreakBlocked() {
2121
return inputs.breamBreakTripped;
2222
}
23+
2324
@Override
2425
public void periodic() {
2526
io.updateInputs(inputs);
2627
Logger.processInputs("Tramp", inputs);
2728
}
2829

29-
public Command scoreInAmpCommand() {
30-
//TODO: Tune the percentage
30+
public Command scoreTrampCommand() {
31+
// TODO: Tune the percentage
3132
return Commands.runOnce(() -> setPercent(0.5), this);
3233
}
33-
public Command scoreInTrapCommand() {
34-
//TODO: Tune the percentage
35-
return Commands.runOnce(() -> setPercent(0.5), this);
34+
35+
public void end() {
36+
io.setVoltage(0);
3637
}
3738

3839
}

src/main/java/org/team1540/robot2024/subsystems/tramp/TrampIOSparkMax.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void setVoltage(double volts) {
2323
}
2424

2525
public void updateInputs(TrampIOInputs inputs) {
26-
inputs.breamBreakTripped = !(beamBreak.get()); //I think returns false when broken...
26+
inputs.breamBreakTripped = !(beamBreak.get()); //I think returns false when broken... Returns true when broken now.
2727
inputs.velocityRPM = neorEncoder.getVelocity();
2828
inputs.appliedVolts = neor.getAppliedOutput() * neor.getBusVoltage();
2929
inputs.currentAmps = neor.getOutputCurrent();

0 commit comments

Comments
 (0)