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;
}