Launcher

class Launcher(leftMotor: DcMotorEx, rightMotor: DcMotorEx, distanceSensor: DistanceSensor, leftPIDFCoefficients: PIDFCoefficients, rightPIDFCoefficients: PIDFCoefficients, maxVelocity: Double, targetVelocity: Double, velocityTolerance: Double = 40.0) : Attachment

Launcher is an Attachment that controls a dual motor flywheel launcher.

Parameters

leftMotor

the left DcMotorEx of the Launcher

rightMotor

the right DcMotorEx of the Launcher

distanceSensor

the DistanceSensor used to measure distance to the target

leftPIDFCoefficients

the PIDFCoefficients for the left motor

rightPIDFCoefficients

the PIDFCoefficients for the right motor

maxVelocity

the maximum velocity of the launcher motors

targetVelocity

the target velocity of the launcher motors

Constructors

Link copied to clipboard
constructor(leftMotor: DcMotorEx, rightMotor: DcMotorEx, distanceSensor: DistanceSensor, leftPIDFCoefficients: PIDFCoefficients, rightPIDFCoefficients: PIDFCoefficients, maxVelocity: Double, targetVelocity: Double, velocityTolerance: Double = 40.0)

Properties

Link copied to clipboard

the average time taken to spin up to target velocity

Link copied to clipboard

the average difference in velocity between the left and right motors

Link copied to clipboard

the current target velocity of the launcher motors

Link copied to clipboard

whether the launcher is at the target velocity

Link copied to clipboard

whether either motor is overheating

Link copied to clipboard

whether the launcher is stopped

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

the difference in velocity between the left and right motors

Functions

Link copied to clipboard
fun disable(): Action

Disables the launcher by setting the velocity to 0.

Link copied to clipboard
fun enable(target: Double = targetVelocity): Action

Enables the launcher to spin up to the target velocity.

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