Class DetachedEncoderConfig

java.lang.Object
com.revrobotics.config.BaseConfig
com.revrobotics.encoder.config.DetachedEncoderConfig

public class DetachedEncoderConfig extends BaseConfig
  • Field Details

  • Constructor Details

    • DetachedEncoderConfig

      public DetachedEncoderConfig()
      Create a new object to configure the DetachedEncoder
  • Method Details

    • apply

      Applies settings from another DetachedEncoderConfig to this one.

      Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.

      Parameters:
      other - The DetachedEncoderConfig to copy settings from
      Returns:
      The updated DetachedEncoderConfig for method chaining
    • apply

      Applies settings from a DetachedSignalsConfig to this DetachedEncoderConfig.

      Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.

      Parameters:
      config - The DetachedSignalsConfig to copy settings from
      Returns:
      The updated DetachedEncoderConfig for method chaining
    • inverted

      public DetachedEncoderConfig inverted(boolean inverted)
      Set the phase of the encoder.
      Parameters:
      inverted - The phase of the encoder
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • velocityConversionFactor

      public DetachedEncoderConfig velocityConversionFactor(double factor)
      Set the conversion factor for the velocity of the encoder. Velocity is returned in native units of rotations per minute and will be multiplied by this conversion factor.
      Parameters:
      factor - The conversion factor to multiply the native units by
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • averageDepth

      public DetachedEncoderConfig averageDepth(int depth)
      Set the sampling depth of the velocity calculation process of the encoder. This value sets the number of samples in the average for velocity readings. This value must be in the range [1, 64]. The default value is 64.
      Parameters:
      depth - The velocity calculation process's sampling depth
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • positionConversionFactor

      public DetachedEncoderConfig positionConversionFactor(double factor)
      Set the conversion factor for the position of the encoder. Position is returned in native units of rotations and will be multiplied by this conversion factor.
      Parameters:
      factor - The conversion factor to multiply the native units by
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • angleConversionFactor

      public DetachedEncoderConfig angleConversionFactor(double factor)
      Set the conversion factor for the angle of the encoder. Angle is returned in native units of rotations and will be multiplied by this conversion factor.
      Parameters:
      factor - The conversion factor to multiply the native units by
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • dutyCycleZeroCentered

      public DetachedEncoderConfig dutyCycleZeroCentered(boolean isZeroCentered)
      Set whether to enable zero-centering when using the absolute angle. If enabled, the position will be reported in the range (-0.5, 0.5], instead of the default range [0, 1), assuming the default units of rotations.
      Parameters:
      isZeroCentered - Whether to enable zero centering
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • dutyCycleOffset

      public DetachedEncoderConfig dutyCycleOffset(double offset)
      Set the zero offset when using the absolute angle, the position that is reported as zero.

      The zero offset is specified as the reported position of the encoder in the desired zero position as if the zero offset was set to 0, the position conversion factor was set to 1, and inverted was set to false.

      NOTE: This parameter is NOT reset when configuring with ResetMode.kResetSafeParameters.

      Parameters:
      offset - The zero offset in the range [0, 1)
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • dutyCycleStartPulseUs

      public DetachedEncoderConfig dutyCycleStartPulseUs(double startPulseUs)
      Set the length of the start pulse for this encoder. This pulse will be treated as the 0.0 position.
      Parameters:
      startPulseUs - The minimum high pulse in microseconds
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • dutyCycleEndPulseUs

      public DetachedEncoderConfig dutyCycleEndPulseUs(double endPulseUs)
      Set the length of the end pulse for this encoder. This pulse will be treated as the 1.0 position.
      Parameters:
      endPulseUs - The minimum low pulse in microseconds
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • dutyCyclePeriodUs

      public DetachedEncoderConfig dutyCyclePeriodUs(double periodUs)
      Set the expected absolute position signal period in us.
      Parameters:
      periodUs - The expected absolute position signal period
      Returns:
      The modified DetachedEncoderConfig object for method chaining
    • flatten

      public String flatten()
      Overrides:
      flatten in class BaseConfig