Created
June 7, 2017 16:25
-
-
Save rjlutz/f3f628e24d1ed99730e80a72a37a6abf 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
// de-emphasize transient forces | |
private float lowPass(float current, float gravity) { | |
// ALPHA indicates the influence level of past observations | |
return current * (1-ALPHA) + gravity * ALPHA; | |
} | |
// de-emphasize constant forces | |
private float highPass(float current, float gravity) { | |
return current - gravity; | |
} | |
private boolean inRange(float value, float target, float tol) { | |
return value >= target-tol && value <= target+tol; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment