EncoderTicks

Utility class for converting between SI units and encoder ticks.

Author

Lucas Bubner, 2024

Since

3.0.0

Types

Link copied to clipboard
class Generator(motor: DcMotor, ticksPerRevolution: Int, reduction: Double, wheelDiameter: Measure<Distance>?)

Dynamic generator for encoder tick conversions based on a motor.

Functions

Link copied to clipboard
fun createGenerator(motor: DcMotor, reduction: Double = 1.0, wheelDiameter: Measure<Distance>? = null): EncoderTicks.Generator

Create a dynamic generator for encoder tick conversions based on a motor. This will try to automatically determine the number of encoder ticks per revolution, if this is not provided, use the other constructor.

fun createGenerator(motor: DcMotor, ticksPerRevolution: Int, reduction: Double = 1.0, wheelDiameter: Measure<Distance>? = null): EncoderTicks.Generator

Create a dynamic generator for encoder tick conversions based on a motor.

Link copied to clipboard
fun fromAngle(angle: Measure<Angle>, ticksPerRevolution: Int, reduction: Double): Int

Convert an angle to encoder ticks.

Link copied to clipboard
fun fromDistance(distance: Measure<Distance>, ticksPerRevolution: Int, wheelDiameter: Measure<Distance>, reduction: Double): Int

Convert a distance to encoder ticks.

Link copied to clipboard
fun toAngle(ticks: Int, ticksPerRevolution: Int, reduction: Double): Measure<Angle>

Convert encoder ticks to an angle.

Link copied to clipboard
fun toDistance(ticks: Int, ticksPerRevolution: Int, wheelDiameter: Measure<Distance>, reduction: Double): Measure<Distance>

Convert encoder ticks to a distance.