Class QuadratureConfigs

java.lang.Object
com.ctre.phoenix6.configs.QuadratureConfigs
All Implemented Interfaces:
ParentConfiguration, Cloneable

public class QuadratureConfigs extends Object implements ParentConfiguration, Cloneable
Configs related to the CANdi™ branded device's quadrature interface using both the S1IN and S2IN inputs

All the configs related to the quadrature interface for the CANdi™ branded device , including encoder edges per revolution and sensor direction.

  • Field Details

    • QuadratureEdgesPerRotation

      public int QuadratureEdgesPerRotation
      The number of quadrature edges in one rotation for the quadrature sensor connected to the Talon data port.

      This is the total number of transitions from high-to-low or low-to-high across both channels per rotation of the sensor. This is also equivalent to the Counts Per Revolution when using 4x decoding.

      For example, the SRX Mag Encoder has 4096 edges per rotation, and a US Digital 1024 CPR (Cycles Per Revolution) quadrature encoder has 4096 edges per rotation.

      On the Talon FXS, this can be at most 2,000,000,000 / Peak RPM.

      • Minimum Value: 1
      • Maximum Value: 1000000
      • Default Value: 4096
      • Units:
    • SensorDirection

      public boolean SensorDirection
      Direction of the quadrature sensor to determine positive rotation. Invert this so that forward motion on the mechanism results in an increase in quadrature position.
      • Default Value: False
  • Constructor Details

    • QuadratureConfigs

      public QuadratureConfigs()
  • Method Details

    • withQuadratureEdgesPerRotation

      public final QuadratureConfigs withQuadratureEdgesPerRotation(int newQuadratureEdgesPerRotation)
      Modifies this configuration's QuadratureEdgesPerRotation parameter and returns itself for method-chaining and easier to use config API.

      The number of quadrature edges in one rotation for the quadrature sensor connected to the Talon data port.

      This is the total number of transitions from high-to-low or low-to-high across both channels per rotation of the sensor. This is also equivalent to the Counts Per Revolution when using 4x decoding.

      For example, the SRX Mag Encoder has 4096 edges per rotation, and a US Digital 1024 CPR (Cycles Per Revolution) quadrature encoder has 4096 edges per rotation.

      On the Talon FXS, this can be at most 2,000,000,000 / Peak RPM.

      • Minimum Value: 1
      • Maximum Value: 1000000
      • Default Value: 4096
      • Units:
      Parameters:
      newQuadratureEdgesPerRotation - Parameter to modify
      Returns:
      Itself
    • withSensorDirection

      public final QuadratureConfigs withSensorDirection(boolean newSensorDirection)
      Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API.

      Direction of the quadrature sensor to determine positive rotation. Invert this so that forward motion on the mechanism results in an increase in quadrature position.

      • Default Value: False
      Parameters:
      newSensorDirection - Parameter to modify
      Returns:
      Itself
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • serialize

      public final String serialize()
      Get the serialized form of this configuration group.
      Specified by:
      serialize in interface ParentConfiguration
      Returns:
      Serialized form of this config group
    • deserialize

      public final StatusCode deserialize(String to_deserialize)
      Take a string and deserialize it to this configuration group.
      Specified by:
      deserialize in interface ParentConfiguration
      Parameters:
      to_deserialize - The serialized configuration
      Returns:
      Return code of the deserialize method
    • clone

      public QuadratureConfigs clone()
      Overrides:
      clone in class Object