CTRE Phoenix 6 C++ 25.0.0-beta-4
|
Configs that directly affect current limiting features. More...
#include <ctre/phoenix6/configs/Configs.hpp>
Public Member Functions | |
constexpr | CurrentLimitsConfigs ()=default |
constexpr CurrentLimitsConfigs & | WithStatorCurrentLimit (units::current::ampere_t newStatorCurrentLimit) |
Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and easier to use config API. | |
constexpr CurrentLimitsConfigs & | WithStatorCurrentLimitEnable (bool newStatorCurrentLimitEnable) |
Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API. | |
constexpr CurrentLimitsConfigs & | WithSupplyCurrentLimit (units::current::ampere_t newSupplyCurrentLimit) |
Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and easier to use config API. | |
constexpr CurrentLimitsConfigs & | WithSupplyCurrentLimitEnable (bool newSupplyCurrentLimitEnable) |
Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API. | |
constexpr CurrentLimitsConfigs & | WithSupplyCurrentLowerLimit (units::current::ampere_t newSupplyCurrentLowerLimit) |
Modifies this configuration's SupplyCurrentLowerLimit parameter and returns itself for method-chaining and easier to use config API. | |
constexpr CurrentLimitsConfigs & | WithSupplyCurrentLowerTime (units::time::second_t newSupplyCurrentLowerTime) |
Modifies this configuration's SupplyCurrentLowerTime parameter and returns itself for method-chaining and easier to use config API. | |
std::string | ToString () const override |
std::string | Serialize () const override |
ctre::phoenix::StatusCode | Deserialize (const std::string &to_deserialize) override |
Public Attributes | |
units::current::ampere_t | StatorCurrentLimit = 120_A |
The amount of current allowed in the motor (motoring and regen current). | |
bool | StatorCurrentLimitEnable = true |
Enable motor stator current limiting. | |
units::current::ampere_t | SupplyCurrentLimit = 70_A |
The absolute maximum amount of supply current allowed. | |
bool | SupplyCurrentLimitEnable = true |
Enable motor supply current limiting. | |
units::current::ampere_t | SupplyCurrentLowerLimit = 40_A |
The amount of supply current allowed after the regular SupplyCurrentLimit is active for longer than SupplyCurrentLowerTime. | |
units::time::second_t | SupplyCurrentLowerTime = 1.0_s |
Reduces supply current to the SupplyCurrentLowerLimit after limiting to SupplyCurrentLimit for this period of time. | |
Configs that directly affect current limiting features.
Contains the supply/stator current limit thresholds and whether to enable them.
|
constexprdefault |
|
inlineoverridevirtual |
Implements ctre::phoenix6::configs::ParentConfiguration.
|
inlineoverridevirtual |
Implements ctre::phoenix6::ISerializable.
|
inlineoverridevirtual |
Implements ctre::phoenix6::configs::ParentConfiguration.
|
inlineconstexpr |
Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and easier to use config API.
The amount of current allowed in the motor (motoring and regen current). Note this requires StatorCurrentLimitEnable to be true.
For torque current control, this is applied in addition to the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs.
Stator current is directly proportional to torque, so this limit can be used to restrict the torque output of the motor, such as preventing wheel slip for a drivetrain. Additionally, stator current limits can prevent brownouts during acceleration; supply current will never exceed the stator current limit and is often significantly lower than stator current.
A reasonable starting point for a stator current limit is 120 A, with values commonly ranging from 80-160 A. Mechanisms with a hard stop may need a smaller limit to reduce the torque applied when running into the hard stop.
newStatorCurrentLimit | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.
Enable motor stator current limiting.
newStatorCurrentLimitEnable | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and easier to use config API.
The absolute maximum amount of supply current allowed. Note this requires SupplyCurrentLimitEnable to be true. Use SupplyCurrentLowerLimit and SupplyCurrentLowerTime to reduce the supply current limit after the time threshold is exceeded.
Supply current is the current drawn from the battery, so this limit can be used to prevent breaker trips and improve battery longevity. Additionally, in scenarios where the robot experiences brownouts despite configuring stator current limits, a supply current limit can further help avoid brownouts. However, it is important to note that such brownouts may be caused by a bad battery or poor power wiring.
A reasonable starting point for a supply current limit is 70 A with a lower limit of 40 A after 1.0 second. Supply current limits commonly range from 20-80 A depending on the breaker used.
newSupplyCurrentLimit | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.
Enable motor supply current limiting.
newSupplyCurrentLimitEnable | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's SupplyCurrentLowerLimit parameter and returns itself for method-chaining and easier to use config API.
The amount of supply current allowed after the regular SupplyCurrentLimit is active for longer than SupplyCurrentLowerTime. This allows higher current draws for a fixed period of time before reducing the current limit to protect breakers. This has no effect if SupplyCurrentLimit is lower than this value or SupplyCurrentLowerTime is 0.
newSupplyCurrentLowerLimit | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's SupplyCurrentLowerTime parameter and returns itself for method-chaining and easier to use config API.
Reduces supply current to the SupplyCurrentLowerLimit after limiting to SupplyCurrentLimit for this period of time. If this is set to 0, SupplyCurrentLowerLimit will be ignored.
newSupplyCurrentLowerTime | Parameter to modify |
units::current::ampere_t ctre::phoenix6::configs::CurrentLimitsConfigs::StatorCurrentLimit = 120_A |
The amount of current allowed in the motor (motoring and regen current).
Note this requires StatorCurrentLimitEnable to be true.
For torque current control, this is applied in addition to the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs.
Stator current is directly proportional to torque, so this limit can be used to restrict the torque output of the motor, such as preventing wheel slip for a drivetrain. Additionally, stator current limits can prevent brownouts during acceleration; supply current will never exceed the stator current limit and is often significantly lower than stator current.
A reasonable starting point for a stator current limit is 120 A, with values commonly ranging from 80-160 A. Mechanisms with a hard stop may need a smaller limit to reduce the torque applied when running into the hard stop.
bool ctre::phoenix6::configs::CurrentLimitsConfigs::StatorCurrentLimitEnable = true |
Enable motor stator current limiting.
units::current::ampere_t ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLimit = 70_A |
The absolute maximum amount of supply current allowed.
Note this requires SupplyCurrentLimitEnable to be true. Use SupplyCurrentLowerLimit and SupplyCurrentLowerTime to reduce the supply current limit after the time threshold is exceeded.
Supply current is the current drawn from the battery, so this limit can be used to prevent breaker trips and improve battery longevity. Additionally, in scenarios where the robot experiences brownouts despite configuring stator current limits, a supply current limit can further help avoid brownouts. However, it is important to note that such brownouts may be caused by a bad battery or poor power wiring.
A reasonable starting point for a supply current limit is 70 A with a lower limit of 40 A after 1.0 second. Supply current limits commonly range from 20-80 A depending on the breaker used.
bool ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLimitEnable = true |
Enable motor supply current limiting.
units::current::ampere_t ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLowerLimit = 40_A |
The amount of supply current allowed after the regular SupplyCurrentLimit is active for longer than SupplyCurrentLowerTime.
This allows higher current draws for a fixed period of time before reducing the current limit to protect breakers. This has no effect if SupplyCurrentLimit is lower than this value or SupplyCurrentLowerTime is 0.
units::time::second_t ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLowerTime = 1.0_s |
Reduces supply current to the SupplyCurrentLowerLimit after limiting to SupplyCurrentLimit for this period of time.
If this is set to 0, SupplyCurrentLowerLimit will be ignored.