Encoder

public final class Encoder

A wrapper for motor encoders in the FTC SDK.

Parameters

getPosition

the position supplier which points to the current position of the motor in ticks

getVelocity

the position supplier which points to the current velocity of the motor in ticks per second

Constructors

Link copied to clipboard
public Motor.Encoder Motor.Encoder(HardwareMap hMap, String id)

Constructs an encoder from the provided id of the corresponding motor.

Properties

Link copied to clipboard
private final Double distance

The distance traveled by the encoder computed using distancePerTick.

Link copied to clipboard

The distance per revolution of the encoder.

Link copied to clipboard
private final Double distanceVelocity

The velocity of the encoder in units per second computed using distancePerTick.

Link copied to clipboard
private final Integer position

The current position of the encoder in ticks.

Link copied to clipboard

Whether the encoder is reversed. Independent of motor direction.

Link copied to clipboard
private final Double velocity

The corrected velocity of the encoder in ticks per second, accounting for overflow.

Functions

Link copied to clipboard
public final Double getDistance()
Link copied to clipboard
public final Double getDistanceVelocity()
Link copied to clipboard
public final Integer getPosition()
Link copied to clipboard
public final Double getVelocity()
Link copied to clipboard
public final static List<Motor.Encoder> multiple(HardwareMap hMap, Pair<String, Boolean> ids)
public final static List<Motor.Encoder> multiple(HardwareMap hMap, String ids)

Utility method for constructing multiple encoders with the same specifications.

Link copied to clipboard
public final Unit reset()

Resets the encoder without having to stop the corresponding motor.

Link copied to clipboard
public final Motor.Encoder reversed()

Reverses the encoder.

Link copied to clipboard
public final Motor.Encoder setReversed(Boolean reversed)