Stator current limit kicks in

I’m trying to code the opening and closing of our intake system.
There’s no encoder on it, so we decided to have it constantly apply around 50% power and set up a current limit that would kick in the moment it reaches the end and stalls.
The problem is that when we set the stator current limit for the falcon controlling the system, the current limit kicks in too soon. Even when I set the threshold to 80A and 1.5 seconds, and the limit to 1A, it kicks in after 1.5 seconds even though the stator current doesn’t get near 80A.
Is there something I must’ve missed here?

There are two current limits, a peak and a continuous. The motor is allowed to pull a higher value (peak value) for a short time and a continuous value infinitely. If it exceeds those values, the current limiting software is applied. It sounds like you have your peak limit set to 80A for 1.5 seconds, but your continuous limit is only 1 Amp. So after the 1.5s of allowed peak, you pass the continuous limit. You probably want to set the continuous limit to something more reasonable for a continuous draw (depending on your use case, somewhere between 10-50 Amps).

The current limit will kick in even though it didn’t take 80A for 1.5 seconds?
My understanding was that once 80A was pulled continuously for 1.5 seconds it will limit to 1A until a new input

If I’m understanding what you explained correctly, that’s not right. If it pulls more than 80A for any amount of time (less than 1.5 seconds) it will limit to 80A. It will also limit to 1A if you exceed 1A for more than 1.5 seconds.

If you want to share the code you’re using to set these limits we can be more certain.

The CTRE docs describe clearly that current limiting should not be triggered unless the current EXCEEDS the peak threshold for the peak duration.

The limiting is characterized by three configs:

  • Peak Current (Amperes), threshold that must be exceeded before limiting occurs.
  • Peak Time (milliseconds), thresholds that must be exceed before limiting occurs
  • Continuous Current (Amperes), maximum allowable current after limiting occurs.

TalonSRX talon = new TalonSRX(0); talon.configPeakCurrentLimit(30); // don't activate current limit until current exceeds 30 A ... talon.configPeakCurrentDuration(100); // ... for at least 100 ms talon.configContinuousCurrentLimit(20); // once current-limiting is actived, hold at 20A talon.enableCurrentLimit(true);

For the Talon FX with stator current limiting the new API implements these same configuration parameters, but in a different form.

The new API leverages the configSupplyCurrentLimit and configStatorCurrentLimit routines. The configs are similar to the existing legacy API, but the configs have been renamed to better communicate the design intent. For example, instead of configPeakCurrentLimit, the setting is referred to as triggerThresholdCurrent.

*                                                               enabled | Limit(amp) | Trigger Threshold(amp) | Trigger Threshold Time(s)  */
  _tal.configStatorCurrentLimit(new StatorCurrentLimitConfiguration(true,      20,                25,                1.0));

It’s now even clearer that current limiting is initiated by a trigger and that trigger has current and time components. The state diagram in the documentation provides another declaration that the current has to be above the threshold for the specified duration before current becomes limited.

I can’t explain what the OP is experiencing, but the CTRE documentation is adamant that the current should not be limited until current exceeds the configured threshold for the configured time.

Yep, I understood the same thing.

There is this “errata” note in the CTRE docs…

Stator Current Limit Threshold Configs

The trigger threshold current and time are not honored in 20.0.0 firmware. Stator current limit will trigger when the measured current exceeds the limit (within 1ms).

I’m assuming that this note means that the problem is limited to only the 20.0.0 firmware and not 20.0.0 and newer. It doesn’t seem like this could apply to the OP’s problem since they aren’t seeing the current limit until after 1.5 seconds, but I thought I’d at least toss this out.

Saw the same and too assumed it has changed since as the period is respected

One thing that’s interesting is almost everything else has a fixed in note, but this one doesn’t. I also don’t see anything relevant in the change log.

Have you tried it with supply current limiting just to see if the behavior is any different? Although stator current limiting may be most appropriate for what you are trying to do, if supply current limiting is working as documented, it might still help you achieve the desired result.