-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27f6422
commit d2bc1e7
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/java/frc/robot/subsystems/gateway/GatewayIOHardware.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
// | ||
} |