Package frc.robot
Class Superstructure
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.Superstructure
The Superstructure subsystem acts as an orchestrator for the robot's secondary systems.
It coordinates the interactions between the Arm, Spinner, Shooter, and Climb subsystems, ensuring that mechanical interlocks are respected (e.g., not deploying the intake while climbing) and managing field-position-based aiming logic.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanClimb()voidClears all faults and warnings from all subsystems.extake()booleanintake()booleanReturns whether or not all subsystems in the superstructure are healthyvoidperiodic()Updates the high-level state of the robot, including aiming calculations based on field position and determining whether the shooter should be active.voidToggles the climb mode state.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
-
Superstructure
public Superstructure(Drive drive, Climb climb, Arm arm, Spinner spinner, Shooter shooter, Indexer indexer, PDH pdh, Vision vision, Driver driver, Operator operator) Constructs the Superstructure.- Parameters:
drive- The drive subsystem.climb- The climb subsystem.arm- The arm subsystem.spinner- The spinner subsystem.shooter- The shooter subsystem.indexer- The indexer subsystem.pdh- The power distribution hub subsystem.vision- The vision subsystem.driver- The driver control service.operator- The operator control service.
-
-
Method Details
-
periodic
public void periodic()Updates the high-level state of the robot, including aiming calculations based on field position and determining whether the shooter should be active. -
deployArm
- Returns:
- A command to deploy the intake arm.
-
retractArm
- Returns:
- A command to retract the intake arm.
-
intake
- Returns:
- A command to run the intake spinner.
-
extake
- Returns:
- A command to reverse the intake spinner (extake).
-
raiseClimb
- Returns:
- A command to raise the climb mechanism.
-
lowerClimb
- Returns:
- A command to lower the climb mechanism.
-
toggleClimbMode
public void toggleClimbMode()Toggles the climb mode state. If climb mode is enabled, the intake arm is automatically commanded to retract to prevent damage. -
canDeployArm
- Returns:
- A trigger that is true only if the arm is safe to deploy (not climbing, and climb is stowed).
-
canRunIntake
- Returns:
- A trigger that is true if the intake is physically in a position to run.
-
canClimb
- Returns:
- A trigger that is true if climb mode is active and the arm is safely retracted.
-
isReadyToShoot
- Returns:
- A trigger that is true when the robot has a target, is correctly aligned to the target's heading, and the shooter flywheel/hood are at their setpoints.
-
hasTarget
public boolean hasTarget()- Returns:
- Whether the superstructure currently has an active aiming target.
-
getTargetRotation
- Returns:
- The desired robot rotation for the current aiming target.
-
getClimbMode
- Returns:
- The WritableTrigger representing the climb mode state.
-
isHealthy
public boolean isHealthy()Returns whether or not all subsystems in the superstructure are healthy- Returns:
- True if all subsystems are healthy, false otherwise.
-
clearFaults
public void clearFaults()Clears all faults and warnings from all subsystems.
-