Class Shooter

All Implemented Interfaces:
Sendable, Subsystem, Monitored

public class Shooter extends SubsystemBase implements Monitored
Subsystem for controlling the robot's shooter mechanism.

Responsible for controlling the angular velocity of the flywheels and the position of the adjustable hood to regulate launch angle and distance.

  • Constructor Details

    • Shooter

      public Shooter(FlywheelIO flywheelIO, HoodIO hoodIO)
      Creates a new Shooter subsystem.
      Parameters:
      flywheelIO - The abstraction layer for the flywheel hardware.
      hoodIO - The abstraction layer for the hood hardware.
  • Method Details

    • setGoal

      public void setGoal(Shooter.Goal goal)
      Sets the high-level goal for the shooter.
      Parameters:
      goal - The target goal.
    • periodic

      public void periodic()
      Updates hardware inputs, logs data, and updates status alerts.
      Specified by:
      periodic in interface Subsystem
    • setShooterState

      public void setShooterState(Shooter.ShooterState state)
      Sets the target state for aiming (flywheel speed and hood angle).
      Parameters:
      state - The target shooter state.
    • isShooterReady

      public Trigger isShooterReady()
      Checks if the shooter is ready to launch a game piece.
      Returns:
      True if the flywheels are spun up, the hood is in position, and the shooter is active.
    • isFlywheelReady

      public Trigger isFlywheelReady()
      Returns a trigger that is true when the flywheel velocity is within tolerance.
      Returns:
      The flywheel ready trigger.
    • isHoodReady

      public Trigger isHoodReady()
      Returns a trigger that is true when the hood actuator has reached its setpoint.
      Returns:
      The hood ready trigger.
    • getFlywheelErrorRadPerSec

      public double getFlywheelErrorRadPerSec()
      Returns the flywheel velocity error in radians per second (target minus actual).
      Returns:
      The flywheel velocity error in radians per second.
    • stop

      public Command stop()
      Safely stops the flywheels and retracts the hood.
      Returns:
      A command to stop the shooter.
    • runHeld

      public Command runHeld()
      Runs the shooter while the command is held.
      Returns:
      A command to run the shooter while held.
    • run

      public Command run()
      Sets the shooter goal to RUNNING.
      Returns:
      A command to start the shooter.
    • setRunning

      public void setRunning()
      Convenience method to set the running goal directly.
    • setStop

      public void setStop()
      Convenience method to set the stop goal directly.
    • sysIdQuasistatic

      public Command sysIdQuasistatic(SysIdRoutine.Direction direction)
      Returns a command to run a quasistatic SysId test.
      Parameters:
      direction - The direction to run the SysId test (forward or reverse).
      Returns:
      A command to run a quasistatic SysId test.
    • sysIdDynamic

      public Command sysIdDynamic(SysIdRoutine.Direction direction)
      Returns a command to run a dynamic SysId test.
      Parameters:
      direction - The direction to run the SysId test (forward or reverse).
      Returns:
      A command to run a dynamic SysId test.
    • isHealthy

      public boolean isHealthy()
      Returns whether or not the subsystem is healthy
      Specified by:
      isHealthy in interface Monitored
      Returns:
      True if the subsystem is healthy, false otherwise.
    • clearFaults

      public void clearFaults()
      Clears all faults and warnings.
      Specified by:
      clearFaults in interface Monitored