Class IntakeExtension

java.lang.Object
frc.spectrumLib.mechanism.Mechanism
frc.robot.subsystems.intakeExtension.IntakeExtension
All Implemented Interfaces:
Subsystem

public class IntakeExtension extends Mechanism
The Intake Extension subsystem. Extends and retracts the fuel intake.

The deploy is a rack-and-pinion driven by two independent motors: a left axis (this class, CAN id 4, Clockwise_Positive) and a right axis (IntakeExtension.IntakeExtensionRight, CAN id 5, CounterClockwise_Positive). Each side runs its own closed-loop position control rather than one following the other, so a side that skips teeth on the rack can be driven on its own to resync.

Normal deploy/retract states command both axes to the same setpoint. The RESYNC state re-establishes truth by driving each side independently into the fully-extended hard stop (using a soft-limit-bypassing voltage), detecting the stall, and re-zeroing that side's encoder at maxRotations. This recovers from a tooth skip, which otherwise leaves the motor encoder reading a position the rack is no longer at.

  • Constructor Details

  • Method Details

    • resetCurrentPositionToMax

      public void resetCurrentPositionToMax()
    • resetCurrentPositionToMaxCommand

      public Command resetCurrentPositionToMaxCommand()
    • resetToInitialPos

      public Command resetToInitialPos()
    • setBrakeMode

      public void setBrakeMode(boolean isInBrake)
      Sets brake mode on both deploy axes.
      Overrides:
      setBrakeMode in class Mechanism
      Parameters:
      isInBrake - true to set brake mode; false to set coast mode
    • setWantedState

      public void setWantedState(IntakeExtension.WantedState state)
    • isResyncComplete

      public boolean isResyncComplete()
      Whether the most recent resync has finished homing both sides.
    • resyncCommand

      public Command resyncCommand()
      Runs a full resync: drives both sides into the extended hard stop, re-zeros each, then returns the subsystem to STOPPED.
      Returns:
      a command that completes once both sides are re-zeroed
    • periodic

      public void periodic()
      Description copied from class: Mechanism
      Called once per scheduler loop. Concrete subclasses should override to implement their periodic state-machine logic, telemetry, and sensor updates.
      Specified by:
      periodic in interface Subsystem
      Overrides:
      periodic in class Mechanism
    • simulationInit

      public void simulationInit()
    • simulationPeriodic

      public void simulationPeriodic()
      Description copied from class: Mechanism
      Called once per simulation loop. Concrete subclasses should override to update simulation state (e.g., physics model inputs).
      Specified by:
      simulationPeriodic in interface Subsystem
      Overrides:
      simulationPeriodic in class Mechanism
    • getConfig

    • getSim

      public frc.robot.subsystems.intakeExtension.IntakeExtension.IntakeExtensionSim getSim()