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: Number, 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: Number, 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: Number, reduction: Double): Int

Convert an angle to encoder ticks.

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

Convert a distance to encoder ticks.

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

Convert encoder ticks to an angle.

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

Convert encoder ticks to a distance.

Link copied to clipboard
fun toInches(ticks: Number, wheelRadiusInches: Double, gearRatio: Double, ticksPerRevolution: Number): Double

Converts encoder ticks to inches for use in calculation with a Localizer.