SparkMax Controller Reset

It seems that our sparkmax controller for our arm is resetting occasionally due possibly due to brownout so that the encoder resets to 0. I am trying to find out how to test for this but can not find documentation on sparkmax faults. I am thinking of this code:

    if (mArmMotorController.getFault(CANSparkMax.FaultID.kHasReset)) {
       //deal with reset
    }

but want to get some confirmation that this will be called only once if a reset occurred. I can’t test fully since then next time we run the robot will be on the practice field during competition.

You want the sticky fault version of this.

sparkMax.getStickyFault(FaultID.kHasReset);

Since this fault ‘sticks’ around, you should also clear faults after detection

sparkMax.clearFaults();
1 Like

Thanks, testing today

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.