CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
ctre::phoenix6::configs::DifferentialSensorsConfigs Class Reference

Configs related to sensors used for differential control of a mechanism. More...

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

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

Public Member Functions

constexpr DifferentialSensorsConfigs ()=default
 
constexpr DifferentialSensorsConfigsWithDifferentialSensorSource (signals::DifferentialSensorSourceValue newDifferentialSensorSource)
 Modifies this configuration's DifferentialSensorSource parameter and returns itself for method-chaining and easier to use config API.
 
constexpr DifferentialSensorsConfigsWithDifferentialTalonFXSensorID (int newDifferentialTalonFXSensorID)
 Modifies this configuration's DifferentialTalonFXSensorID parameter and returns itself for method-chaining and easier to use config API.
 
constexpr DifferentialSensorsConfigsWithDifferentialRemoteSensorID (int newDifferentialRemoteSensorID)
 Modifies this configuration's DifferentialRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.
 
constexpr DifferentialSensorsConfigsWithSensorToDifferentialRatio (units::dimensionless::scalar_t newSensorToDifferentialRatio)
 Modifies this configuration's SensorToDifferentialRatio parameter and returns itself for method-chaining and easier to use config API.
 
std::string ToString () const override
 
std::string Serialize () const final
 
ctre::phoenix::StatusCode Deserialize (std::string const &to_deserialize) final
 
- Public Member Functions inherited from ctre::phoenix6::configs::ParentConfiguration
- Public Member Functions inherited from ctre::phoenix6::ISerializable

Public Attributes

signals::DifferentialSensorSourceValue DifferentialSensorSource = signals::DifferentialSensorSourceValue::Disabled
 Choose what sensor source is used for differential control of a mechanism.
 
int DifferentialTalonFXSensorID = 0
 Device ID of which remote Talon FX to use.
 
int DifferentialRemoteSensorID = 0
 Device ID of which remote sensor to use on the differential axis.
 
units::dimensionless::scalar_t SensorToDifferentialRatio = 1.0
 The ratio of sensor rotations to the differential mechanism's difference output, where a ratio greater than 1 is a reduction.
 

Detailed Description

Configs related to sensors used for differential control of a mechanism.

Includes the differential sensor sources and IDs.

Constructor & Destructor Documentation

◆ DifferentialSensorsConfigs()

ctre::phoenix6::configs::DifferentialSensorsConfigs::DifferentialSensorsConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

ctre::phoenix::StatusCode ctre::phoenix6::configs::DifferentialSensorsConfigs::Deserialize ( std::string const & to_deserialize)
finalvirtual

◆ Serialize()

std::string ctre::phoenix6::configs::DifferentialSensorsConfigs::Serialize ( ) const
finalvirtual

◆ ToString()

std::string ctre::phoenix6::configs::DifferentialSensorsConfigs::ToString ( ) const
overridevirtual

◆ WithDifferentialRemoteSensorID()

DifferentialSensorsConfigs & ctre::phoenix6::configs::DifferentialSensorsConfigs::WithDifferentialRemoteSensorID ( int newDifferentialRemoteSensorID)
inlineconstexpr

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

Device ID of which remote sensor to use on the differential axis. This is used when the Differential Sensor Source is not Disabled or RemoteTalonFX_HalfDiff.

  • Minimum Value: 0
  • Maximum Value: 62
  • Default Value: 0
  • Units:
Parameters
newDifferentialRemoteSensorIDParameter to modify
Returns
Itself

◆ WithDifferentialSensorSource()

DifferentialSensorsConfigs & ctre::phoenix6::configs::DifferentialSensorsConfigs::WithDifferentialSensorSource ( signals::DifferentialSensorSourceValue newDifferentialSensorSource)
inlineconstexpr

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

Choose what sensor source is used for differential control of a mechanism. The default is Disabled. All other options require setting the DifferentialTalonFXSensorID, as the average of this Talon FX's sensor and the remote TalonFX's sensor is used for the differential controller's primary targets.

Choose RemoteTalonFX_HalfDiff to use another TalonFX on the same CAN bus. Talon FX will update its differential position and velocity whenever the remote TalonFX publishes its information on CAN bus. The differential controller will use half of the difference between this TalonFX's sensor and the remote Talon FX's sensor for the differential component of the output.

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

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

Parameters
newDifferentialSensorSourceParameter to modify
Returns
Itself

◆ WithDifferentialTalonFXSensorID()

DifferentialSensorsConfigs & ctre::phoenix6::configs::DifferentialSensorsConfigs::WithDifferentialTalonFXSensorID ( int newDifferentialTalonFXSensorID)
inlineconstexpr

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

Device ID of which remote Talon FX to use. This is used whenever the Differential Sensor Source is not disabled.

The differential Talon FX must enable its Position and Velocity status signals. The update rate of the status signals determines the update rate of differential control.

  • Minimum Value: 0
  • Maximum Value: 62
  • Default Value: 0
  • Units:
Parameters
newDifferentialTalonFXSensorIDParameter to modify
Returns
Itself

◆ WithSensorToDifferentialRatio()

DifferentialSensorsConfigs & ctre::phoenix6::configs::DifferentialSensorsConfigs::WithSensorToDifferentialRatio ( units::dimensionless::scalar_t newSensorToDifferentialRatio)
inlineconstexpr

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

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

When using RemoteTalonFX_HalfDiff, the sensor is considered half of the difference between the two devices' mechanism positions/velocities. As a result, this should be set to the gear ratio on the difference axis when using RemoteTalonFX_HalfDiff, or any gear ratio between the sensor and the mechanism differential when using another sensor source.

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

Member Data Documentation

◆ DifferentialRemoteSensorID

int ctre::phoenix6::configs::DifferentialSensorsConfigs::DifferentialRemoteSensorID = 0

Device ID of which remote sensor to use on the differential axis.

This is used when the Differential Sensor Source is not Disabled or RemoteTalonFX_HalfDiff.

  • Minimum Value: 0
  • Maximum Value: 62
  • Default Value: 0
  • Units:

◆ DifferentialSensorSource

signals::DifferentialSensorSourceValue ctre::phoenix6::configs::DifferentialSensorsConfigs::DifferentialSensorSource = signals::DifferentialSensorSourceValue::Disabled

Choose what sensor source is used for differential control of a mechanism.

The default is Disabled. All other options require setting the DifferentialTalonFXSensorID, as the average of this Talon FX's sensor and the remote TalonFX's sensor is used for the differential controller's primary targets.

Choose RemoteTalonFX_HalfDiff to use another TalonFX on the same CAN bus. Talon FX will update its differential position and velocity whenever the remote TalonFX publishes its information on CAN bus. The differential controller will use half of the difference between this TalonFX's sensor and the remote Talon FX's sensor for the differential component of the output.

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

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

◆ DifferentialTalonFXSensorID

int ctre::phoenix6::configs::DifferentialSensorsConfigs::DifferentialTalonFXSensorID = 0

Device ID of which remote Talon FX to use.

This is used whenever the Differential Sensor Source is not disabled.

The differential Talon FX must enable its Position and Velocity status signals. The update rate of the status signals determines the update rate of differential control.

  • Minimum Value: 0
  • Maximum Value: 62
  • Default Value: 0
  • Units:

◆ SensorToDifferentialRatio

units::dimensionless::scalar_t ctre::phoenix6::configs::DifferentialSensorsConfigs::SensorToDifferentialRatio = 1.0

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

When using RemoteTalonFX_HalfDiff, the sensor is considered half of the difference between the two devices' mechanism positions/velocities. As a result, this should be set to the gear ratio on the difference axis when using RemoteTalonFX_HalfDiff, or any gear ratio between the sensor and the mechanism differential when using another sensor source.

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

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