Skip to content

Commit

Permalink
addressed the review
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan jones committed Jan 25, 2025
1 parent a881698 commit 355962f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/main/java/org/sciborgs1155/robot/commands/Scoraling.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,36 @@ public Scoraling(Hopper hopper, Scoral scoral, Elevator elevator) {
this.scoral = scoral;
this.elevator = elevator;

hopper.beambreakTrigger.onTrue(hopper.stop().alongWith(scoral.stop()));
scoral.beambreakTrigger.onFalse(hopper.stop().alongWith(scoral.stop()));
hopper.beambreakTrigger.onTrue(stop());
scoral.beambreakTrigger.onFalse(stop());
}

/** intakes from the human player station */
public Command hpsIntake() {
return elevator.retract().andThen(run()).onlyIf(scoral.beambreakTrigger);
return elevator.retract().andThen(runRollers()).onlyIf(scoral.beambreakTrigger);
}

/**
* scores a coral at the given level, assuming you are already at the correct branch
*
* @param level the level the scoral scores in
*/
public Command scoral(Level level) {
return elevator.scoreLevel(level).andThen(scoral.outtake());
}

/** ONLY L2 and L3 */
/** grabs the algae from the level given (goes above the level) ONLY L2 and L3 */
public Command grabAlgae(Level level) {
return elevator.clean(level).andThen(scoral.intake()).onlyIf(scoral.beambreakTrigger);
}

public Command halt() {
/** halts both the hopper and the scoral */
public Command stop() {
return hopper.stop().alongWith(scoral.stop());
}

public Command run() {
/** runs the hps + scoral rollers forward (intaking) */
public Command runRollers() {
return hopper.intake().alongWith(scoral.outtake());
}
}
8 changes: 7 additions & 1 deletion src/main/java/org/sciborgs1155/robot/elevator/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import monologue.Annotations.Log;
import monologue.Logged;
import org.sciborgs1155.lib.Assertion;
import org.sciborgs1155.lib.FaultLogger;
import org.sciborgs1155.lib.FaultLogger.FaultType;
import org.sciborgs1155.lib.Test;
import org.sciborgs1155.robot.Constants.Field.Level;
import org.sciborgs1155.robot.Robot;
Expand Down Expand Up @@ -106,7 +108,11 @@ public Command scoreLevel(Level level) {
/** Goes to an offset height above the level given to clean algae ONLY L2 and L3! */
public Command clean(Level level) {
if (level == Level.L1 || level == Level.L4) {
throw new RuntimeException("Not a valid algae height! Only L2 and L3!");
retract();
FaultLogger.report(
"Algae level fault",
"an invalid level has been passed to the clean command, L1 or L4",
FaultType.WARNING);
}

return goTo(level.height.plus(algaeOffset).in(Meters));
Expand Down

0 comments on commit 355962f

Please sign in to comment.