Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 1 | # Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """ This is a module containing functions that allow the test suite to |
| 6 | determine the specifics of the gesture and execute them on the touchbot. |
| 7 | In essence, you use this class to go from a Test object to the robot |
| 8 | actually performing the correct gesture on the pad. |
| 9 | """ |
| 10 | |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 11 | import math |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 12 | from threading import Thread |
| 13 | |
| 14 | import colorama as color |
| 15 | |
| 16 | import tests |
| 17 | from touchbot import Touchbot |
| 18 | |
| 19 | |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 20 | STANDARD_FINGERTIP = '1round_9mm' |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 21 | STANDARD_SECONDARY_FINGERTIP = '2round_9mm' |
Charlie Mooney | 7b1fdb9 | 2015-05-08 09:22:55 -0700 | [diff] [blame] | 22 | FAT_FINGERTIP = '1round_14mm' |
| 23 | FAT_SECONDARY_FINGERTIP = '2round_14mm' |
| 24 | NOISE_TESTING_FINGERTIP = '1round_12mm' |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 25 | THREE_FINGER_FINGERTIP = 'three_fingers' |
| 26 | FOUR_FINGER_FINGERTIP = 'four_fingers' |
| 27 | FIVE_FINGER_FINGERTIP = 'five_fingers' |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 28 | |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 29 | BUFFER_SIZE = 0.1 |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 30 | OVERSHOOT_DISTANCE = 0.05 |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 31 | LEFT = BUFFER_SIZE |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 32 | OVER_LEFT = -OVERSHOOT_DISTANCE |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 33 | RIGHT = 1.0 - BUFFER_SIZE |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 34 | OVER_RIGHT = 1.0 + OVERSHOOT_DISTANCE |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 35 | TOP = BUFFER_SIZE |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 36 | OVER_TOP = -OVERSHOOT_DISTANCE |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 37 | BOTTOM = 1.0 - BUFFER_SIZE |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 38 | OVER_BOTTOM = 1.0 + OVERSHOOT_DISTANCE |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 39 | CENTER = 0.5 |
| 40 | |
| 41 | LOCATION_COORDINATES = { |
| 42 | tests.GV.TL: (LEFT, TOP), |
| 43 | tests.GV.TR: (RIGHT, TOP), |
| 44 | tests.GV.BL: (LEFT, BOTTOM), |
| 45 | tests.GV.BR: (RIGHT, BOTTOM), |
| 46 | tests.GV.TS: (CENTER, TOP), |
| 47 | tests.GV.BS: (CENTER, BOTTOM), |
| 48 | tests.GV.LS: (LEFT, CENTER), |
| 49 | tests.GV.RS: (RIGHT, CENTER), |
| 50 | tests.GV.CENTER: (CENTER, CENTER), |
| 51 | } |
| 52 | |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 53 | LINE_DIRECTION_COORDINATES = { |
| 54 | tests.GV.LR: ((LEFT, CENTER), (RIGHT, CENTER)), |
| 55 | tests.GV.RL: ((RIGHT, CENTER), (LEFT, CENTER)), |
| 56 | tests.GV.TB: ((CENTER, TOP), (CENTER, BOTTOM)), |
| 57 | tests.GV.BT: ((CENTER, BOTTOM), (CENTER, TOP)), |
| 58 | tests.GV.BLTR: ((LEFT, BOTTOM), (RIGHT, TOP)), |
| 59 | tests.GV.BRTL: ((RIGHT, BOTTOM), (LEFT, TOP)), |
| 60 | tests.GV.TRBL: ((RIGHT, TOP), (LEFT, BOTTOM)), |
| 61 | tests.GV.TLBR: ((LEFT, TOP), (RIGHT, BOTTOM)), |
| 62 | tests.GV.CL: ((CENTER, CENTER), (OVER_LEFT, CENTER)), |
| 63 | tests.GV.CR: ((CENTER, CENTER), (OVER_RIGHT, CENTER)), |
| 64 | tests.GV.CT: ((CENTER, CENTER), (CENTER, OVER_TOP)), |
| 65 | tests.GV.CB: ((CENTER, CENTER), (CENTER, OVER_BOTTOM)), |
| 66 | tests.GV.CUL: ((CENTER, CENTER), (OVER_LEFT, OVER_TOP)), |
| 67 | tests.GV.CLL: ((CENTER, CENTER), (OVER_LEFT, OVER_BOTTOM)), |
| 68 | tests.GV.CLR: ((CENTER, CENTER), (OVER_RIGHT, OVER_BOTTOM)), |
| 69 | } |
| 70 | |
| 71 | SPEEDS = { |
| 72 | tests.GV.NORMAL: Touchbot.SPEED_MEDIUM, |
| 73 | tests.GV.SLOW: Touchbot.SPEED_SLOW, |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 74 | tests.GV.FAST: Touchbot.SPEED_FAST, |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Charlie Mooney | 4198adb | 2015-05-04 13:55:20 -0700 | [diff] [blame] | 77 | ANGLES = { |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 78 | tests.GV.HORIZONTAL: 0, |
| 79 | tests.GV.VERTICAL: 90, |
| 80 | tests.GV.DIAGONAL: 45, |
| 81 | } |
| 82 | |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 83 | ONE_FINGERTIP_TAP_TESTS = [ |
| 84 | tests.ONE_FINGER_TAP, |
| 85 | tests.THREE_FINGER_TAP, |
| 86 | tests.FOUR_FINGER_TAP, |
| 87 | tests.FIVE_FINGER_TAP, |
| 88 | ] |
| 89 | |
| 90 | TAP_TEST_FINGERTIPS = { |
| 91 | tests.ONE_FINGER_TAP: STANDARD_FINGERTIP, |
| 92 | tests.THREE_FINGER_TAP: THREE_FINGER_FINGERTIP, |
| 93 | tests.FOUR_FINGER_TAP: FOUR_FINGER_FINGERTIP, |
| 94 | tests.FIVE_FINGER_TAP: FIVE_FINGER_FINGERTIP, |
| 95 | } |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 96 | |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 97 | SINGLE_FINGER_LINE_TESTS = [ |
| 98 | tests.ONE_FINGER_TO_EDGE, |
| 99 | tests.ONE_FINGER_TRACKING, |
| 100 | tests.ONE_FINGER_TRACKING_FROM_CENTER, |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 101 | tests.ONE_FINGER_SWIPE, |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 102 | ] |
| 103 | |
Charlie Mooney | cfb4a64 | 2015-05-07 15:33:37 -0700 | [diff] [blame] | 104 | TWO_FINGER_LINE_TESTS = [ |
| 105 | tests.TWO_FINGER_TRACKING, |
| 106 | tests.TWO_CLOSE_FINGERS_TRACKING, |
Charlie Mooney | 7b1fdb9 | 2015-05-08 09:22:55 -0700 | [diff] [blame] | 107 | tests.TWO_FAT_FINGERS_TRACKING, |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 108 | tests.TWO_FINGER_SWIPE, |
Charlie Mooney | cfb4a64 | 2015-05-07 15:33:37 -0700 | [diff] [blame] | 109 | ] |
| 110 | |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 111 | |
Charlie Mooney | c56c860 | 2015-05-07 15:15:40 -0700 | [diff] [blame] | 112 | def _ComputePerpendicularAngle(start, end): |
| 113 | """ Compute the fingertip angle to be perpendicular to the |
| 114 | movement direction. |
| 115 | |
| 116 | The robot's X/Y axes are not in the same direction as the touch device's, |
| 117 | they are flipped. |
| 118 | |
| 119 | DUT x ----> Robot y ----> |
| 120 | y x |
| 121 | | | |
| 122 | | | |
| 123 | \/ \/ |
| 124 | |
| 125 | As a result the angle is computed in the DUT space, but then must have |
| 126 | its sign flipped before being used in any commands to the robot or |
| 127 | everything will be wrong since it's a clockwise angle instead of counter- |
| 128 | clockwise. |
| 129 | """ |
| 130 | x1, y1 = start |
| 131 | x2, y2 = end |
| 132 | dy = y2 - y1 |
| 133 | dx = x2 - x1 |
| 134 | return -1 * (math.degrees(math.atan2(y2 - y1, x2 - x1)) + 90) |
| 135 | |
| 136 | |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 137 | def PerformCorrespondingGesture(test, variation_number, robot, device_spec): |
| 138 | variation = test.variations[variation_number] |
| 139 | fn = None |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 140 | |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 141 | if test.name == tests.NOISE_STATIONARY: |
| 142 | fn = lambda: _PerformStationaryNoiseTest(variation, robot, device_spec) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 143 | |
| 144 | elif test.name in ONE_FINGERTIP_TAP_TESTS: |
| 145 | fingertip = robot.fingertips[TAP_TEST_FINGERTIPS[test.name]] |
| 146 | vertical_offset = 0 |
| 147 | if test.name != tests.ONE_FINGER_TAP: |
| 148 | vertical_offset = robot.LARGE_FINGERTIP_VERTICAL_OFFSET |
| 149 | fn = lambda: _PerformOneFingertipTapTest(variation, robot, device_spec, |
| 150 | fingertip, vertical_offset) |
Charlie Mooney | 4198adb | 2015-05-04 13:55:20 -0700 | [diff] [blame] | 151 | elif test.name == tests.TWO_FINGER_TAP: |
| 152 | fn = lambda: _PerformTwoFingerTapTest(variation, robot, device_spec) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 153 | |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 154 | elif test.name in SINGLE_FINGER_LINE_TESTS: |
| 155 | pause = 1 if test.name == tests.ONE_FINGER_TRACKING_FROM_CENTER else 0 |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 156 | is_swipe = (test.name == tests.ONE_FINGER_SWIPE) |
| 157 | fn = lambda: _PerformOneFingerLineTest(variation, robot, device_spec, |
| 158 | pause, is_swipe) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 159 | |
Charlie Mooney | cfb4a64 | 2015-05-07 15:33:37 -0700 | [diff] [blame] | 160 | elif test.name in TWO_FINGER_LINE_TESTS: |
Charlie Mooney | 7b1fdb9 | 2015-05-08 09:22:55 -0700 | [diff] [blame] | 161 | spacing = 5 |
| 162 | fingertips = [robot.fingertips[STANDARD_FINGERTIP], |
| 163 | robot.fingertips[STANDARD_SECONDARY_FINGERTIP]] |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 164 | is_swipe = (test.name == tests.TWO_FINGER_SWIPE) |
Charlie Mooney | 7b1fdb9 | 2015-05-08 09:22:55 -0700 | [diff] [blame] | 165 | if test.name == tests.TWO_CLOSE_FINGERS_TRACKING: |
| 166 | spacing = 0 |
| 167 | elif test.name == tests.TWO_FAT_FINGERS_TRACKING: |
| 168 | spacing = 10 |
| 169 | fingertips = [robot.fingertips[FAT_FINGERTIP], |
| 170 | robot.fingertips[FAT_SECONDARY_FINGERTIP]] |
Charlie Mooney | cfb4a64 | 2015-05-07 15:33:37 -0700 | [diff] [blame] | 171 | fn = lambda: _PerformTwoFingerLineTest(variation, robot, device_spec, |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 172 | fingertips, spacing, is_swipe) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 173 | |
Charlie Mooney | e9fd656 | 2015-04-30 13:45:19 -0700 | [diff] [blame] | 174 | elif test.name == tests.RESTING_FINGER_PLUS_2ND_FINGER_MOVE: |
| 175 | fn = lambda: _PerformRestingFingerTest(variation, robot, device_spec) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 176 | |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 177 | elif test.name == tests.PINCH_TO_ZOOM: |
| 178 | fn = lambda: _PerformPinchTest(variation, robot, device_spec) |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 179 | |
Charlie Mooney | c56c860 | 2015-05-07 15:15:40 -0700 | [diff] [blame] | 180 | elif test.name == tests.DRAG_THUMB_EDGE: |
| 181 | fn = lambda: _PerformThumbEdgeTest(variation, robot, device_spec) |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 182 | |
| 183 | if fn is None: |
Charlie Mooney | ca3fc20 | 2015-05-21 11:16:53 -0700 | [diff] [blame] | 184 | print color.Fore.RED + 'Robot unable to perform gesture! Skipping...' |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 185 | return None |
| 186 | |
| 187 | return Thread(target=fn) |
| 188 | |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 189 | |
Charlie Mooney | 0866191 | 2015-04-16 09:20:34 -0700 | [diff] [blame] | 190 | def _PerformStationaryNoiseTest(variation, robot, device_spec): |
| 191 | frequency, amplitude, waveform, location = variation |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 192 | tap_position = LOCATION_COORDINATES[location] |
Charlie Mooney | 058aa5f | 2015-05-06 12:55:48 -0700 | [diff] [blame] | 193 | fingertip = robot.fingertips[NOISE_TESTING_FINGERTIP] |
Charlie Mooney | 4198adb | 2015-05-04 13:55:20 -0700 | [diff] [blame] | 194 | robot.Tap(device_spec, [fingertip], tap_position, touch_time_s=4) |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 195 | |
| 196 | |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 197 | def _PerformOneFingertipTapTest(variation, robot, device_spec, fingertip, |
| 198 | vertical_offset): |
Charlie Mooney | 1b70811 | 2015-04-28 14:46:21 -0700 | [diff] [blame] | 199 | location, = variation |
| 200 | tap_position = LOCATION_COORDINATES[location] |
Charlie Mooney | 1777b37 | 2015-05-21 10:40:43 -0700 | [diff] [blame^] | 201 | robot.Tap(device_spec, [fingertip], tap_position, |
| 202 | vertical_offset=vertical_offset) |
Charlie Mooney | 4198adb | 2015-05-04 13:55:20 -0700 | [diff] [blame] | 203 | |
| 204 | |
| 205 | def _PerformTwoFingerTapTest(variation, robot, device_spec): |
| 206 | angle, = variation |
| 207 | |
| 208 | fingertip1 = robot.fingertips[STANDARD_FINGERTIP] |
| 209 | fingertip2 = robot.fingertips[STANDARD_SECONDARY_FINGERTIP] |
| 210 | fingertips = [fingertip1, fingertip2] |
| 211 | |
| 212 | robot.Tap(device_spec, fingertips, (CENTER, CENTER), angle=ANGLES[angle]) |
Charlie Mooney | 1b70811 | 2015-04-28 14:46:21 -0700 | [diff] [blame] | 213 | |
| 214 | |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 215 | def _PerformOneFingerLineTest(variation, robot, device_spec, pause_time_s, |
| 216 | is_swipe): |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 217 | direction, speed = variation |
| 218 | start, end = LINE_DIRECTION_COORDINATES[direction] |
| 219 | fingertip = robot.fingertips[STANDARD_FINGERTIP] |
| 220 | |
| 221 | robot.PushSpeed(SPEEDS[speed]) |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 222 | robot.Line(device_spec, [fingertip], start, end, pause_s=pause_time_s, |
| 223 | swipe=is_swipe) |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 224 | robot.PopSpeed() |
| 225 | |
| 226 | |
Charlie Mooney | 7b1fdb9 | 2015-05-08 09:22:55 -0700 | [diff] [blame] | 227 | def _PerformTwoFingerLineTest(variation, robot, device_spec, fingertips, |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 228 | spacing_mm, is_swipe): |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 229 | direction, speed = variation |
| 230 | start, end = LINE_DIRECTION_COORDINATES[direction] |
Charlie Mooney | c56c860 | 2015-05-07 15:15:40 -0700 | [diff] [blame] | 231 | angle = _ComputePerpendicularAngle(start, end) |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 232 | |
Charlie Mooney | a337d58 | 2015-04-29 10:37:45 -0700 | [diff] [blame] | 233 | robot.PushSpeed(SPEEDS[speed]) |
Charlie Mooney | be4661e | 2015-05-20 11:46:43 -0700 | [diff] [blame] | 234 | robot.Line(device_spec, fingertips, start, end, fingertip_spacing=spacing_mm, |
| 235 | fingertip_angle=angle, swipe=is_swipe) |
Charlie Mooney | 61b4fbb | 2015-04-22 15:22:02 -0700 | [diff] [blame] | 236 | robot.PopSpeed() |
Charlie Mooney | e9fd656 | 2015-04-30 13:45:19 -0700 | [diff] [blame] | 237 | |
| 238 | |
| 239 | def _PerformRestingFingerTest(variation, robot, device_spec): |
| 240 | direction, speed = variation |
| 241 | start, end = LINE_DIRECTION_COORDINATES[direction] |
| 242 | stationary_location = LOCATION_COORDINATES[tests.GV.BL] |
| 243 | |
| 244 | stationary_fingertip = robot.fingertips[STANDARD_FINGERTIP] |
| 245 | moving_fingertip = robot.fingertips[STANDARD_SECONDARY_FINGERTIP] |
| 246 | |
| 247 | robot.PushSpeed(SPEEDS[speed]) |
| 248 | robot.LineWithStationaryFinger(device_spec, stationary_fingertip, |
| 249 | moving_fingertip, start, end, |
| 250 | stationary_location) |
| 251 | robot.PopSpeed() |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 252 | |
| 253 | def _PerformPinchTest(variation, robot, device_spec): |
| 254 | direction, angle = variation |
| 255 | |
| 256 | min_spread = 15 |
| 257 | max_spread = min(device_spec.Height(), device_spec.Width(), |
| 258 | robot.MAX_FINGER_DISTANCE) |
| 259 | if direction == tests.GV.ZOOM_OUT: |
| 260 | start_distance, end_distance = max_spread, min_spread |
| 261 | else: |
| 262 | start_distance, end_distance = min_spread, max_spread |
| 263 | |
Charlie Mooney | 058aa5f | 2015-05-06 12:55:48 -0700 | [diff] [blame] | 264 | fingertips = [robot.fingertips[STANDARD_FINGERTIP], |
| 265 | robot.fingertips[STANDARD_SECONDARY_FINGERTIP]] |
| 266 | |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 267 | robot.PushSpeed(SPEEDS[tests.GV.NORMAL]) |
Charlie Mooney | 058aa5f | 2015-05-06 12:55:48 -0700 | [diff] [blame] | 268 | robot.Pinch(device_spec, fingertips, (CENTER, CENTER), ANGLES[angle], |
Charlie Mooney | 5065bcb | 2015-05-04 13:18:09 -0700 | [diff] [blame] | 269 | start_distance, end_distance) |
| 270 | robot.PopSpeed() |
Charlie Mooney | c56c860 | 2015-05-07 15:15:40 -0700 | [diff] [blame] | 271 | |
| 272 | def _PerformThumbEdgeTest(variation, robot, device_spec): |
| 273 | fingertip_type, direction = variation |
| 274 | start, end = LINE_DIRECTION_COORDINATES[direction] |
| 275 | angle = _ComputePerpendicularAngle(start, end) |
| 276 | |
| 277 | fingertip = robot.fingertips[fingertip_type] |
| 278 | |
| 279 | robot.PushSpeed(SPEEDS[tests.GV.NORMAL]) |
| 280 | robot.Line(device_spec, [fingertip], start, end, fingertip_angle=angle) |
| 281 | robot.PopSpeed() |