CRServoWithPotentiometerAttachment

open class CRServoWithPotentiometerAttachment(name: String, crServo: CRServo, potentiometer: AnalogInput, direction: DcMotorSimple.Direction) : CRServoAttachment

CRServoWithPotentiometerAttachment is an Attachment that controls a crServo with a potentiometer.

Parameters

name

the name of the cr servo

crServo

the cr servo to control

potentiometer

the potentiometer reading the position of the cr servo

direction

the direction of the cr servo

Constructors

Link copied to clipboard
constructor(name: String, crServo: CRServo, potentiometer: AnalogInput, direction: DcMotorSimple.Direction)

Properties

Link copied to clipboard
Link copied to clipboard
val state: StateFlow<AttachmentState>

Functions

Link copied to clipboard
fun goTo(power: Power, target: Voltage): Action

Move to a specified target at a specified power.

fun goTo(power: Double, target: Double): Action
Link copied to clipboard

Checks if the attachment is currently busy (Running).

Link copied to clipboard

Checks if the attachment is currently in a faulted state.

Link copied to clipboard
fun moveFor(power: Power, seconds: Seconds): Action

Move for a specified amount of seconds and a specified power.

fun moveFor(power: Double, seconds: Double): Action
Link copied to clipboard

Ensures the attachment is in the Idle state, throwing an exception if not.

Link copied to clipboard
fun start(power: Power): Action

Start moving the cr servo at a specified power.

fun start(power: Double): Action
Link copied to clipboard
open override fun stop()

Stops the attachment and resets its state to Idle.

Link copied to clipboard
context(telemetry: Telemetry)
open override fun update()

Updates the telemetry with the current state of the attachment.