Package trclib.sensor

Interface TrcEncoder

All Known Implementing Classes:
FtcAnalogEncoder, FtcOctoQuad, TrcAbsoluteEncoder

public interface TrcEncoder
This interface specifies a common implementation of a generic encoder with which makes different types of encoders compatible with each other.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    This method reads the raw encoder position in encoder units (generally encoder counts).
    double
    This method reads the raw encoder velocity in encoder units per second.
    double
    This method returns the encoder position adjusted by scale and offset.
    double
    This method returns the encoder velocity adjusted by scale.
    boolean
    This method checks if the encoder direction is inverted.
    void
    This method resets the encoder position.
    void
    setInverted(boolean inverted)
    This method reverses the direction of the encoder.
    void
    setScaleAndOffset(double scale, double offset, double zeroOffset)
    This method sets the encoder scale and offset.
  • Method Details

    • reset

      void reset()
      This method resets the encoder position.
    • getRawPosition

      double getRawPosition()
      This method reads the raw encoder position in encoder units (generally encoder counts).
      Returns:
      raw position of the encoder in encoder units.
    • getScaledPosition

      double getScaledPosition()
      This method returns the encoder position adjusted by scale and offset.
      Returns:
      encoder position adjusted by scale and offset.
    • getRawVelocity

      double getRawVelocity()
      This method reads the raw encoder velocity in encoder units per second.
      Returns:
      raw encoder velocity in encoder units per second.
    • getScaledVelocity

      double getScaledVelocity()
      This method returns the encoder velocity adjusted by scale.
      Returns:
      encoder velocity adjusted by scale.
    • setInverted

      void setInverted(boolean inverted)
      This method reverses the direction of the encoder.
      Parameters:
      inverted - specifies true to reverse the encoder direction, false otherwise.
    • isInverted

      boolean isInverted()
      This method checks if the encoder direction is inverted.
      Returns:
      true if encoder direction is rerversed, false otherwise.
    • setScaleAndOffset

      void setScaleAndOffset(double scale, double offset, double zeroOffset)
      This method sets the encoder scale and offset.
      Parameters:
      scale - specifies the scale value.
      offset - specifies the offset value.
      zeroOffset - specifies the zero offset for absolute encoder.