Skip to content

Continuous-Rotation Servos

NextCRServo is a lightweight wrapper around a continuous-rotation FTC servo (CRServoImplEx) that gives you a more user-friendly interface for controlling power and direction.

There are two ways to construct a NextCRServo, depending on what you desire.

// By Lynx Module and port, recommended
val intakeServo = NextCRServo(RobotController.controlHub, 0)
// Using a configuration name
val intakeServo = NextCRServo("intakeServo")

Both constructors accept an optional cacheTolerance parameter:

Parameter Type Default Description
cacheTolerance Double 0.01 Minimum change in power required before a new value is written to the servo.

NextCRServo has a powerable property in the range [-1.0, 1.0] as a Double. This is what will set your servo to actually move.

intakeServo.power = 0.75

Sets the servo’s direction to NextMotor.Direction.REVERSE, causing positive power values to spin the servo the opposite way. Returns the servo itself, so it can be chained off the constructor.

val intakeServo = NextCRServo("intakeServo").reverse()