Class CANSensor

  • Direct Known Subclasses:
    CANAnalog, CANEncoder

    public abstract class CANSensor
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      protected abstract int getID()
      Get the ID of the sensor that is connected to the SparkMax through the encoder port on the front of the controller (not the top port).
      abstract boolean getInverted()
      Get the phase of the CANSensor.
      abstract CANError setInverted​(boolean inverted)
      Set the phase of the CANSensor so that it is set to be in phase with the motor itself.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getID

        protected abstract int getID()
        Get the ID of the sensor that is connected to the SparkMax through the encoder port on the front of the controller (not the top port).
        Returns:
        The ID of the sensor
      • setInverted

        public abstract CANError setInverted​(boolean inverted)
        Set the phase of the CANSensor so that it is set to be in phase with the motor itself. This only works for quadrature encoders and analog sensors. This will throw an error if the user tries to set the inversion of the hall effect.
        Parameters:
        inverted - The phase of the sensor
        Returns:
        CANError.kOK if successful
      • getInverted

        public abstract boolean getInverted()
        Get the phase of the CANSensor. This will just return false if the user tries to get the inversion of the hall effect.
        Returns:
        The phase of the sensor