Class FeedbackConfigs

java.lang.Object
com.ctre.phoenix6.configs.FeedbackConfigs
All Implemented Interfaces:
ParentConfiguration, ISerializable

public class FeedbackConfigs
extends Object
implements ParentConfiguration
Configs that affect the feedback of this motor controller.

Includes feedback sensor source, any offsets for the feedback sensor, and various ratios to describe the relationship between the sensor and the mechanism for closed looping.

  • Field Details

    • FeedbackRotorOffset

      public double FeedbackRotorOffset
      This offset is applied to the absolute integrated rotor sensor. This can be used to zero the rotor in applications that are within one rotor rotation.
      • Minimum Value: -1
      • Maximum Value: 1
      • Default Value: 0.0
      • Units: rotations
    • SensorToMechanismRatio

      public double SensorToMechanismRatio
      This is the ratio of sensor rotations to the mechanism's output. This is equivalent to the mechanism's gear ratio if the sensor is located on the input of a gearbox. If sensor is on the output of a gearbox, then this is typically set to 1. Note if this is set to zero, device will reset back to one.
      • Minimum Value: -1000
      • Maximum Value: 1000
      • Default Value: 1.0
      • Units: scalar
    • RotorToSensorRatio

      public double RotorToSensorRatio
      Talon FX is capable of fusing a remote CANcoder with its rotor sensor to produce a high-bandwidth sensor source. This feature requires specifying the ratio between the remote sensor and the motor rotor. Note if this is set to zero, device will reset back to one.
      • Minimum Value: -1000
      • Maximum Value: 1000
      • Default Value: 1.0
      • Units: scalar
    • FeedbackSensorSource

      Choose what sensor source is reported via API and used by closed-loop and limit features. The default is RotorSensor, which uses the internal rotor sensor in the Talon FX.

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon FX will update its position and velocity whenever CANcoder publishes its information on CAN bus.

      Choose FusedCANcoder (requires Phoenix Pro) and Talon FX will fuse another CANcoder's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth (this also requires setting FeedbackRemoteSensorID). FusedCANcoder was developed for applications such as swerve-azimuth.

      Choose SyncCANcoder (requires Phoenix Pro) and Talon FX will synchronize its internal rotor position against another CANcoder, then continue to use the rotor sensor for closed loop control (this also requires setting FeedbackRemoteSensorID). The TalonFX will report if its internal position differs significantly from the reported CANcoder position. SyncCANcoder was developed for mechanisms where there is a risk of the CANcoder failing in such a way that it reports a position that does not match the mechanism, such as the sensor mounting assembly breaking off.

      Choose RemotePigeon2_Yaw, RemotePigeon2_Pitch, and RemotePigeon2_Roll to use another Pigeon2 on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon FX will update its position to match the selected value whenever Pigeon2 publishes its information on CAN bus. Note that the Talon FX position will be in rotations and not degrees.

      Note: When the feedback source is changed to FusedCANcoder, the Talon FX needs a period of time to fuse before sensor-based (soft-limit, closed loop, etc.) features are used. This period of time is determined by the update frequency of the CANcoder's Position signal.

    • FeedbackRemoteSensorID

      Device ID of which remote device to use. This is not used if the Sensor Source is the internal rotor sensor.
      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
  • Constructor Details

  • Method Details

    • withFeedbackRotorOffset

      public FeedbackConfigs withFeedbackRotorOffset​(double newFeedbackRotorOffset)
      Modifies this configuration's FeedbackRotorOffset parameter and returns itself for method-chaining and easier to use config API.

      This offset is applied to the absolute integrated rotor sensor. This can be used to zero the rotor in applications that are within one rotor rotation.

      • Minimum Value: -1
      • Maximum Value: 1
      • Default Value: 0.0
      • Units: rotations
      Parameters:
      newFeedbackRotorOffset - Parameter to modify
      Returns:
      Itself
    • withSensorToMechanismRatio

      public FeedbackConfigs withSensorToMechanismRatio​(double newSensorToMechanismRatio)
      Modifies this configuration's SensorToMechanismRatio parameter and returns itself for method-chaining and easier to use config API.

      This is the ratio of sensor rotations to the mechanism's output. This is equivalent to the mechanism's gear ratio if the sensor is located on the input of a gearbox. If sensor is on the output of a gearbox, then this is typically set to 1. Note if this is set to zero, device will reset back to one.

      • Minimum Value: -1000
      • Maximum Value: 1000
      • Default Value: 1.0
      • Units: scalar
      Parameters:
      newSensorToMechanismRatio - Parameter to modify
      Returns:
      Itself
    • withRotorToSensorRatio

      public FeedbackConfigs withRotorToSensorRatio​(double newRotorToSensorRatio)
      Modifies this configuration's RotorToSensorRatio parameter and returns itself for method-chaining and easier to use config API.

      Talon FX is capable of fusing a remote CANcoder with its rotor sensor to produce a high-bandwidth sensor source. This feature requires specifying the ratio between the remote sensor and the motor rotor. Note if this is set to zero, device will reset back to one.

      • Minimum Value: -1000
      • Maximum Value: 1000
      • Default Value: 1.0
      • Units: scalar
      Parameters:
      newRotorToSensorRatio - Parameter to modify
      Returns:
      Itself
    • withFeedbackSensorSource

      Modifies this configuration's FeedbackSensorSource parameter and returns itself for method-chaining and easier to use config API.

      Choose what sensor source is reported via API and used by closed-loop and limit features. The default is RotorSensor, which uses the internal rotor sensor in the Talon FX.

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon FX will update its position and velocity whenever CANcoder publishes its information on CAN bus.

      Choose FusedCANcoder (requires Phoenix Pro) and Talon FX will fuse another CANcoder's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth (this also requires setting FeedbackRemoteSensorID). FusedCANcoder was developed for applications such as swerve-azimuth.

      Choose SyncCANcoder (requires Phoenix Pro) and Talon FX will synchronize its internal rotor position against another CANcoder, then continue to use the rotor sensor for closed loop control (this also requires setting FeedbackRemoteSensorID). The TalonFX will report if its internal position differs significantly from the reported CANcoder position. SyncCANcoder was developed for mechanisms where there is a risk of the CANcoder failing in such a way that it reports a position that does not match the mechanism, such as the sensor mounting assembly breaking off.

      Choose RemotePigeon2_Yaw, RemotePigeon2_Pitch, and RemotePigeon2_Roll to use another Pigeon2 on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon FX will update its position to match the selected value whenever Pigeon2 publishes its information on CAN bus. Note that the Talon FX position will be in rotations and not degrees.

      Note: When the feedback source is changed to FusedCANcoder, the Talon FX needs a period of time to fuse before sensor-based (soft-limit, closed loop, etc.) features are used. This period of time is determined by the update frequency of the CANcoder's Position signal.

      Parameters:
      newFeedbackSensorSource - Parameter to modify
      Returns:
      Itself
    • withFeedbackRemoteSensorID

      public FeedbackConfigs withFeedbackRemoteSensorID​(int newFeedbackRemoteSensorID)
      Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.

      Device ID of which remote device to use. This is not used if the Sensor Source is the internal rotor sensor.

      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
      Parameters:
      newFeedbackRemoteSensorID - Parameter to modify
      Returns:
      Itself
    • withRemoteCANcoder

      Helper method to configure this feedback group to use RemoteCANcoder by passing in the CANcoder object. When using RemoteCANcoder, the Talon FX will use another CANcoder on the same CAN bus. Talon FX will update its position and velocity whenever CANcoder publishes its information on CAN bus.
      Parameters:
      device - CANcoder reference to use for RemoteCANcoder
      Returns:
      Itself
    • withFusedCANcoder

      Helper method to configure this feedback group to use FusedCANcoder by passing in the CANcoder object. When using FusedCANcoder (requires Phoenix Pro), the Talon FX will fuse another CANcoder's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth. FusedCANcoder was developed for applications such as swerve-azimuth.
      Parameters:
      device - CANcoder reference to use for FusedCANcoder
      Returns:
      Itself
    • withSyncCANcoder

      Helper method to configure this feedback group to use SyncCANcoder by passing in the CANcoder object. When using SyncCANcoder (requires Phoenix Pro), the Talon FX will synchronize its internal rotor position against another CANcoder, then continue to use the rotor sensor for closed loop control. The TalonFX will report if its internal position differs significantly from the reported CANcoder position. SyncCANcoder was developed for mechanisms where there is a risk of the CANcoder failing in such a way that it reports a position that does not match the mechanism, such as the sensor mounting assembly breaking off.
      Parameters:
      device - CANcoder reference to use for SyncCANcoder
      Returns:
      Itself
    • toString

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

      public StatusCode deserialize​(String to_deserialize)
      Specified by:
      deserialize in interface ParentConfiguration
    • serialize

      public String serialize()
      Specified by:
      serialize in interface ISerializable