import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.constants.Constants;
import frc.robot.constants.IdConstants;
+import frc.robot.util.HubActive;
public class Shooter extends SubsystemBase implements ShooterIO {
private final ShooterIOInputsAutoLogged inputs = new ShooterIOInputsAutoLogged();
+
double powerModifier = 1.05; // TESTED
public Shooter(){
Logger.recordOutput("Shooter/realVelocity", shooterMotorLeft.getVelocity().getValueAsDouble() * ShooterConstants.SHOOTER_LAUNCH_DIAMETER);
Logger.recordOutput("Shooter/targetVelocity", shooterTargetSpeed);
+
+ SmartDashboard.putString("WON AUTO?", (HubActive.wonAuto()) ? "WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOON" : "lost");
}
/**
}
}
+
// Shift was is active for blue if red won auto, or red if blue won auto.
boolean shift1Active = switch (alliance.get()) {
case Red -> !redInactiveFirst;
return Optional.of(0.0);
}
}
+ static public boolean wonAuto() {
+ String gameData = DriverStation.getGameSpecificMessage();
+ // If we have no game data, we cannot compute, assume hub is active, as its
+ // likely early in teleop.
+ if (gameData.isEmpty()) {
+ return false;
+ }
+ boolean redInactiveFirst = false;
+ switch (gameData.charAt(0)) {
+ case 'R' -> redInactiveFirst = true;
+ case 'B' -> redInactiveFirst = false;
+ default -> {
+ // If we have invalid game data, assume hub is active.
+ return false;
+ }
+ }
+
+ var alliance = DriverStation.getAlliance().get();
+ boolean x;
+ if (alliance == Alliance.Red) {
+ x = redInactiveFirst;
+ } else {
+ x = !redInactiveFirst;
+ }
+ return x;
+
+ }
+
}