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

Unified 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: Address nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/vr/perf/latency/motopho_thread.py ('k') | chrome/test/vr/perf/latency/run_latency_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/vr/perf/latency/robot_arm.py
diff --git a/chrome/test/vr/perf/latency/robot_arm.py b/chrome/test/vr/perf/latency/robot_arm.py
new file mode 100644
index 0000000000000000000000000000000000000000..d62bef99b9cf6ef85f4f655b87440a2cda370b36
--- /dev/null
+++ b/chrome/test/vr/perf/latency/robot_arm.py
@@ -0,0 +1,46 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import serial
+import time
+
+
+class RobotArm():
+ """Handles the serial communication with the servos/arm used for movement."""
+ def __init__(self, device_name, num_tries=5, baud=115200, timeout=3.0):
+ self._connection = None
+ connected = False
+ for _ in xrange(num_tries):
+ try:
+ self._connection = serial.Serial('/dev/' + device_name,
+ baud,
+ timeout=timeout)
+ except serial.SerialException as e:
+ pass
+ if self._connection and 'Enter parameters' in self._connection.read(1024):
+ connected = True
+ break
+ if not connected:
+ raise serial.SerialException('Failed to connect to the robot arm.')
+
+ def ResetPosition(self):
+ if not self._connection:
+ return
+ # If the servo stopped very close to the desired position, it can just
+ # vibrate instead of moving, so move away before going to the reset
+ # position
+ self._connection.write('5 300 0 5\n')
+ time.sleep(0.5)
+ self._connection.write('5 250 0 5\n')
+ time.sleep(0.5)
+
+ def StartMotophoMovement(self):
+ if not self._connection:
+ return
+ self._connection.write('9\n')
+
+ def StopAllMovement(self):
+ if not self._connection:
+ return
+ self._connection.write('0\n')
« no previous file with comments | « chrome/test/vr/perf/latency/motopho_thread.py ('k') | chrome/test/vr/perf/latency/run_latency_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698