CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
ctre::phoenix6::configs::CurrentLimitsConfigs Class Reference

Configs that directly affect current limiting features. More...

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

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

Public Member Functions

constexpr CurrentLimitsConfigs ()=default
 
constexpr CurrentLimitsConfigsWithStatorCurrentLimit (units::current::ampere_t newStatorCurrentLimit)
 Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and easier to use config API.
 
constexpr CurrentLimitsConfigsWithStatorCurrentLimitEnable (bool newStatorCurrentLimitEnable)
 Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr CurrentLimitsConfigsWithSupplyCurrentLimit (units::current::ampere_t newSupplyCurrentLimit)
 Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and easier to use config API.
 
constexpr CurrentLimitsConfigsWithSupplyCurrentLimitEnable (bool newSupplyCurrentLimitEnable)
 Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr CurrentLimitsConfigsWithSupplyCurrentLowerLimit (units::current::ampere_t newSupplyCurrentLowerLimit)
 Modifies this configuration's SupplyCurrentLowerLimit parameter and returns itself for method-chaining and easier to use config API.
 
constexpr CurrentLimitsConfigsWithSupplyCurrentLowerTime (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.
 

Detailed Description

Configs that directly affect current limiting features.

Contains the supply/stator current limit thresholds and whether to enable them.

Constructor & Destructor Documentation

◆ CurrentLimitsConfigs()

constexpr ctre::phoenix6::configs::CurrentLimitsConfigs::CurrentLimitsConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

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

◆ Serialize()

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

◆ ToString()

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

◆ WithStatorCurrentLimit()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithStatorCurrentLimit ( units::current::ampere_t newStatorCurrentLimit)
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.

  • Minimum Value: 0.0
  • Maximum Value: 800.0
  • Default Value: 120
  • Units: A
Parameters
newStatorCurrentLimitParameter to modify
Returns
Itself

◆ WithStatorCurrentLimitEnable()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithStatorCurrentLimitEnable ( bool newStatorCurrentLimitEnable)
inlineconstexpr

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

Enable motor stator current limiting.

  • Default Value: True
Parameters
newStatorCurrentLimitEnableParameter to modify
Returns
Itself

◆ WithSupplyCurrentLimit()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLimit ( units::current::ampere_t newSupplyCurrentLimit)
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.

  • Minimum Value: 0.0
  • Maximum Value: 800.0
  • Default Value: 70
  • Units: A
Parameters
newSupplyCurrentLimitParameter to modify
Returns
Itself

◆ WithSupplyCurrentLimitEnable()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLimitEnable ( bool newSupplyCurrentLimitEnable)
inlineconstexpr

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

Enable motor supply current limiting.

  • Default Value: True
Parameters
newSupplyCurrentLimitEnableParameter to modify
Returns
Itself

◆ WithSupplyCurrentLowerLimit()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLowerLimit ( units::current::ampere_t newSupplyCurrentLowerLimit)
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.

  • Minimum Value: 0.0
  • Maximum Value: 500
  • Default Value: 40
  • Units: A
Parameters
newSupplyCurrentLowerLimitParameter to modify
Returns
Itself

◆ WithSupplyCurrentLowerTime()

constexpr CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLowerTime ( units::time::second_t newSupplyCurrentLowerTime)
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.

  • Minimum Value: 0.0
  • Maximum Value: 2.5
  • Default Value: 1.0
  • Units: seconds
Parameters
newSupplyCurrentLowerTimeParameter to modify
Returns
Itself

Member Data Documentation

◆ StatorCurrentLimit

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.

  • Minimum Value: 0.0
  • Maximum Value: 800.0
  • Default Value: 120
  • Units: A

◆ StatorCurrentLimitEnable

bool ctre::phoenix6::configs::CurrentLimitsConfigs::StatorCurrentLimitEnable = true

Enable motor stator current limiting.

  • Default Value: True

◆ SupplyCurrentLimit

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.

  • Minimum Value: 0.0
  • Maximum Value: 800.0
  • Default Value: 70
  • Units: A

◆ SupplyCurrentLimitEnable

bool ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLimitEnable = true

Enable motor supply current limiting.

  • Default Value: True

◆ SupplyCurrentLowerLimit

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.

  • Minimum Value: 0.0
  • Maximum Value: 500
  • Default Value: 40
  • Units: A

◆ SupplyCurrentLowerTime

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.

  • Minimum Value: 0.0
  • Maximum Value: 2.5
  • Default Value: 1.0
  • Units: seconds

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