MotorVelocityTask

class MotorVelocityTask(var target: Double, val motor: Motor, val encoder: RotaryEncoder, val pid: PID) : Task

Task that controls the velocity of a motor using a PID controller. Stop task using kill function.

Parameters

target

Target Velocity

motor

Motor

encoder

Motor Encoder

pid

PID controller for the velocity

Constructors

Link copied to clipboard
constructor(target: Double, motor: Motor, encoder: RotaryEncoder, pid: PID)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val pid: PID
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var pT: Long
Link copied to clipboard

Functions

Link copied to clipboard
open override fun kill()

Used to stop tasks part of the way through.

Link copied to clipboard
open override fun loop(): Boolean

Called every loop cycle of the queue. Returning true moves on to next task.

Link copied to clipboard
open fun onBegin(): Boolean

Called when task is started. Returning false will skip the task.

Link copied to clipboard
fun setSpeed(speed: Double)

Set the target velocity