CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT > Struct Template Referencefinal

All constants for setting up the motors of a differential mechanism. More...

#include <ctre/phoenix6/mechanisms/DifferentialConstants.hpp>

Public Member Functions

constexpr DifferentialMotorConstants ()=default
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithCANBusName (std::string_view newCANBusName)
 Modifies the CANBusName parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithLeaderId (int newLeaderId)
 Modifies the LeaderId parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithFollowerId (int newFollowerId)
 Modifies the FollowerId parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithAlignment (signals::MotorAlignmentValue newAlignment)
 Modifies the Alignment parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithSensorToDifferentialRatio (units::dimensionless::scalar_t newSensorToDifferentialRatio)
 Modifies the SensorToDifferentialRatio parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithClosedLoopRate (units::frequency::hertz_t newClosedLoopRate)
 Modifies the ClosedLoopRate parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithLeaderInitialConfigs (const MotorConfigsT &newLeaderInitialConfigs)
 Modifies the LeaderInitialConfigs parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithFollowerInitialConfigs (const MotorConfigsT &newFollowerInitialConfigs)
 Modifies the FollowerInitialConfigs parameter and returns itself.
 
constexpr DifferentialMotorConstants< MotorConfigsT > & WithFollowerUsesCommonLeaderConfigs (bool newFollowerUsesCommonLeaderConfigs)
 Modifies the FollowerUsesCommonLeaderConfigs parameter and returns itself.
 

Public Attributes

std::string_view CANBusName = ""
 Name of the CAN bus the mechanism is on.
 
int LeaderId = 0
 CAN ID of the leader motor in the differential mechanism.
 
int FollowerId = 0
 CAN ID of the follower motor in the differential mechanism.
 
signals::MotorAlignmentValue Alignment = signals::MotorAlignmentValue::Aligned
 The alignment of the differential leader and follower motors, ignoring the configured inverts.
 
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.
 
units::frequency::hertz_t ClosedLoopRate = 100_Hz
 The update rate of the closed-loop controllers.
 
MotorConfigsT LeaderInitialConfigs = {}
 The initial configs used to configure the differential leader.
 
MotorConfigsT FollowerInitialConfigs = {}
 The initial configs used to configure the differential follower.
 
bool FollowerUsesCommonLeaderConfigs = true
 Whether the follower should overwrite some of its initial configs with common configs from the LeaderInitialConfigs, such as current limits.
 

Detailed Description

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
struct ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >

All constants for setting up the motors of a differential mechanism.

Constructor & Destructor Documentation

◆ DifferentialMotorConstants()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::DifferentialMotorConstants ( )
constexprdefault

Member Function Documentation

◆ WithAlignment()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithAlignment ( signals::MotorAlignmentValue newAlignment)
inlineconstexpr

Modifies the Alignment parameter and returns itself.

The alignment of the differential leader and follower motors, ignoring the configured inverts.

Parameters
newAlignmentParameter to modify
Returns
this object

◆ WithCANBusName()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithCANBusName ( std::string_view newCANBusName)
inlineconstexpr

Modifies the CANBusName parameter and returns itself.

Name of the CAN bus the mechanism is on. Possible CAN bus strings are:

  • "rio" for the native roboRIO CAN bus
  • CANivore name or serial number
  • SocketCAN interface (non-FRC Linux only)
  • "*" for any CANivore seen by the program
  • empty string (default) to select the default for the system:
    • "rio" on roboRIO
    • "can0" on Linux
    • "*" on Windows

Note that all devices must be on the same CAN bus.

Parameters
newCANBusNameParameter to modify
Returns
this object

◆ WithClosedLoopRate()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithClosedLoopRate ( units::frequency::hertz_t newClosedLoopRate)
inlineconstexpr

Modifies the ClosedLoopRate parameter and returns itself.

The update rate of the closed-loop controllers. This determines the update rate of the differential leader's DifferentialOutput status signal, the follower's Position and Velocity signals, and the relevant signals for any other selected differential sensor.

Parameters
newClosedLoopRateParameter to modify
Returns
this object

◆ WithFollowerId()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithFollowerId ( int newFollowerId)
inlineconstexpr

Modifies the FollowerId parameter and returns itself.

CAN ID of the follower motor in the differential mechanism. The follower will have the differential output subtracted from its regular output.

Parameters
newFollowerIdParameter to modify
Returns
this object

◆ WithFollowerInitialConfigs()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithFollowerInitialConfigs ( const MotorConfigsT & newFollowerInitialConfigs)
inlineconstexpr

Modifies the FollowerInitialConfigs parameter and returns itself.

The initial configs used to configure the differential follower. The default value is the factory-default.

Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

The list of configs that will be overwritten is as follows:

If FollowerUsesCommonLeaderConfigs is set to true (default), the following configs are copied from LeaderInitialConfigs:

Parameters
newFollowerInitialConfigsParameter to modify
Returns
this object

◆ WithFollowerUsesCommonLeaderConfigs()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithFollowerUsesCommonLeaderConfigs ( bool newFollowerUsesCommonLeaderConfigs)
inlineconstexpr

Modifies the FollowerUsesCommonLeaderConfigs parameter and returns itself.

Whether the follower should overwrite some of its initial configs with common configs from the LeaderInitialConfigs, such as current limits. The list of configs that are copied is documented in FollowerInitialConfigs.

Parameters
newFollowerUsesCommonLeaderConfigsParameter to modify
Returns
this object

◆ WithLeaderId()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithLeaderId ( int newLeaderId)
inlineconstexpr

Modifies the LeaderId parameter and returns itself.

CAN ID of the leader motor in the differential mechanism. The leader will have the differential output added to its regular output.

Parameters
newLeaderIdParameter to modify
Returns
this object

◆ WithLeaderInitialConfigs()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithLeaderInitialConfigs ( const MotorConfigsT & newLeaderInitialConfigs)
inlineconstexpr

Modifies the LeaderInitialConfigs parameter and returns itself.

The initial configs used to configure the differential leader. The default value is the factory-default.

Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

The list of configs that will be overwritten is as follows:

Parameters
newLeaderInitialConfigsParameter to modify
Returns
this object

◆ WithSensorToDifferentialRatio()

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
DifferentialMotorConstants< MotorConfigsT > & ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::WithSensorToDifferentialRatio ( units::dimensionless::scalar_t newSensorToDifferentialRatio)
inlineconstexpr

Modifies the SensorToDifferentialRatio parameter and returns itself.

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

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

Parameters
newSensorToDifferentialRatioParameter to modify
Returns
this object

Member Data Documentation

◆ Alignment

The alignment of the differential leader and follower motors, ignoring the configured inverts.

◆ CANBusName

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
std::string_view ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::CANBusName = ""

Name of the CAN bus the mechanism is on.

Possible CAN bus strings are:

  • "rio" for the native roboRIO CAN bus
  • CANivore name or serial number
  • SocketCAN interface (non-FRC Linux only)
  • "*" for any CANivore seen by the program
  • empty string (default) to select the default for the system:
    • "rio" on roboRIO
    • "can0" on Linux
    • "*" on Windows

Note that all devices must be on the same CAN bus.

◆ ClosedLoopRate

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
units::frequency::hertz_t ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::ClosedLoopRate = 100_Hz

The update rate of the closed-loop controllers.

This determines the update rate of the differential leader's DifferentialOutput status signal, the follower's Position and Velocity signals, and the relevant signals for any other selected differential sensor.

◆ FollowerId

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
int ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::FollowerId = 0

CAN ID of the follower motor in the differential mechanism.

The follower will have the differential output subtracted from its regular output.

◆ FollowerInitialConfigs

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
MotorConfigsT ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::FollowerInitialConfigs = {}

The initial configs used to configure the differential follower.

The default value is the factory-default.

Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

The list of configs that will be overwritten is as follows:

If FollowerUsesCommonLeaderConfigs is set to true (default), the following configs are copied from LeaderInitialConfigs:

◆ FollowerUsesCommonLeaderConfigs

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
bool ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::FollowerUsesCommonLeaderConfigs = true

Whether the follower should overwrite some of its initial configs with common configs from the LeaderInitialConfigs, such as current limits.

The list of configs that are copied is documented in FollowerInitialConfigs.

◆ LeaderId

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
int ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::LeaderId = 0

CAN ID of the leader motor in the differential mechanism.

The leader will have the differential output added to its regular output.

◆ LeaderInitialConfigs

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
MotorConfigsT ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::LeaderInitialConfigs = {}

The initial configs used to configure the differential leader.

The default value is the factory-default.

Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

The list of configs that will be overwritten is as follows:

◆ SensorToDifferentialRatio

template<std::derived_from< configs::ParentConfiguration > MotorConfigsT>
units::dimensionless::scalar_t ctre::phoenix6::mechanisms::DifferentialMotorConstants< MotorConfigsT >::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 not using a separate sensor on the difference axis, the sensor is considered half of the difference between the two motor controllers' mechanism positions/velocities. As a result, this should be set to the gear ratio on the difference axis in that scenario, or any gear ratio between the sensor and the mechanism differential when using another sensor source.


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