Package frc.robot.subsystems.shooter
Class Shooter
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.shooter.Shooter
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHigh-level goals for the shooter subsystem.static final recordRepresents the desired physical state of the shooter subsystem. -
Constructor Summary
ConstructorsConstructorDescriptionShooter(FlywheelIO flywheelIO, HoodIO hoodIO) Creates a new Shooter subsystem. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all faults and warnings.doubleReturns the flywheel velocity error in radians per second (target minus actual).Returns a trigger that is true when the flywheel velocity is within tolerance.booleanReturns whether or not the subsystem is healthyReturns a trigger that is true when the hood actuator has reached its setpoint.Checks if the shooter is ready to launch a game piece.voidperiodic()Updates hardware inputs, logs data, and updates status alerts.run()Sets the shooter goal to RUNNING.runHeld()Runs the shooter while the command is held.voidsetGoal(Shooter.Goal goal) Sets the high-level goal for the shooter.voidConvenience method to set the running goal directly.voidSets the target state for aiming (flywheel speed and hood angle).voidsetStop()Convenience method to set the stop goal directly.stop()Safely stops the flywheels and retracts the hood.sysIdDynamic(SysIdRoutine.Direction direction) Returns a command to run a dynamic SysId test.sysIdQuasistatic(SysIdRoutine.Direction direction) Returns a command to run a quasistatic SysId test.Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
Shooter
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
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. -
setShooterState
Sets the target state for aiming (flywheel speed and hood angle).- Parameters:
state- The target shooter state.
-
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
Returns a trigger that is true when the flywheel velocity is within tolerance.- Returns:
- The flywheel ready 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
Safely stops the flywheels and retracts the hood.- Returns:
- A command to stop the shooter.
-
runHeld
Runs the shooter while the command is held.- Returns:
- A command to run the shooter while held.
-
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
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
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 -
clearFaults
public void clearFaults()Clears all faults and warnings.- Specified by:
clearFaultsin interfaceMonitored
-