Class CustomDigitalEncoder

java.lang.Object
edu.wpi.first.wpilibj.Encoder
lib.custom.sensors.CustomDigitalEncoder
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable, edu.wpi.first.wpilibj.CounterBase, AutoCloseable, CustomEncoder, NativeDerivativeSensor

public class CustomDigitalEncoder extends edu.wpi.first.wpilibj.Encoder implements CustomEncoder
A RoboRIO encoder that implements the generic encoder class.
  • Nested Class Summary

    Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.Encoder

    edu.wpi.first.wpilibj.Encoder.IndexingType

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

    edu.wpi.first.wpilibj.CounterBase.EncodingType
  • Field Summary

    Fields inherited from class edu.wpi.first.wpilibj.Encoder

    m_aSource, m_bSource, m_indexSource
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomDigitalEncoder(int aChannel, int bChannel)
     
    CustomDigitalEncoder(int aChannel, int bChannel, boolean reverseDirection)
     
    CustomDigitalEncoder(int aChannel, int bChannel, boolean reverseDirection, edu.wpi.first.wpilibj.CounterBase.EncodingType encodingType)
     
    CustomDigitalEncoder(int aChannel, int bChannel, int indexChannel)
     
    CustomDigitalEncoder(int aChannel, int bChannel, int indexChannel, boolean reverseDirection)
     
    CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource)
     
    CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, boolean reverseDirection)
     
    CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, boolean reverseDirection, edu.wpi.first.wpilibj.CounterBase.EncodingType encodingType)
     
    CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, edu.wpi.first.wpilibj.DigitalSource indexSource)
     
    CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, edu.wpi.first.wpilibj.DigitalSource indexSource, boolean reverseDirection)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets direction of most recent movement
    double
    Gets the distance per pulse
    double
    Gets current distance
    double
    Gets rate
    boolean
    Gets inversion state
    boolean
    Returns true when stopped
    void
    setDistancePerPulse(double distancePerPulse)
    Sets the distance per pulse
    void
    setReverseDirection(boolean reverseDirection)
    To the surprise of everyone, enables and disables reverse direction

    Methods inherited from class edu.wpi.first.wpilibj.Encoder

    close, get, getDecodingScaleFactor, getDirection, getDistance, getEncodingScale, getFPGAIndex, getPeriod, getRate, getRaw, getSamplesToAverage, getStopped, initSendable, reset, setIndexSource, setIndexSource, setIndexSource, setIndexSource, setMaxPeriod, setMinRate, setSamplesToAverage, setSimDevice

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface lib.custom.sensors.CustomEncoder

    getDirection, getDistance, getStopped, reset

    Methods inherited from interface lib.custom.sensors.NativeDerivativeSensor

    getRate
  • Constructor Details

    • CustomDigitalEncoder

      public CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, boolean reverseDirection)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, boolean reverseDirection, edu.wpi.first.wpilibj.CounterBase.EncodingType encodingType)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, edu.wpi.first.wpilibj.DigitalSource indexSource)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(edu.wpi.first.wpilibj.DigitalSource aSource, edu.wpi.first.wpilibj.DigitalSource bSource, edu.wpi.first.wpilibj.DigitalSource indexSource, boolean reverseDirection)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(int aChannel, int bChannel)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(int aChannel, int bChannel, boolean reverseDirection)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(int aChannel, int bChannel, boolean reverseDirection, edu.wpi.first.wpilibj.CounterBase.EncodingType encodingType)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(int aChannel, int bChannel, int indexChannel)
    • CustomDigitalEncoder

      public CustomDigitalEncoder(int aChannel, int bChannel, int indexChannel, boolean reverseDirection)
  • Method Details

    • getDistancePerPulse

      public double getDistancePerPulse()
      Description copied from interface: CustomEncoder
      Gets the distance per pulse
      Specified by:
      getDistancePerPulse in interface CustomEncoder
      Overrides:
      getDistancePerPulse in class edu.wpi.first.wpilibj.Encoder
    • setDistancePerPulse

      public void setDistancePerPulse(double distancePerPulse)
      Description copied from interface: CustomEncoder
      Sets the distance per pulse
      Specified by:
      setDistancePerPulse in interface CustomEncoder
      Overrides:
      setDistancePerPulse in class edu.wpi.first.wpilibj.Encoder
    • getReverseDirection

      public boolean getReverseDirection()
      Description copied from interface: CustomEncoder
      Gets inversion state
      Specified by:
      getReverseDirection in interface CustomEncoder
    • setReverseDirection

      public void setReverseDirection(boolean reverseDirection)
      Description copied from interface: CustomEncoder
      To the surprise of everyone, enables and disables reverse direction
      Specified by:
      setReverseDirection in interface CustomEncoder
      Overrides:
      setReverseDirection in class edu.wpi.first.wpilibj.Encoder
    • getDistanceSafely

      public double getDistanceSafely()
      Description copied from interface: CustomEncoder
      Gets current distance
      Specified by:
      getDistanceSafely in interface CustomEncoder
    • getDirectionSafely

      public boolean getDirectionSafely()
      Description copied from interface: CustomEncoder
      Gets direction of most recent movement
      Specified by:
      getDirectionSafely in interface CustomEncoder
    • getStoppedSafely

      public boolean getStoppedSafely()
      Description copied from interface: CustomEncoder
      Returns true when stopped
      Specified by:
      getStoppedSafely in interface CustomEncoder
    • getRateSafely

      public double getRateSafely()
      Description copied from interface: NativeDerivativeSensor
      Gets rate
      Specified by:
      getRateSafely in interface NativeDerivativeSensor