Package com.studica.frc

## Class Titan.Encoder

- java.lang.Object
- - com.studica.frc.Titan.Encoder

All Implemented Interfaces:
  `edu.wpi.first.wpilibj.CounterBase`

Enclosing class:
  Titan

    public class Titan.Encoder
    extends java.lang.Object
    implements edu.wpi.first.wpilibj.CounterBase

Represents one encoder input on the Titan Quad controller.

Obtain an instance via `Titan.getEncoder(int, double)` rather than constructing directly.

Implements `CounterBase` for WPILib compatibility.

### Nested Class Summary

### Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.CounterBase

`edu.wpi.first.wpilibj.CounterBase.EncodingType`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `get()` Returns 0 â€” use `getRaw()` for the actual tick count.
`int` `getCount()` Return the raw signed tick count as an `int`.
`boolean` `getDirection()`
`double` `getDistance()` Return the accumulated travel distance in the units configured by the `distPerTick` value supplied to `Titan.getEncoder(int, double)`.
`int` `getEncoderIndex()`
`double` `getPeriod()` Not implemented.
`double` `getRaw()` Return the raw signed tick count from the controller.
`double` `getSpeed()`
`boolean` `getStopped()` Not implemented.
`void` `invertSpeed()` Invert the sign of speed readings returned by `getSpeed()`.
`void` `reset()` Zero the encoder tick count on the controller.
`void` `setMaxPeriod​(double maxPeriod)` Not implemented.
`void` `setReverseDirection()` Reverse the sign of all distance readings from this encoder.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getDistance

    public double getDistance()

Return the accumulated travel distance in the units configured by the `distPerTick` value supplied to `Titan.getEncoder(int, double)`.

Returns:
  Distance (sign may be reversed by `setReverseDirection()`)

#### getRaw

    public double getRaw()

Return the raw signed tick count from the controller.

Returns:
  Raw encoder tick count

#### getCount

    public int getCount()

Return the raw signed tick count as an `int`. More precise than `getRaw()` as it avoids double conversion.

Returns:
  Signed 32-bit encoder tick count

#### invertSpeed

    public void invertSpeed()

Invert the sign of speed readings returned by `getSpeed()`.

#### getSpeed

    public double getSpeed()

Returns:
  Encoder shaft speed in RPM (sign may be inverted by `invertSpeed()`)

#### setReverseDirection

    public void setReverseDirection()

Reverse the sign of all distance readings from this encoder. Equivalent to mounting the encoder on the opposite side of the shaft.

#### getEncoderIndex

    public int getEncoderIndex()

Returns:
  encoder index [0, 3] within the controller

#### get

    public int get()

Returns 0 â€” use `getRaw()` for the actual tick count.

Specified by:
  `get` in interface `edu.wpi.first.wpilibj.CounterBase`
Returns:
  0

#### reset

    public void reset()

Zero the encoder tick count on the controller.

Specified by:
  `reset` in interface `edu.wpi.first.wpilibj.CounterBase`

#### getPeriod

    public double getPeriod()

Not implemented.

Specified by:
  `getPeriod` in interface `edu.wpi.first.wpilibj.CounterBase`
Returns:
  0

#### setMaxPeriod

    public void setMaxPeriod​(double maxPeriod)

Not implemented.

Specified by:
  `setMaxPeriod` in interface `edu.wpi.first.wpilibj.CounterBase`

#### getStopped

    public boolean getStopped()

Not implemented.

Specified by:
  `getStopped` in interface `edu.wpi.first.wpilibj.CounterBase`
Returns:
  false

#### getDirection

    public boolean getDirection()

Specified by:
  `getDirection` in interface `edu.wpi.first.wpilibj.CounterBase`
Returns:
  `true` if reverse direction is active