NextFeedbackServo

class NextFeedbackServo(initializer: () -> ServoImplEx, feedbackName: String, cacheTolerance: Double = 0.01) : NextServo

A NextServo paired with an analog feedback input for reading the servo's actual angle. Useful for servos with a feedback wire (e.g. Axon).

Inherits everything from NextServoposition, pwmRange, enable(), disable() — and adds angle for reading the physical angle in radians from the feedback input.

Example:

val arm = NextFeedbackServo("armServo", "armEncoder")
arm.position = 0.5
val angle = arm.angle

Parameters

initializer

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

feedbackName

Hardware map name of the analog input.

cacheTolerance

Tolerance for the NextServo position caching delegate.

Constructors

Link copied to clipboard
constructor(initializer: () -> ServoImplEx, feedbackName: String, cacheTolerance: Double = 0.01)
constructor(servoName: String, feedbackName: String, cacheTolerance: Double = 0.01)

Constructor to create a NextFeedbackServo using a servo name.

constructor(module: LynxModule, port: Int, feedbackName: String, cacheTolerance: Double = 0.01)

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

Properties

Link copied to clipboard

Actual angle of the servo, reported from the analog feedback input.

Link copied to clipboard
Link copied to clipboard

The commanded servo position in the range [0.0, 1.0].

Link copied to clipboard

Provides access to the servo's PWM range configuration.

Functions

Link copied to clipboard
fun disable()

Disables PWM output for the underlying servo.

Link copied to clipboard
fun enable()

Enables PWM output for the underlying servo.

Link copied to clipboard
fun setPwmRange(lower: Double, upper: Double)

Sets the PWM range of the associated servo.