-
-
Save jimmyli97/2bb7732b35176445aaad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ENC_ERROR_THRESHOLD 3000 | |
int checkEnc = nMotorEncoder[curMotor]; | |
int knownGoodEnc = motorStates[curMotor].lastRealEncoderPos; | |
int curEnc; | |
if (abs(checkEnc - knownGoodEnc) > ENC_ERROR_THRESHOLD) { | |
//do nothing because enc val is bad | |
} else { | |
curEnc = checkEnc; //enc val is good | |
motorStates[curMotor].lastRealEncoderPos = curEnc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment