Class CurrentLimitsConfigs
- All Implemented Interfaces:
ParentConfiguration
,ISerializable
Contains the supply/stator current limit thresholds and whether to enable them.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondouble
The amount of current allowed in the motor (motoring and regen current).boolean
Enable motor stator current limiting.double
The absolute maximum amount of supply current allowed.boolean
Enable motor supply current limiting.double
The amount of supply current allowed after the regular SupplyCurrentLimit is active for longer than SupplyCurrentLowerTime.double
Reduces supply current to the SupplyCurrentLowerLimit after limiting to SupplyCurrentLimit for this period of time. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(String to_deserialize) edu.wpi.first.units.measure.Current
Helper method to get this configuration's StatorCurrentLimit parameter converted to a unit type.edu.wpi.first.units.measure.Current
Helper method to get this configuration's SupplyCurrentLimit parameter converted to a unit type.edu.wpi.first.units.measure.Current
Helper method to get this configuration's SupplyCurrentLowerLimit parameter converted to a unit type.edu.wpi.first.units.measure.Time
Helper method to get this configuration's SupplyCurrentLowerTime parameter converted to a unit type.toString()
withStatorCurrentLimit
(double newStatorCurrentLimit) Modifies this configuration's StatorCurrentLimit parameter and returns itself for method-chaining and easier to use config API.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.withStatorCurrentLimitEnable
(boolean newStatorCurrentLimitEnable) Modifies this configuration's StatorCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.withSupplyCurrentLimit
(double newSupplyCurrentLimit) Modifies this configuration's SupplyCurrentLimit parameter and returns itself for method-chaining and easier to use config API.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.withSupplyCurrentLimitEnable
(boolean newSupplyCurrentLimitEnable) Modifies this configuration's SupplyCurrentLimitEnable parameter and returns itself for method-chaining and easier to use config API.withSupplyCurrentLowerLimit
(double newSupplyCurrentLowerLimit) Modifies this configuration's SupplyCurrentLowerLimit parameter and returns itself for method-chaining and easier to use config API.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.withSupplyCurrentLowerTime
(double newSupplyCurrentLowerTime) Modifies this configuration's SupplyCurrentLowerTime parameter and returns itself for method-chaining and easier to use config API.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.
-
Field Details
-
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
Enable motor stator current limiting.- Default Value: True
-
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
Enable motor supply current limiting.- Default Value: True
-
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
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
-
CurrentLimitsConfigs
public CurrentLimitsConfigs()
-
-
Method Details
-
withStatorCurrentLimit
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
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
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
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
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
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
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
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
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
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
-
deserialize
- Specified by:
deserialize
in interfaceParentConfiguration
-
serialize
- Specified by:
serialize
in interfaceISerializable
-