Table of Contents

Class CurrentLimitsConfigs

Namespace
CTRE.Phoenix6.Configs
Assembly
Phoenix6.Hardware.dll

Configs that directly affect current limiting features.

Contains the supply/stator current limit thresholds and whether to enable them.
public class CurrentLimitsConfigs : IParentConfiguration, ISerializable, ICloneable
Inheritance
CurrentLimitsConfigs
Implements
Inherited Members

Fields

StatorCurrentLimit

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 Value0.0
  • Maximum Value800.0
  • Default Value120
  • UnitsA
public double StatorCurrentLimit

Field Value

double

StatorCurrentLimitEnable

Enable motor stator current limiting.

  • Default ValueTrue
public bool StatorCurrentLimitEnable

Field Value

bool

SupplyCurrentLimit

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 Value0.0
  • Maximum Value800.0
  • Default Value70
  • UnitsA
public double SupplyCurrentLimit

Field Value

double

SupplyCurrentLimitEnable

Enable motor supply current limiting.

  • Default ValueTrue
public bool SupplyCurrentLimitEnable

Field Value

bool

SupplyCurrentLowerLimit

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 Value0.0
  • Maximum Value500
  • Default Value40
  • UnitsA
public double SupplyCurrentLowerLimit

Field Value

double

SupplyCurrentLowerTime

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 Value0.0
  • Maximum Value5.0
  • Default Value1.0
  • Unitsseconds
public double SupplyCurrentLowerTime

Field Value

double

Methods

Clone()

Creates a copy of this config group.

public CurrentLimitsConfigs Clone()

Returns

CurrentLimitsConfigs

Deserialize(string)

Deserialize string and put values into this object

public StatusCode Deserialize(string to_deserialize)

Parameters

to_deserialize string

String to deserialize

Returns

StatusCode

OK if deserialization is OK

Serialize()

Serialize this object into a string

public string Serialize()

Returns

string

This object's data serialized into a string

ToString()

Provides the string representation of this object

public override string ToString()

Returns

string

WithStatorCurrentLimit(double)

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 Value0.0
  • Maximum Value800.0
  • Default Value120
  • UnitsA
public CurrentLimitsConfigs WithStatorCurrentLimit(double newStatorCurrentLimit)

Parameters

newStatorCurrentLimit double

Parameter to modify

Returns

CurrentLimitsConfigs

Itself

WithStatorCurrentLimitEnable(bool)

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

Enable motor stator current limiting.
  • Default ValueTrue
public CurrentLimitsConfigs WithStatorCurrentLimitEnable(bool newStatorCurrentLimitEnable)

Parameters

newStatorCurrentLimitEnable bool

Parameter to modify

Returns

CurrentLimitsConfigs

Itself

WithSupplyCurrentLimit(double)

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 Value0.0
  • Maximum Value800.0
  • Default Value70
  • UnitsA
public CurrentLimitsConfigs WithSupplyCurrentLimit(double newSupplyCurrentLimit)

Parameters

newSupplyCurrentLimit double

Parameter to modify

Returns

CurrentLimitsConfigs

Itself

WithSupplyCurrentLimitEnable(bool)

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

Enable motor supply current limiting.
  • Default ValueTrue
public CurrentLimitsConfigs WithSupplyCurrentLimitEnable(bool newSupplyCurrentLimitEnable)

Parameters

newSupplyCurrentLimitEnable bool

Parameter to modify

Returns

CurrentLimitsConfigs

Itself

WithSupplyCurrentLowerLimit(double)

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 Value0.0
  • Maximum Value500
  • Default Value40
  • UnitsA
public CurrentLimitsConfigs WithSupplyCurrentLowerLimit(double newSupplyCurrentLowerLimit)

Parameters

newSupplyCurrentLowerLimit double

Parameter to modify

Returns

CurrentLimitsConfigs

Itself

WithSupplyCurrentLowerTime(double)

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 Value0.0
  • Maximum Value5.0
  • Default Value1.0
  • Unitsseconds
public CurrentLimitsConfigs WithSupplyCurrentLowerTime(double newSupplyCurrentLowerTime)

Parameters

newSupplyCurrentLowerTime double

Parameter to modify

Returns

CurrentLimitsConfigs

Itself