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.
Creating a NextCRServo
Section titled “Creating a NextCRServo”There are two ways to construct a NextCRServo, depending on what you desire.
// By Lynx Module and port, recommendedval intakeServo = NextCRServo(RobotController.controlHub, 0)
// Using a configuration nameval intakeServo = NextCRServo("intakeServo")// By Lynx Module and port, recommendedNextCRServo intakeServo = new NextCRServo(RobotController.controlHub(), 0);
// Using a configuration nameNextCRServo intakeServo = new 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.75intakeServo.setPower(0.75);reverse()
Section titled “reverse()”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()NextCRServo intakeServo = new NextCRServo("intakeServo").reverse();
