Package frc.robot

Class Superstructure

All Implemented Interfaces:
Sendable, Subsystem

public class Superstructure extends SubsystemBase
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 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

      public Command deployArm()
      Returns:
      A command to deploy the intake arm.
    • retractArm

      public Command retractArm()
      Returns:
      A command to retract the intake arm.
    • intake

      public Command intake()
      Returns:
      A command to run the intake spinner.
    • extake

      public Command extake()
      Returns:
      A command to reverse the intake spinner (extake).
    • raiseClimb

      public Command raiseClimb()
      Returns:
      A command to raise the climb mechanism.
    • lowerClimb

      public Command 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

      public Trigger canDeployArm()
      Returns:
      A trigger that is true only if the arm is safe to deploy (not climbing, and climb is stowed).
    • canRunIntake

      public Trigger canRunIntake()
      Returns:
      A trigger that is true if the intake is physically in a position to run.
    • canClimb

      public Trigger canClimb()
      Returns:
      A trigger that is true if climb mode is active and the arm is safely retracted.
    • isReadyToShoot

      public Trigger 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

      public Rotation2d getTargetRotation()
      Returns:
      The desired robot rotation for the current aiming target.
    • getClimbMode

      public WritableTrigger 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.