Encoder

open class Encoder

Represents a motor or external encoder that takes in suppliers of position and velocity to calculate motor ticks. The velocity methods of this class have been adjusted to include acceleration and corrected velocity receivers.

Since

4.0.0

Constructors

Link copied to clipboard
constructor(position: Supplier<Integer>, velocity: Supplier<Double>)
The encoder object for the motor.

Functions

Link copied to clipboard
Link copied to clipboard
Gets the current encoder velocity while also correcting for velocity overflow (REV hardware limitation workaround)
Link copied to clipboard
open fun getPosition(): Int
Link copied to clipboard
Link copied to clipboard
open fun getVelocity(): Double
Link copied to clipboard
open fun reset()
Resets the encoder without having to stop the motor.
Link copied to clipboard
open fun setDirection(direction: DcMotorSimple.Direction)
Sets the direction of the encoder to forward or reverse
Link copied to clipboard
Call to use encoder overflow (exceeding 32767 ticks/sec) correction on getVelocity.