DcMotorAttachment

open class DcMotorAttachment(name: String, motor: DcMotor, idlePower: Double, maxPosition: Int, minPosition: Int = 0, direction: DcMotorSimple.Direction = DcMotorSimple.Direction.FORWARD) : Attachment

DcMotorAttachment is an Attachment that controls a motor.

Parameters

name

the name of the attachment

motor

the motor to control

idlePower

the idle power of the motor

maxPosition

the maximum position of the motor

minPosition

the minimum position of the motor

Constructors

Link copied to clipboard
constructor(name: String, motor: DcMotor, idlePower: Double, maxPosition: Int, minPosition: Int = 0, direction: DcMotorSimple.Direction = DcMotorSimple.Direction.FORWARD)

Properties

Link copied to clipboard

the position of the current goal

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

Functions

Link copied to clipboard
fun goTo(power: Power, position: Ticks): Action

Move to a position at a specified power.

fun goTo(power: Double, position: Int): 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

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

Link copied to clipboard
fun reset(): Action

Resets the motor's encoder.

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.