NextServo

constructor(initializer: () -> ServoImplEx, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)

Parameters

initializer

A function returning the backing ServoImplEx. It will be invoked lazily the first time the servo is accessed.

cacheTolerance

Tolerance used by the Caching delegate for position updates; defaults to 0.01.

direction

The initial direction of the servo defined by the user as a NextMotor.Direction which defaults to NextMotor.Direction.FORWARD


constructor(module: NextLynxModule, port: Int, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)

Constructor to create a NextServo using a LynxModule and port number.

Example:

val servo = NextServo(RobotController.controlHub, 0) // Creates a NextServo on the Control Hub port 0

Parameters

port

The servo port (in the range 0, 5)

cacheTolerance

Tolerance used by the Caching delegate for position updates; defaults to 0.01.

direction

The initial direction of the servo defined by the user as a NextMotor.Direction which defaults to NextMotor.Direction.FORWARD


constructor(name: String, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)

Constructor to create a NextServo using configuration name

Example:

// Creates a NextServo with the config name: "armServo"
val servo = NextServo("armServo")

Parameters

name

The configuration name for the servo, usually found on the Driver Station

cacheTolerance

Tolerance used by the Caching delegate for position updates; defaults to 0.01.

direction

The initial direction of the servo defined by the user as a NextMotor.Direction which defaults to NextMotor.Direction.FORWARD