Skip to content

Commit

Permalink
Gateway subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
AceiusRedshift committed Nov 20, 2024
1 parent 27f6422 commit d2bc1e7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/main/java/frc/robot/subsystems/gateway/Gateway.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package frc.robot.subsystems.gateway;

import edu.wpi.first.math.controller.BangBangController;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Gateway extends SubsystemBase {
private GatewayIO IO;
private GatewayIOInputAutoLogged input;
private BangBangController controller;

public Gateway(GatewayIO gatewayIO) {
IO = gatewayIO;
}

@Override
public void periodic() {
if (controller.calculate(input.psi, getTargetPsi()) == 1) {
IO.beginFilling();
} else {
IO.stopFilling();
}

IO.updateInputs(input);
}

public float getTargetPsi() {
return input.targetPsi;
}

public void setTargetPsi(int targetPsi) {
input.targetPsi = targetPsi;
}

public void stopFilling() {
input.targetPsi = input.psi;
IO.stopFilling();
}

public void fireCannon(byte cannonId) {
IO.fireCannon(cannonId);
}
}
1 change: 1 addition & 0 deletions src/main/java/frc/robot/subsystems/gateway/GatewayIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public interface GatewayIO {
public static class GatewayIOInput {
boolean filling;
float psi;
float targetPsi;
}

public default void updateInputs(GatewayIOInput inputs) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package frc.robot.subsystems.gateway;

public class GatewayIOHardware implements GatewayIO {}
public class GatewayIOHardware implements GatewayIO {
//
}

0 comments on commit d2bc1e7

Please sign in to comment.