Skip to main content

Climb Interlock + Precheck

Disclaimer: WIP and untested; wire to your sensors and thresholds. Custom code built on WPILib APIs.

Purpose: Prevent climb start unless END GAME, intake stowed, battery OK, sensors good; log faults.

Code (Java/WPILib)

public class ClimbInterlock {
private final BooleanSupplier endgame;
private final BooleanSupplier intakeStowed;
private final DoubleSupplier battery;
private final double minBattery;
private final Supplier<Boolean> sensorOk;

public ClimbInterlock(BooleanSupplier endgame, BooleanSupplier intakeStowed,
DoubleSupplier battery, double minBattery,
Supplier<Boolean> sensorOk) {
this.endgame = endgame;
this.intakeStowed = intakeStowed;
this.battery = battery;
this.minBattery = minBattery;
this.sensorOk = sensorOk;
}

public boolean ready() {
return endgame.getAsBoolean()
&& intakeStowed.getAsBoolean()
&& battery.getAsDouble() >= minBattery
&& sensorOk.get();
}

public String fault() {
if (!endgame.getAsBoolean()) return "Not END GAME";
if (!intakeStowed.getAsBoolean()) return "Intake not stowed";
if (battery.getAsDouble() < minBattery) return "Battery low";
if (!sensorOk.get()) return "Sensor fault";
return "";
}
}

Usage: check ready() before climb command; show fault() on dashboard/LED if blocked.