Class CurrentLimitsConfigs

java.lang.Object
com.ctre.phoenix6.configs.CurrentLimitsConfigs
All Implemented Interfaces:
ParentConfiguration, ISerializable

public class CurrentLimitsConfigs extends Object implements ParentConfiguration
Configs that directly affect current limiting features.

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

  • Field Details

    • StatorCurrentLimit

      public double 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 Value: 0.0
      • Maximum Value: 800.0
      • Default Value: 120
      • Units: A
    • StatorCurrentLimitEnable

      public boolean StatorCurrentLimitEnable
      Enable motor stator current limiting.
      • Default Value: True
    • SupplyCurrentLimit

      public double 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 Value: 0.0
      • Maximum Value: 800.0
      • Default Value: 70
      • Units: A
    • SupplyCurrentLimitEnable

      public boolean SupplyCurrentLimitEnable
      Enable motor supply current limiting.
      • Default Value: True
    • SupplyCurrentLowerLimit

      public double 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 Value: 0.0
      • Maximum Value: 500
      • Default Value: 40
      • Units: A
    • SupplyCurrentLowerTime

      public 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 Value: 0.0
      • Maximum Value: 2.5
      • Default Value: 1.0
      • Units: seconds
  • Constructor Details

  • Method Details

    • withStatorCurrentLimit

      public CurrentLimitsConfigs withStatorCurrentLimit(double newStatorCurrentLimit)
      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:
      newStatorCurrentLimit - Parameter to modify
      Returns:
      Itself
    • withStatorCurrentLimit

      public CurrentLimitsConfigs withStatorCurrentLimit(edu.wpi.first.units.measure.Current newStatorCurrentLimit)
      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:
      newStatorCurrentLimit - Parameter to modify
      Returns:
      Itself
    • getStatorCurrentLimitMeasure

      public edu.wpi.first.units.measure.Current getStatorCurrentLimitMeasure()
      Helper method to get this configuration's StatorCurrentLimit parameter converted to a unit type. If not using the Java units library, StatorCurrentLimit can be accessed directly instead.

      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
      Returns:
      StatorCurrentLimit
    • withStatorCurrentLimitEnable

      public CurrentLimitsConfigs withStatorCurrentLimitEnable(boolean newStatorCurrentLimitEnable)
      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:
      newStatorCurrentLimitEnable - Parameter to modify
      Returns:
      Itself
    • withSupplyCurrentLimit

      public CurrentLimitsConfigs withSupplyCurrentLimit(double newSupplyCurrentLimit)
      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:
      newSupplyCurrentLimit - Parameter to modify
      Returns:
      Itself
    • withSupplyCurrentLimit

      public CurrentLimitsConfigs withSupplyCurrentLimit(edu.wpi.first.units.measure.Current newSupplyCurrentLimit)
      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:
      newSupplyCurrentLimit - Parameter to modify
      Returns:
      Itself
    • getSupplyCurrentLimitMeasure

      public edu.wpi.first.units.measure.Current getSupplyCurrentLimitMeasure()
      Helper method to get this configuration's SupplyCurrentLimit parameter converted to a unit type. If not using the Java units library, SupplyCurrentLimit can be accessed directly instead.

      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
      Returns:
      SupplyCurrentLimit
    • withSupplyCurrentLimitEnable

      public CurrentLimitsConfigs withSupplyCurrentLimitEnable(boolean newSupplyCurrentLimitEnable)
      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:
      newSupplyCurrentLimitEnable - Parameter to modify
      Returns:
      Itself
    • withSupplyCurrentLowerLimit

      public CurrentLimitsConfigs withSupplyCurrentLowerLimit(double newSupplyCurrentLowerLimit)
      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:
      newSupplyCurrentLowerLimit - Parameter to modify
      Returns:
      Itself
    • withSupplyCurrentLowerLimit

      public CurrentLimitsConfigs withSupplyCurrentLowerLimit(edu.wpi.first.units.measure.Current newSupplyCurrentLowerLimit)
      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:
      newSupplyCurrentLowerLimit - Parameter to modify
      Returns:
      Itself
    • getSupplyCurrentLowerLimitMeasure

      public edu.wpi.first.units.measure.Current getSupplyCurrentLowerLimitMeasure()
      Helper method to get this configuration's SupplyCurrentLowerLimit parameter converted to a unit type. If not using the Java units library, SupplyCurrentLowerLimit can be accessed directly instead.

      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
      Returns:
      SupplyCurrentLowerLimit
    • withSupplyCurrentLowerTime

      public CurrentLimitsConfigs withSupplyCurrentLowerTime(double newSupplyCurrentLowerTime)
      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:
      newSupplyCurrentLowerTime - Parameter to modify
      Returns:
      Itself
    • withSupplyCurrentLowerTime

      public CurrentLimitsConfigs withSupplyCurrentLowerTime(edu.wpi.first.units.measure.Time newSupplyCurrentLowerTime)
      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:
      newSupplyCurrentLowerTime - Parameter to modify
      Returns:
      Itself
    • getSupplyCurrentLowerTimeMeasure

      public edu.wpi.first.units.measure.Time getSupplyCurrentLowerTimeMeasure()
      Helper method to get this configuration's SupplyCurrentLowerTime parameter converted to a unit type. If not using the Java units library, SupplyCurrentLowerTime can be accessed directly instead.

      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
      Returns:
      SupplyCurrentLowerTime
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • deserialize

      public StatusCode deserialize(String to_deserialize)
      Specified by:
      deserialize in interface ParentConfiguration
    • serialize

      public String serialize()
      Specified by:
      serialize in interface ISerializable