Falcon 500 - Detecting Motor Stalls

On our robot we have a Falcon 500 and I need to be able to detect when it stalls so I can back-off the motor, however the method we are currently using is not giving us the most consistent results, we are detecting when there is a spike in current.

One thing I noticed was when a falcon stalls a screech is emitted by a built-in buzzer, I had an idea that if I could detect when power is being sent to the buzzer (AKA the buzzer is making noise) it would be more accurate than checking for a spike in current, I was wondering if this theory is correct and I actually can access the motor, if not it would be great if I could get some feedback on the current stall detection code we have.

    public boolean isStalled() {
        double velo = getEncoderVelocity();
        if (clawMot.getSupplyCurrent() >= 0.1) {
            if (velo <= 30) {
                //motor stalled
                return true;
            } else {
                //motor not stalled
                return false;
            }

        } else {
            //motor not running
            return false;
        }

We use Falcons 500, and rely exclusively on velocity to detect a stall, but we use a moving window.

Look at tripleCheckIfStalled() at FRC2495-2023/Drivetrain.java at main · FRC2495/FRC2495-2023 (github.com)

and FRC2495-2023/DrivetrainMoveDistanceWithStallDetection.java at main · FRC2495/FRC2495-2023 (github.com)

There’s no such part in the Falcon500. That noise you hear is the motor itself.

Assuming i understand this code, you may want to expand your bounds. It looks like you are checking if your current exceeds 0.1 amps, which is… all the time. Use tuner to check how much current your mechanism is actually pulling while stalled.