Add support for resting finger + movement tests

This CL adds support for the tests where the user puts one
finger down in the corner of the screen then draws a diagonal
line with a second finger.  This works by finding many many
intermediate points and linearly interpolating between them
to get a smooth line.  The basic idea is the same as the old
script but has been rewritten using the new framework and
works much better now without having to worry about binding
pheumatic tubes in the wrist.

This, being the first complicated 2f gesture for the new FW
test suite also includes the new logic to deal with oversized
devices.  Now you can input a maximum diagonal distance when
requesting absolute coordinates to clip the range to keep the
hand from overextending.  This should work with other similar
gestures too, and is a much more elegant solution than before
where you had to generate two calibration files.

BUG=chromium:474709
TEST=manual testing, the gestures looked great.

Change-Id: I03ec379f7737fd0806004847b6b293d3f74b4070
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/268635
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
diff --git a/gesture_interpreter.py b/gesture_interpreter.py
index 6896771..d63a4a2 100644
--- a/gesture_interpreter.py
+++ b/gesture_interpreter.py
@@ -84,8 +84,10 @@
   elif test.name in SINGLE_FINGER_LINE_TESTS:
     pause = 1 if test.name == tests.ONE_FINGER_TRACKING_FROM_CENTER else 0
     fn = lambda: _PerformOneFingerLineTest(variation, robot, device_spec, pause)
-  elif test.name in tests.TWO_FINGER_TRACKING:
+  elif test.name == tests.TWO_FINGER_TRACKING:
     fn = lambda: _PerformTwoFingerLineTest(variation, robot, device_spec)
+  elif test.name == tests.RESTING_FINGER_PLUS_2ND_FINGER_MOVE:
+    fn = lambda: _PerformRestingFingerTest(variation, robot, device_spec)
 
   if fn is None:
     print color.Fore.RED + 'Error: Robot unable to perform gesture!'
@@ -136,3 +138,18 @@
   robot.Line(device_spec, fingertips, start, end,
              fingertip_spacing=5, fingertip_angle=angle)
   robot.PopSpeed()
+
+
+def _PerformRestingFingerTest(variation, robot, device_spec):
+  direction, speed = variation
+  start, end = LINE_DIRECTION_COORDINATES[direction]
+  stationary_location = LOCATION_COORDINATES[tests.GV.BL]
+
+  stationary_fingertip = robot.fingertips[STANDARD_FINGERTIP]
+  moving_fingertip = robot.fingertips[STANDARD_SECONDARY_FINGERTIP]
+
+  robot.PushSpeed(SPEEDS[speed])
+  robot.LineWithStationaryFinger(device_spec, stationary_fingertip,
+                                 moving_fingertip, start, end,
+                                 stationary_location)
+  robot.PopSpeed()