NextFeedbackCRServo

class NextFeedbackCRServo(initializer: () -> CRServoImplEx, feedbackName: String, cacheTolerance: Double = 0.01) : NextCRServo

A NextCRServo paired with an analog feedback input for reading the servo's actual angle. Useful for continuous-rotation servos with feedback wires (e.g. Axon CR) where you want to know how far the servo has rotated.

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

Parameters

initializer

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

feedbackName

Hardware map name of the analog input.

cacheTolerance

Tolerance for the NextCRServo power caching delegate.

Constructors

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

Constructor to create a NextFeedbackCRServo using a servo name.

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

Constructor to create a NextFeedbackCRServo 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

Direction of the servo. Setting this to DcMotorSimple.Direction.REVERSE causes positive power values to spin the servo the opposite way, and vice versa.

Link copied to clipboard

Power applied to the servo, in the range -1.0, 1.0.

Functions

Link copied to clipboard
fun disable()

Disables the PWM output of the associated servo.

Link copied to clipboard
fun enable()

Enables the PWM output of the associated servo.

Link copied to clipboard

Sets the servo's direction to DcMotorSimple.Direction.REVERSE, causing positive power values to spin the servo the opposite way.