Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/test/vr/perf/latency/robot_arm.py

Issue 2823883003: Make VR latency results compatible with perf dashboard, refactor into classes (Closed)
Patch Set: windows -> win Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium 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 import serial
6
7 class RobotArm():
8 """Handles the serial communication with the servos/arm used for movement."""
9 def __init__(self, device_name, num_tries=5, baud=115200, timeout=3.0):
10 self._connection = None
11 connected = False
12 for _ in xrange(num_tries):
13 try:
14 self._connection = serial.Serial('/dev/' + device_name,
15 baud,
16 timeout=timeout)
17 except serial.SerialException as e:
18 pass
19 if self._connection and 'Enter parameters' in self._connection.read(1024):
20 connected = True
21 break
22 if not connected:
23 raise serial.SerialException('Failed to connect to the robot arm.')
24
25 def StartMotophoMovement(self):
26 if not self._connection:
27 return
28 self._connection.write('9\n')
29
30 def StopAllMovement(self):
31 if not self._connection:
32 return
33 self._connection.write('0\n')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698