Skip to content

Commit

Permalink
adding composed commands for coraller
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishoffman committed Jan 30, 2025
1 parent a736d2f commit fc8ffea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/main/java/frc/robot/subsystems/coraller/Coraller.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ public Command prepareToScore(Configuration cfg) {
}

public Command intakeCoral() {
return this.runOnce(() -> intake.intake());
return this.startEnd(
intake::start, // can also be written as () -> intake.start()
intake::stop
)
// TODO: We need a sensor to tell us if we have coral
.until(() -> { return false; })
.withTimeout(3);
}

public Command releaseCoral() {
return this.runOnce(() -> intake.release());
return this.startEnd(
intake::reverse,
intake::stop
)
.withTimeout(.5);
}

@Override
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/frc/robot/subsystems/coraller/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ public Intake() {
}

// TODO() find out volts and which are inversed
public void intake() {
public void start() {
intake.setVoltage(6);
}

public void release() {
public void reverse() {
intake.setVoltage(-6);
}

public void stop() {
intake.setVoltage(0);
}

}

0 comments on commit fc8ffea

Please sign in to comment.