Servos in FTC

Overview

Servos provide precise, limited-range movement for arms, claws, and similar mechanisms. Standard servos move to a position and hold it. Continuous rotation servos spin like motors.

Standard vs Continuous Rotation

FeatureStandard ServoContinuous Rotation (CRServo)
ControlsetPosition(0.0 to 1.0) — positionsetPosition(0.0) reverse, 0.5 stop, 1.0 forward
Use CasesArms, claws, precise anglesIntake rollers, spinners
ConfigServoCRServo

Basic Servo Use

private Servo clawServo;

@Override
public void runOpMode() {
    clawServo = hardwareMap.get(Servo.class, "claw_servo");
    clawServo.setPosition(0.5); // Initial position
    
    waitForStart();
    while (opModeIsActive()) {
        if (gamepad1.a) clawServo.setPosition(0.0);
        else if (gamepad1.b) clawServo.setPosition(1.0);
        telemetry.addData("Position", clawServo.getPosition());
        telemetry.update();
    }
}

Multiple Servos and Gradual Movement

Initialize each servo with a unique hardware map name. For smooth motion, change position in small increments over time. Keep positions within 0.0–1.0 to avoid damage.

Gradual Movement Example

double current = clawServo.getPosition();
double target = 1.0;
double step = 0.02;

while (Math.abs(current - target) > 0.01 && opModeIsActive()) {
    current += (current < target ? step : -step);
    current = Math.max(0.0, Math.min(1.0, current));
    clawServo.setPosition(current);
    sleep(20);
}

Further Reading

Open full interactive app