RunToVelocity
class RunToVelocity @JvmOverloads constructor(val controllable: Controllable, val targetVelocity: Double, val controller: Controller, val subsystems: Set<Subsystem> = setOf(), val outCondition: () -> Boolean = { abs(controllable.velocity)-targetVelocity < 10 }) : Command
This implements a PID controller to drive a motor to a specified target velocity. Note that this command will spin a motor to a specific velocity, and then depower the motor. To have it hold velocity, set the subsystem's default command to a HoldVelocity command.
Parameters
controllable
the Controllable to control
targetVelocity
the target velocity
controller
the Controller to implement
subsystems
the list of Subsystems this command interacts with (should be whatever subsystem holds this command)
outCondition
will be evaluated every update, and the command will stop once it returns true
Constructors
Link copied to clipboard
constructor(controllable: Controllable, targetVelocity: Double, controller: Controller, subsystem: Subsystem, outCondition: () -> Boolean = { abs(controllable.velocity)-targetVelocity < 10 })
constructor(controllable: Controllable, targetVelocity: Double, controller: Controller, subsystems: Set<Subsystem> = setOf(), outCondition: () -> Boolean = { abs(controllable.velocity)-targetVelocity < 10 })