CTRE Phoenix 6 C++ 24.3.0
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

CurrentLimitsConfigsWithStatorCurrentLimit (double newStatorCurrentLimit)
 Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and easier to use config API. More...
 
CurrentLimitsConfigsWithStatorCurrentLimitEnable (bool newStatorCurrentLimitEnable)
 Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API. More...
 
CurrentLimitsConfigsWithSupplyCurrentLimit (double newSupplyCurrentLimit)
 Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and easier to use config API. More...
 
CurrentLimitsConfigsWithSupplyCurrentLimitEnable (bool newSupplyCurrentLimitEnable)
 Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API. More...
 
CurrentLimitsConfigsWithSupplyCurrentThreshold (double newSupplyCurrentThreshold)
 Modifies this configuration's SupplyCurrentThreshold parameter and returns itself for method-chaining and easier to use config API. More...
 
CurrentLimitsConfigsWithSupplyTimeThreshold (double newSupplyTimeThreshold)
 Modifies this configuration's SupplyTimeThreshold parameter and returns itself for method-chaining and easier to use config API. More...
 
std::string ToString () const override
 
std::string Serialize () const override
 
ctre::phoenix::StatusCode Deserialize (const std::string &to_deserialize) override
 
virtual std::string ToString () const =0
 
virtual ctre::phoenix::StatusCode Deserialize (const std::string &string)=0
 
virtual std::string Serialize () const =0
 

Public Attributes

double StatorCurrentLimit = 0
 The amount of current allowed in the motor (motoring and regen current). More...
 
bool StatorCurrentLimitEnable = false
 Enable motor stator current limiting. More...
 
double SupplyCurrentLimit = 0
 The amount of supply current allowed. More...
 
bool SupplyCurrentLimitEnable = false
 Enable motor supply current limiting. More...
 
double SupplyCurrentThreshold = 0
 Delay supply current limiting until current exceeds this threshold for longer than SupplyTimeThreshold. More...
 
double SupplyTimeThreshold = 0
 Allows unlimited current for a period of time before current limiting occurs. More...
 

Detailed Description

Configs that directly affect current limiting features.

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

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()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithStatorCurrentLimit ( double  newStatorCurrentLimit)
inline

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.

This is only applicable for non-torque current control modes. For torque current control, set the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs instead.

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: 0
  • Units: A
Parameters
newStatorCurrentLimitParameter to modify
Returns
Itself

◆ WithStatorCurrentLimitEnable()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithStatorCurrentLimitEnable ( bool  newStatorCurrentLimitEnable)
inline

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: False
Parameters
newStatorCurrentLimitEnableParameter to modify
Returns
Itself

◆ WithSupplyCurrentLimit()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLimit ( double  newSupplyCurrentLimit)
inline

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

The amount of supply current allowed. Note this requires SupplyCurrentLimitEnable to be true. Use SupplyCurrentThreshold and SupplyTimeThreshold to allow brief periods of high-current before limiting occurs.

This is only applicable for non-torque current control modes. For torque current control, set the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs instead.

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 the rare case where the robot experiences brownouts despite configuring stator current limits, a supply current limit can further help avoid brownouts. However, such brownouts are most commonly caused by a bad battery or poor power wiring.

A reasonable starting point for a supply current limit is 60 A with a threshold of 80 A for 0.1 seconds. Supply current limits commonly range from 20-80 A depending on the breaker used.

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

◆ WithSupplyCurrentLimitEnable()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentLimitEnable ( bool  newSupplyCurrentLimitEnable)
inline

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: False
Parameters
newSupplyCurrentLimitEnableParameter to modify
Returns
Itself

◆ WithSupplyCurrentThreshold()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyCurrentThreshold ( double  newSupplyCurrentThreshold)
inline

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

Delay supply current limiting until current exceeds this threshold for longer than SupplyTimeThreshold. This allows current draws above SupplyCurrentLimit for a fixed period of time. This has no effect if SupplyCurrentLimit is greater than this value.

  • Minimum Value: 0.0
  • Maximum Value: 511
  • Default Value: 0
  • Units: A
Parameters
newSupplyCurrentThresholdParameter to modify
Returns
Itself

◆ WithSupplyTimeThreshold()

CurrentLimitsConfigs & ctre::phoenix6::configs::CurrentLimitsConfigs::WithSupplyTimeThreshold ( double  newSupplyTimeThreshold)
inline

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

Allows unlimited current for a period of time before current limiting occurs. Current threshold is the maximum of SupplyCurrentThreshold and SupplyCurrentLimit.

  • Minimum Value: 0.0
  • Maximum Value: 1.275
  • Default Value: 0
  • Units: sec
Parameters
newSupplyTimeThresholdParameter to modify
Returns
Itself

Member Data Documentation

◆ StatorCurrentLimit

double ctre::phoenix6::configs::CurrentLimitsConfigs::StatorCurrentLimit = 0

The amount of current allowed in the motor (motoring and regen current).

Note this requires StatorCurrentLimitEnable to be true.

This is only applicable for non-torque current control modes. For torque current control, set the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs instead.

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: 0
  • Units: A

◆ StatorCurrentLimitEnable

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

Enable motor stator current limiting.

  • Default Value: False

◆ SupplyCurrentLimit

double ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentLimit = 0

The amount of supply current allowed.

Note this requires SupplyCurrentLimitEnable to be true. Use SupplyCurrentThreshold and SupplyTimeThreshold to allow brief periods of high-current before limiting occurs.

This is only applicable for non-torque current control modes. For torque current control, set the PeakForwardTorqueCurrent and PeakReverseTorqueCurrent in TorqueCurrentConfigs instead.

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 the rare case where the robot experiences brownouts despite configuring stator current limits, a supply current limit can further help avoid brownouts. However, such brownouts are most commonly caused by a bad battery or poor power wiring.

A reasonable starting point for a supply current limit is 60 A with a threshold of 80 A for 0.1 seconds. Supply current limits commonly range from 20-80 A depending on the breaker used.

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

◆ SupplyCurrentLimitEnable

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

Enable motor supply current limiting.

  • Default Value: False

◆ SupplyCurrentThreshold

double ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyCurrentThreshold = 0

Delay supply current limiting until current exceeds this threshold for longer than SupplyTimeThreshold.

This allows current draws above SupplyCurrentLimit for a fixed period of time. This has no effect if SupplyCurrentLimit is greater than this value.

  • Minimum Value: 0.0
  • Maximum Value: 511
  • Default Value: 0
  • Units: A

◆ SupplyTimeThreshold

double ctre::phoenix6::configs::CurrentLimitsConfigs::SupplyTimeThreshold = 0

Allows unlimited current for a period of time before current limiting occurs.

Current threshold is the maximum of SupplyCurrentThreshold and SupplyCurrentLimit.

  • Minimum Value: 0.0
  • Maximum Value: 1.275
  • Default Value: 0
  • Units: sec

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