Skip to content
learnFRC.org
programmingexample

Winch Climber Subsystem

High-reduction winch climber with current monitoring, mechanical ratchet release servo, and brake mode locking.

Endgame climbers lift the entire competition robot (up to 135 lb / 61 kg per Rule R408) off the ground. After the buzzer sounds and match power is disabled, the robot must remain suspended for at least 5 seconds without touching the carpet.

This subsystem uses a high-reduction winch motor configured in Brake Mode, paired with a PWM servo-actuated mechanical ratchet pawl.

package frc.robot.subsystems;
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.controls.VoltageOut;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.InvertedValue;
import com.ctre.phoenix6.signals.NeutralModeValue;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class ClimberSubsystem extends SubsystemBase {
private final TalonFX m_winchMotor = new TalonFX(18, "rio");
private final Servo m_ratchetServo = new Servo(0); // PWM port 0
private final VoltageOut m_voltage = new VoltageOut(0);
// Ratchet servo angles
private static final double SERVO_ENGAGED_POS = 0.0;
private static final double SERVO_RELEASED_POS = 0.5;
public ClimberSubsystem() {
configureHardware();
setDefaultCommand(holdCommand());
}
private void configureHardware() {
TalonFXConfiguration cfg = new TalonFXConfiguration();
cfg.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive;
cfg.MotorOutput.NeutralMode = NeutralModeValue.Brake;
// Current limits: allow high torque to lift robot, but protect windings
cfg.CurrentLimits.StatorCurrentLimitEnable = true;
cfg.CurrentLimits.StatorCurrentLimit = 50.0; // 50A stator limit
cfg.CurrentLimits.SupplyCurrentLimitEnable = true;
cfg.CurrentLimits.SupplyCurrentLimit = 40.0;
m_winchMotor.getConfigurator().apply(cfg);
engageRatchet();
}
@Override
public void periodic() {
SmartDashboard.putNumber("Climber/Current_A", m_winchMotor.getStatorCurrent().getValueAsDouble());
SmartDashboard.putNumber("Climber/Position_rot", m_winchMotor.getPosition().getValueAsDouble());
}
public void engageRatchet() {
m_ratchetServo.set(SERVO_ENGAGED_POS);
}
public void releaseRatchet() {
m_ratchetServo.set(SERVO_RELEASED_POS);
}
/**
* Extends the climber arms upwards. Must release ratchet pawl first!
*/
public Command extendArmsCommand() {
return runOnce(this::releaseRatchet)
.andThen(run(() -> m_winchMotor.setControl(m_voltage.withOutput(6.0))))
.withName("ExtendArms");
}
/**
* Pulls robot up by spooling winch cable. Ratchet pawl clicks passively into teeth.
*/
public Command winchUpCommand() {
return runOnce(this::engageRatchet)
.andThen(run(() -> m_winchMotor.setControl(m_voltage.withOutput(-10.0))))
.withName("WinchUp");
}
public Command holdCommand() {
return run(() -> m_winchMotor.setControl(m_voltage.withOutput(0))).withName("HoldClimber");
}
}
Never Power Winch Against Engaged Ratchet in Reverse

Driving a winch backwards with the mechanical ratchet pawl engaged will immediately stall the motor, shear ratchet teeth, or strip gears.