Class IntakeExtension
- All Implemented Interfaces:
Subsystem
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classThe right deploy axis.static enumstatic enumNested classes/interfaces inherited from class frc.spectrumLib.mechanism.Mechanism
Mechanism.Config, Mechanism.FollowerConfig -
Field Summary
Fields inherited from class frc.spectrumLib.mechanism.Mechanism
followerMotors, motor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfrc.robot.subsystems.intakeExtension.IntakeExtension.IntakeExtensionSimgetSim()booleanWhether the most recent resync has finished homing both sides.voidperiodic()Called once per scheduler loop.voidRuns a full resync: drives both sides into the extended hard stop, re-zeros each, then returns the subsystem toSTOPPED.voidsetBrakeMode(boolean isInBrake) Sets brake mode on both deploy axes.voidvoidvoidCalled once per simulation loop.Methods inherited from class frc.spectrumLib.mechanism.Mechanism
aboveCurrent, aboveDegrees, abovePercentage, aboveRotations, aboveVelocityRPM, applyCurrentLimit, atCurrent, atDegrees, atPercentage, atRotations, atTargetPosition, atVelocityRPM, belowCurrent, belowDegrees, belowPercentage, belowRotations, belowVelocityRPM, checkAvgCurrent, checkMaxCurrent, checkMinThresholdCurrent, coastMode, degreesToRotations, ensureBrakeMode, getCurrentCommandName, getFollowerMotors, getMotor, getName, getPositionDegrees, getPositionPercentage, getPositionRotations, getStatorCurrent, getSupplyCurrent, getTarget, getTemp, getVelocityRPM, getVelocityTargetRPS, getVoltage, isAtRotations, isAttached, isAtTargetPosition, logBatteryUsage, moveToDegrees, moveToPercentage, moveToRotations, percentToRotations, rotationsToDegrees, rotationsToPercent, runCurrentLimits, runFocRotations, runningDefaultCommand, runPercentage, runStop, runTorqueCurrentFoc, runVelocity, runVelocityTcFocRPM, runVoltage, runVoltageNoSoftLimit, setCurrentLimits, setDynMMPositionFoc, setDynMMPositionVoltage, setMMPosition, setMMPosition, setMMPositionFoc, setMMVelocityFOC, setMotorPosition, setPercentOutput, setTorqueCurrentFoc, setVelocity, setVelocityTCFOCrpm, setVelocityTorqueCurrentFOC, setVoltageOutput, setVoltageOutputNoSoftLimit, stop, tareMotor, toggleReverseSoftLimit, toggleSupplyCurrentLimit, toggleTorqueCurrentLimit, updateStatorCurrent, updateSupplyCurrent, updateTemp, updateVoltageMethods 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, startEnd, startRun
-
Constructor Details
-
IntakeExtension
-
-
Method Details
-
resetCurrentPositionToMax
public void resetCurrentPositionToMax() -
resetCurrentPositionToMaxCommand
-
resetToInitialPos
-
setBrakeMode
public void setBrakeMode(boolean isInBrake) Sets brake mode on both deploy axes.- Overrides:
setBrakeModein classMechanism- Parameters:
isInBrake-trueto set brake mode;falseto set coast mode
-
setWantedState
-
isResyncComplete
public boolean isResyncComplete()Whether the most recent resync has finished homing both sides. -
resyncCommand
Runs a full resync: drives both sides into the extended hard stop, re-zeros each, then returns the subsystem toSTOPPED.- Returns:
- a command that completes once both sides are re-zeroed
-
periodic
public void periodic()Description copied from class:MechanismCalled once per scheduler loop. Concrete subclasses should override to implement their periodic state-machine logic, telemetry, and sensor updates. -
simulationInit
public void simulationInit() -
simulationPeriodic
public void simulationPeriodic()Description copied from class:MechanismCalled once per simulation loop. Concrete subclasses should override to update simulation state (e.g., physics model inputs).- Specified by:
simulationPeriodicin interfaceSubsystem- Overrides:
simulationPeriodicin classMechanism
-
getConfig
-
getSim
public frc.robot.subsystems.intakeExtension.IntakeExtension.IntakeExtensionSim getSim()
-