Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
You can’t perform that action at this time.