CTRE Phoenix 6 C++ 25.3.0
Loading...
Searching...
No Matches
ctre::phoenix6::configs::ExternalFeedbackConfigs Class Reference

Configs that affect the external feedback sensor of this motor controller. More...

#include <ctre/phoenix6/configs/Configs.hpp>

Inheritance diagram for ctre::phoenix6::configs::ExternalFeedbackConfigs:
ctre::phoenix6::configs::ParentConfiguration ctre::phoenix6::ISerializable

Public Member Functions

constexpr ExternalFeedbackConfigs ()=default
 
constexpr ExternalFeedbackConfigsWithSensorToMechanismRatio (units::dimensionless::scalar_t newSensorToMechanismRatio)
 Modifies this configuration's SensorToMechanismRatio parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithRotorToSensorRatio (units::dimensionless::scalar_t newRotorToSensorRatio)
 Modifies this configuration's RotorToSensorRatio parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithFeedbackRemoteSensorID (int newFeedbackRemoteSensorID)
 Modifies this configuration's FeedbackRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithVelocityFilterTimeConstant (units::time::second_t newVelocityFilterTimeConstant)
 Modifies this configuration's VelocityFilterTimeConstant parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithAbsoluteSensorOffset (units::angle::turn_t newAbsoluteSensorOffset)
 Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithExternalFeedbackSensorSource (signals::ExternalFeedbackSensorSourceValue newExternalFeedbackSensorSource)
 Modifies this configuration's ExternalFeedbackSensorSource parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithSensorPhase (signals::SensorPhaseValue newSensorPhase)
 Modifies this configuration's SensorPhase parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithQuadratureEdgesPerRotation (int newQuadratureEdgesPerRotation)
 Modifies this configuration's QuadratureEdgesPerRotation parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ExternalFeedbackConfigsWithAbsoluteSensorDiscontinuityPoint (units::angle::turn_t newAbsoluteSensorDiscontinuityPoint)
 Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.
 
ExternalFeedbackConfigsWithRemoteCANcoder (const hardware::core::CoreCANcoder &device)
 Helper method to configure this feedback group to use RemoteCANcoder by passing in the CANcoder object.
 
ExternalFeedbackConfigsWithFusedCANcoder (const hardware::core::CoreCANcoder &device)
 Helper method to configure this feedback group to use FusedCANcoder by passing in the CANcoder object.
 
ExternalFeedbackConfigsWithSyncCANcoder (const hardware::core::CoreCANcoder &device)
 Helper method to configure this feedback group to use SyncCANcoder by passing in the CANcoder object.
 
ExternalFeedbackConfigsWithRemoteCANdiPwm1 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Remote CANdi PWM 1 by passing in the CANdi object.
 
ExternalFeedbackConfigsWithRemoteCANdiPwm2 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Remote CANdi PWM 2 by passing in the CANdi object.
 
ExternalFeedbackConfigsWithRemoteCANdiQuadrature (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Remote CANdi Quadrature by passing in the CANdi object.
 
ExternalFeedbackConfigsWithFusedCANdiPwm1 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Fused CANdi PWM 1 by passing in the CANdi object.
 
ExternalFeedbackConfigsWithFusedCANdiPwm2 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Fused CANdi PWM 2 by passing in the CANdi object.
 
ExternalFeedbackConfigsWithFusedCANdiQuadrature (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Fused CANdi Quadrature by passing in the CANdi object.
 
ExternalFeedbackConfigsWithSyncCANdiPwm1 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Sync CANdi PWM 1 by passing in the CANdi object.
 
ExternalFeedbackConfigsWithSyncCANdiPwm2 (const hardware::core::CoreCANdi &device)
 Helper method to configure this feedback group to use Sync CANdi PWM 2 by passing in the CANdi object.
 
std::string ToString () const override
 
std::string Serialize () const override
 
ctre::phoenix::StatusCode Deserialize (const std::string &to_deserialize) override
 
- Public Member Functions inherited from ctre::phoenix6::configs::ParentConfiguration
- Public Member Functions inherited from ctre::phoenix6::ISerializable

Public Attributes

units::dimensionless::scalar_t SensorToMechanismRatio = 1.0
 The ratio of sensor rotations to the mechanism's output, where a ratio greater than 1 is a reduction.
 
units::dimensionless::scalar_t RotorToSensorRatio = 1.0
 The ratio of motor rotor rotations to remote sensor rotations, where a ratio greater than 1 is a reduction.
 
int FeedbackRemoteSensorID = 0
 Device ID of which remote device to use.
 
units::time::second_t VelocityFilterTimeConstant = 0_s
 The configurable time constant of the Kalman velocity filter.
 
units::angle::turn_t AbsoluteSensorOffset = 0.0_tr
 The offset applied to any absolute sensor connected to the Talon data port.
 
signals::ExternalFeedbackSensorSourceValue ExternalFeedbackSensorSource = signals::ExternalFeedbackSensorSourceValue::Commutation
 Choose what sensor source is reported via API and used by closed-loop and limit features.
 
signals::SensorPhaseValue SensorPhase = signals::SensorPhaseValue::Aligned
 The relationship between the motor controlled by a Talon and the external sensor connected to the data port.
 
int QuadratureEdgesPerRotation = 4096
 The number of quadrature edges in one rotation for the quadrature sensor connected to the Talon data port.
 
units::angle::turn_t AbsoluteSensorDiscontinuityPoint = 0.5_tr
 The positive discontinuity point of the absolute sensor in rotations.
 

Detailed Description

Configs that affect the external feedback sensor of this motor controller.

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

Constructor & Destructor Documentation

◆ ExternalFeedbackConfigs()

ctre::phoenix6::configs::ExternalFeedbackConfigs::ExternalFeedbackConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

ctre::phoenix::StatusCode ctre::phoenix6::configs::ExternalFeedbackConfigs::Deserialize ( const std::string & to_deserialize)
inlineoverridevirtual

◆ Serialize()

std::string ctre::phoenix6::configs::ExternalFeedbackConfigs::Serialize ( ) const
inlineoverridevirtual

◆ ToString()

std::string ctre::phoenix6::configs::ExternalFeedbackConfigs::ToString ( ) const
inlineoverridevirtual

◆ WithAbsoluteSensorDiscontinuityPoint()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithAbsoluteSensorDiscontinuityPoint ( units::angle::turn_t newAbsoluteSensorDiscontinuityPoint)
inlineconstexpr

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

The positive discontinuity point of the absolute sensor in rotations. This determines the point at which the absolute sensor wraps around, keeping the absolute position in the range [x-1, x).

  • Setting this to 1 makes the absolute position unsigned [0, 1)
  • Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
  • Setting this to 0 makes the absolute position always negative [-1, 0)

Many rotational mechanisms such as arms have a region of motion that is unreachable. This should be set to the center of that region of motion, in non-negative rotations. This affects the position of the device at bootup.

For example, consider an arm which can travel from -0.2 to 0.6 rotations with a little leeway, where 0 is horizontally forward. Since -0.2 rotations has the same absolute position as 0.8 rotations, we can say that the arm typically does not travel in the range (0.6, 0.8) rotations. As a result, the discontinuity point would be the center of that range, which is 0.7 rotations. This results in an absolute sensor range of [-0.3, 0.7) rotations.

On a Talon motor controller, this is only supported when using the PulseWidth sensor source.

  • Minimum Value: 0.0
  • Maximum Value: 1.0
  • Default Value: 0.5
  • Units: rotations
Parameters
newAbsoluteSensorDiscontinuityPointParameter to modify
Returns
Itself

◆ WithAbsoluteSensorOffset()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithAbsoluteSensorOffset ( units::angle::turn_t newAbsoluteSensorOffset)
inlineconstexpr

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

The offset applied to any absolute sensor connected to the Talon data port. This is only supported when using the PulseWidth sensor source.

This can be used to zero the sensor position in applications where the sensor is 1:1 with the mechanism.

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

◆ WithExternalFeedbackSensorSource()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithExternalFeedbackSensorSource ( signals::ExternalFeedbackSensorSourceValue newExternalFeedbackSensorSource)
inlineconstexpr

Modifies this configuration's ExternalFeedbackSensorSource 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 Commutation, which uses the external sensor used for motor commutation.

Choose Remote* to use another sensor on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon will update its position and velocity whenever the remote sensor publishes its information on CAN bus, and the Talon commutation sensor will not be used.

Choose Fused* (requires Phoenix Pro) and Talon will fuse another sensor's information with the commutation sensor, which provides the best possible position and velocity for accuracy and bandwidth (this also requires setting FeedbackRemoteSensorID). This was developed for applications such as swerve-azimuth.

Choose Sync* (requires Phoenix Pro) and Talon will synchronize its commutation sensor position against another sensor, then continue to use the rotor sensor for closed loop control (this also requires setting FeedbackRemoteSensorID). The Talon will report if its internal position differs significantly from the reported remote sensor position. This was developed for mechanisms where there is a risk of the sensor 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 will update its position to match the selected value whenever Pigeon2 publishes its information on CAN bus. Note that the Talon position will be in rotations and not degrees.

Choose Quadrature to use a quadrature encoder directly attached to the Talon data port. This provides velocity and relative position measurements.

Choose PulseWidth to use a pulse-width encoder directly attached to the Talon data port. This provides velocity and absolute position measurements.

Note: When the feedback source is changed to Fused* or Sync*, the Talon 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 remote sensor's Position signal.

Parameters
newExternalFeedbackSensorSourceParameter to modify
Returns
Itself

◆ WithFeedbackRemoteSensorID()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithFeedbackRemoteSensorID ( int newFeedbackRemoteSensorID)
inlineconstexpr

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
newFeedbackRemoteSensorIDParameter to modify
Returns
Itself

◆ WithFusedCANcoder()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithFusedCANcoder ( const hardware::core::CoreCANcoder & device)

Helper method to configure this feedback group to use FusedCANcoder by passing in the CANcoder object.

When using FusedCANcoder (requires Phoenix Pro), the Talon will fuse another CANcoder's information with the commutation sensor, which provides the best possible position and velocity for accuracy and bandwidth. FusedCANcoder was developed for applications such as swerve-azimuth.

Parameters
deviceCANcoder reference to use for FusedCANcoder
Returns
Itself

◆ WithFusedCANdiPwm1()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithFusedCANdiPwm1 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Fused CANdi PWM 1 by passing in the CANdi object.

When using FusedCANdi (requires Phoenix Pro), the Talon will fuse another CANdi's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth.

Parameters
deviceCANdi reference to use for Fused CANdi
Returns
Itself

◆ WithFusedCANdiPwm2()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithFusedCANdiPwm2 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Fused CANdi PWM 2 by passing in the CANdi object.

When using FusedCANdi (requires Phoenix Pro), the Talon will fuse another CANdi's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth.

Parameters
deviceCANdi reference to use for Fused CANdi
Returns
Itself

◆ WithFusedCANdiQuadrature()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithFusedCANdiQuadrature ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Fused CANdi Quadrature by passing in the CANdi object.

When using FusedCANdi (requires Phoenix Pro), the Talon will fuse another CANdi's information with the internal rotor, which provides the best possible position and velocity for accuracy and bandwidth.

Parameters
deviceCANdi reference to use for Fused CANdi
Returns
Itself

◆ WithQuadratureEdgesPerRotation()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithQuadratureEdgesPerRotation ( int newQuadratureEdgesPerRotation)
inlineconstexpr

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
newQuadratureEdgesPerRotationParameter to modify
Returns
Itself

◆ WithRemoteCANcoder()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithRemoteCANcoder ( const hardware::core::CoreCANcoder & device)

Helper method to configure this feedback group to use RemoteCANcoder by passing in the CANcoder object.

When using RemoteCANcoder, the Talon will use another CANcoder on the same CAN bus. The Talon will update its position and velocity whenever CANcoder publishes its information on CAN bus, and the Talon commutation sensor will not be used.

Parameters
deviceCANcoder reference to use for RemoteCANcoder
Returns
Itself

◆ WithRemoteCANdiPwm1()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithRemoteCANdiPwm1 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Remote CANdi PWM 1 by passing in the CANdi object.

Parameters
deviceCANdi reference to use for Remote CANdi
Returns
Itself

◆ WithRemoteCANdiPwm2()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithRemoteCANdiPwm2 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Remote CANdi PWM 2 by passing in the CANdi object.

Parameters
deviceCANdi reference to use for Remote CANdi
Returns
Itself

◆ WithRemoteCANdiQuadrature()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithRemoteCANdiQuadrature ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Remote CANdi Quadrature by passing in the CANdi object.

Parameters
deviceCANdi reference to use for Remote CANdi
Returns
Itself

◆ WithRotorToSensorRatio()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithRotorToSensorRatio ( units::dimensionless::scalar_t newRotorToSensorRatio)
inlineconstexpr

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

The ratio of motor rotor rotations to remote sensor rotations, where a ratio greater than 1 is a reduction.

The 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 motor rotor and the remote sensor.

If this is set to zero, the device will reset back to one.

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

◆ WithSensorPhase()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithSensorPhase ( signals::SensorPhaseValue newSensorPhase)
inlineconstexpr

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

The relationship between the motor controlled by a Talon and the external sensor connected to the data port. This does not affect the commutation sensor or remote sensors.

To determine the sensor phase, set this config to Aligned and drive the motor with positive output. If the reported sensor velocity is positive, then the phase is Aligned. If the reported sensor velocity is negative, then the phase is Opposed.

The sensor direction is automatically inverted along with motor invert, so the sensor phase does not need to be changed when motor invert changes.

Parameters
newSensorPhaseParameter to modify
Returns
Itself

◆ WithSensorToMechanismRatio()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithSensorToMechanismRatio ( units::dimensionless::scalar_t newSensorToMechanismRatio)
inlineconstexpr

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

The ratio of sensor rotations to the mechanism's output, where a ratio greater than 1 is a reduction.

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.

We recommend against using this config to perform onboard unit conversions. Instead, unit conversions should be performed in robot code using the units library.

If this is set to zero, the device will reset back to one.

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

◆ WithSyncCANcoder()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithSyncCANcoder ( const hardware::core::CoreCANcoder & device)

Helper method to configure this feedback group to use SyncCANcoder by passing in the CANcoder object.

When using SyncCANcoder (requires Phoenix Pro), the Talon will synchronize its commutation sensor position against another CANcoder, then continue to use the rotor sensor for closed loop control. The Talon 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
deviceCANcoder reference to use for SyncCANcoder
Returns
Itself

◆ WithSyncCANdiPwm1()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithSyncCANdiPwm1 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Sync CANdi PWM 1 by passing in the CANdi object.

When using SyncCANdi (requires Phoenix Pro), the Talon will synchronize its internal rotor position against another CANdi, then continue to use the rotor sensor for closed loop control. The Talon will report if its internal position differs significantly from the reported CANdi position. SyncCANdi was developed for mechanisms where there is a risk of the CANdi 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
deviceCANdi reference to use for Sync CANdi
Returns
Itself

◆ WithSyncCANdiPwm2()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithSyncCANdiPwm2 ( const hardware::core::CoreCANdi & device)

Helper method to configure this feedback group to use Sync CANdi PWM 2 by passing in the CANdi object.

When using SyncCANdi (requires Phoenix Pro), the Talon will synchronize its internal rotor position against another CANdi, then continue to use the rotor sensor for closed loop control. The Talon will report if its internal position differs significantly from the reported CANdi position. SyncCANdi was developed for mechanisms where there is a risk of the CANdi 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
deviceCANdi reference to use for Sync CANdi
Returns
Itself

◆ WithVelocityFilterTimeConstant()

ExternalFeedbackConfigs & ctre::phoenix6::configs::ExternalFeedbackConfigs::WithVelocityFilterTimeConstant ( units::time::second_t newVelocityFilterTimeConstant)
inlineconstexpr

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

The configurable time constant of the Kalman velocity filter. The velocity Kalman filter will adjust to act as a low-pass with this value as its time constant.

If the user is aiming for an expected cutoff frequency, the frequency is calculated as 1 / (2 * π * τ) with τ being the time constant.

  • Minimum Value: 0
  • Maximum Value: 1
  • Default Value: 0
  • Units: seconds
Parameters
newVelocityFilterTimeConstantParameter to modify
Returns
Itself

Member Data Documentation

◆ AbsoluteSensorDiscontinuityPoint

units::angle::turn_t ctre::phoenix6::configs::ExternalFeedbackConfigs::AbsoluteSensorDiscontinuityPoint = 0.5_tr

The positive discontinuity point of the absolute sensor in rotations.

This determines the point at which the absolute sensor wraps around, keeping the absolute position in the range [x-1, x).

  • Setting this to 1 makes the absolute position unsigned [0, 1)
  • Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
  • Setting this to 0 makes the absolute position always negative [-1, 0)

Many rotational mechanisms such as arms have a region of motion that is unreachable. This should be set to the center of that region of motion, in non-negative rotations. This affects the position of the device at bootup.

For example, consider an arm which can travel from -0.2 to 0.6 rotations with a little leeway, where 0 is horizontally forward. Since -0.2 rotations has the same absolute position as 0.8 rotations, we can say that the arm typically does not travel in the range (0.6, 0.8) rotations. As a result, the discontinuity point would be the center of that range, which is 0.7 rotations. This results in an absolute sensor range of [-0.3, 0.7) rotations.

On a Talon motor controller, this is only supported when using the PulseWidth sensor source.

  • Minimum Value: 0.0
  • Maximum Value: 1.0
  • Default Value: 0.5
  • Units: rotations

◆ AbsoluteSensorOffset

units::angle::turn_t ctre::phoenix6::configs::ExternalFeedbackConfigs::AbsoluteSensorOffset = 0.0_tr

The offset applied to any absolute sensor connected to the Talon data port.

This is only supported when using the PulseWidth sensor source.

This can be used to zero the sensor position in applications where the sensor is 1:1 with the mechanism.

  • Minimum Value: -1
  • Maximum Value: 1
  • Default Value: 0.0
  • Units: rotations

◆ ExternalFeedbackSensorSource

signals::ExternalFeedbackSensorSourceValue ctre::phoenix6::configs::ExternalFeedbackConfigs::ExternalFeedbackSensorSource = signals::ExternalFeedbackSensorSourceValue::Commutation

Choose what sensor source is reported via API and used by closed-loop and limit features.

The default is Commutation, which uses the external sensor used for motor commutation.

Choose Remote* to use another sensor on the same CAN bus (this also requires setting FeedbackRemoteSensorID). Talon will update its position and velocity whenever the remote sensor publishes its information on CAN bus, and the Talon commutation sensor will not be used.

Choose Fused* (requires Phoenix Pro) and Talon will fuse another sensor's information with the commutation sensor, which provides the best possible position and velocity for accuracy and bandwidth (this also requires setting FeedbackRemoteSensorID). This was developed for applications such as swerve-azimuth.

Choose Sync* (requires Phoenix Pro) and Talon will synchronize its commutation sensor position against another sensor, then continue to use the rotor sensor for closed loop control (this also requires setting FeedbackRemoteSensorID). The Talon will report if its internal position differs significantly from the reported remote sensor position. This was developed for mechanisms where there is a risk of the sensor 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 will update its position to match the selected value whenever Pigeon2 publishes its information on CAN bus. Note that the Talon position will be in rotations and not degrees.

Choose Quadrature to use a quadrature encoder directly attached to the Talon data port. This provides velocity and relative position measurements.

Choose PulseWidth to use a pulse-width encoder directly attached to the Talon data port. This provides velocity and absolute position measurements.

Note: When the feedback source is changed to Fused* or Sync*, the Talon 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 remote sensor's Position signal.

◆ FeedbackRemoteSensorID

int ctre::phoenix6::configs::ExternalFeedbackConfigs::FeedbackRemoteSensorID = 0

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:

◆ QuadratureEdgesPerRotation

int ctre::phoenix6::configs::ExternalFeedbackConfigs::QuadratureEdgesPerRotation = 4096

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:

◆ RotorToSensorRatio

units::dimensionless::scalar_t ctre::phoenix6::configs::ExternalFeedbackConfigs::RotorToSensorRatio = 1.0

The ratio of motor rotor rotations to remote sensor rotations, where a ratio greater than 1 is a reduction.

The 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 motor rotor and the remote sensor.

If this is set to zero, the device will reset back to one.

  • Minimum Value: -1000
  • Maximum Value: 1000
  • Default Value: 1.0
  • Units: scalar

◆ SensorPhase

signals::SensorPhaseValue ctre::phoenix6::configs::ExternalFeedbackConfigs::SensorPhase = signals::SensorPhaseValue::Aligned

The relationship between the motor controlled by a Talon and the external sensor connected to the data port.

This does not affect the commutation sensor or remote sensors.

To determine the sensor phase, set this config to Aligned and drive the motor with positive output. If the reported sensor velocity is positive, then the phase is Aligned. If the reported sensor velocity is negative, then the phase is Opposed.

The sensor direction is automatically inverted along with motor invert, so the sensor phase does not need to be changed when motor invert changes.

◆ SensorToMechanismRatio

units::dimensionless::scalar_t ctre::phoenix6::configs::ExternalFeedbackConfigs::SensorToMechanismRatio = 1.0

The ratio of sensor rotations to the mechanism's output, where a ratio greater than 1 is a reduction.

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.

We recommend against using this config to perform onboard unit conversions. Instead, unit conversions should be performed in robot code using the units library.

If this is set to zero, the device will reset back to one.

  • Minimum Value: -1000
  • Maximum Value: 1000
  • Default Value: 1.0
  • Units: scalar

◆ VelocityFilterTimeConstant

units::time::second_t ctre::phoenix6::configs::ExternalFeedbackConfigs::VelocityFilterTimeConstant = 0_s

The configurable time constant of the Kalman velocity filter.

The velocity Kalman filter will adjust to act as a low-pass with this value as its time constant.

If the user is aiming for an expected cutoff frequency, the frequency is calculated as 1 / (2 * π * τ) with τ being the time constant.

  • Minimum Value: 0
  • Maximum Value: 1
  • Default Value: 0
  • Units: seconds

The documentation for this class was generated from the following file: