Class SparkMaxAbsoluteEncoder

    • Method Detail

      • getPosition

        public double getPosition()
        Description copied from interface: AbsoluteEncoder
        Get the position of the motor. This returns the native units of 'rotations' by default, and can be changed by a scale factor using setPositionConversionFactor().
        Specified by:
        getPosition in interface AbsoluteEncoder
        Returns:
        Number of rotations of the motor
      • getVelocity

        public double getVelocity()
        Description copied from interface: AbsoluteEncoder
        Get the velocity of the motor. This returns the native units of 'rotations per second' by default, and can be changed by a scale factor using setVelocityConversionFactor().
        Specified by:
        getVelocity in interface AbsoluteEncoder
        Returns:
        Number of rotations per second of the motor
      • setPositionConversionFactor

        public REVLibError setPositionConversionFactor​(double factor)
        Description copied from interface: AbsoluteEncoder
        Set the conversion factor for position of the encoder. Multiplied by the native output units to give you position
        Specified by:
        setPositionConversionFactor in interface AbsoluteEncoder
        Parameters:
        factor - The conversion factor to multiply the native units by
        Returns:
        REVLibError.kOk if successful
      • getPositionConversionFactor

        public double getPositionConversionFactor()
        Description copied from interface: AbsoluteEncoder
        Get the conversion factor for position of the encoder. Multiplied by the native output units to give you position
        Specified by:
        getPositionConversionFactor in interface AbsoluteEncoder
        Returns:
        The conversion factor for position
      • setVelocityConversionFactor

        public REVLibError setVelocityConversionFactor​(double factor)
        Description copied from interface: AbsoluteEncoder
        Set the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity
        Specified by:
        setVelocityConversionFactor in interface AbsoluteEncoder
        Parameters:
        factor - The conversion factor to multiply the native units by
        Returns:
        REVLibError.kOk if successful
      • getVelocityConversionFactor

        public double getVelocityConversionFactor()
        Description copied from interface: AbsoluteEncoder
        Get the conversion factor for velocity of the encoder. Multiplied by the native output units to give you velocity
        Specified by:
        getVelocityConversionFactor in interface AbsoluteEncoder
        Returns:
        The conversion factor for velocity
      • setAverageDepth

        public REVLibError setAverageDepth​(int depth)
        Description copied from interface: AbsoluteEncoder
        Set the average sampling depth for an absolute encoder. This is a bit size and should be either 1, 2, 4, 8, 16, 32, 64, or 128
        Specified by:
        setAverageDepth in interface AbsoluteEncoder
        Parameters:
        depth - The average sampling depth of 1, 2, 4, 8, 16, 32, 64, or 128
        Returns:
        REVLibError.kOk if successful
      • getAverageDepth

        public int getAverageDepth()
        Description copied from interface: AbsoluteEncoder
        Get the average sampling depth for an absolute encoder
        Specified by:
        getAverageDepth in interface AbsoluteEncoder
        Returns:
        The average sampling depth
      • setZeroOffset

        public REVLibError setZeroOffset​(double offset)
        Description copied from interface: AbsoluteEncoder
        Sets the zero offset of an absolute encoder (the position that is reported as zero).

        The zero offset is specified as the reported position of the encoder in the desired zero position, if the zero offset was set to 0. It is influenced by the absolute encoder's position conversion factor, and whether it is inverted.

        Always call SetPositionConversionFactor() and SetInverted() before calling this function.

        Specified by:
        setZeroOffset in interface AbsoluteEncoder
        Parameters:
        offset - The zero offset with the position conversion factor applied
        Returns:
        REVLibError.kOk if successful
      • getZeroOffset

        public double getZeroOffset()
        Description copied from interface: AbsoluteEncoder
        Gets the zero offset for an absolute encoder (the position that is reported as zero).

        The zero offset is specified as the reported position of the encoder in the desired zero position, if the zero offset was set to 0. It is influenced by the absolute encoder's position conversion factor, and whether it is inverted.

        Specified by:
        getZeroOffset in interface AbsoluteEncoder
        Returns:
        The zero offset of the absolute encoder with the position conversion factor applied