Optofidelity: PWM-proof StateChangeDetector

The state change detector is the most challenging to make work with
PWM artifacts. There are two major issues:
- During the detection of the finger, the PWM causes reflections off
  the robot finger. This is solved by averaging over multiple frames.
- The resulting data is very noisy, but still shows distinct states.
  We apply a low pass filter (which does not add latency to the result,
  since it's using both a-priori and a-posteriori data for averaging.)
  and normalize the states to the average level of each state.

BUG=chromium:536633
TEST=unit tests included. covered by regression tests on the S6 Edege
     and Nexus 6.

Change-Id: I74ddf87d493c6cf512dcee72618ec428b029637e
Reviewed-on: https://chromium-review.googlesource.com/336530
Commit-Ready: Dennis Kempin <denniskempin@chromium.org>
Tested-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@chromium.org>
4 files changed
tree: 0b09500d2239813e7af8a491451e0656130121c7
  1. .gitignore
  2. OWNERS
  3. optofidelity/
  4. quickstep/
  5. setup.py
  6. touchbotI/
  7. touchbotII/