From 45b16d5d894c9559206cfd8c5487c41b66580dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20=C5=81ukawski?= Date: Fri, 23 Mar 2018 19:07:16 +0100 Subject: [PATCH] Move sensor_reader.py to yarp-devices repo https://github.com/roboticslab-uc3m/yarp-devices/commit/cfefb2c7bc1a6dc0e5b11f541cb5cbf26242f7af --- share/amorTools/CMakeLists.txt | 3 +- share/amorTools/scripts/sensor_reader.py | 66 ------------------------ share/amorTools/scripts/sensors.xml | 3 +- 3 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 share/amorTools/scripts/sensor_reader.py diff --git a/share/amorTools/CMakeLists.txt b/share/amorTools/CMakeLists.txt index 5b80fce..83a8e4c 100644 --- a/share/amorTools/CMakeLists.txt +++ b/share/amorTools/CMakeLists.txt @@ -1,6 +1,5 @@ set(scripts scripts/amorTools.xml - scripts/sensors.xml - scripts/sensor_reader.py) + scripts/sensors.xml) yarp_install(FILES ${scripts} DESTINATION ${AMOR_APPLICATIONS_INSTALL_DIR}) diff --git a/share/amorTools/scripts/sensor_reader.py b/share/amorTools/scripts/sensor_reader.py deleted file mode 100644 index 66cddcc..0000000 --- a/share/amorTools/scripts/sensor_reader.py +++ /dev/null @@ -1,66 +0,0 @@ -import yarp -import Tkinter as tk - -yarp.Network.init() - -root = tk.Tk() - -handSensors = tk.LabelFrame(root, text="Hand sensors") -handSensors.pack(fill="both", expand="yes", side="left") - -forearmSensors = tk.LabelFrame(root, text="Forearm sensors") -forearmSensors.pack(fill="both", expand="yes", side="left") - -armSensors = tk.LabelFrame(root, text="Arm sensors") -armSensors.pack(fill="both", expand="yes", side="left") - -sensors = [] -parts = [handSensors, forearmSensors, armSensors] - -for part in range(3): - labels = [] - sensors.append(labels) - - for sensor in range(16): - label = tk.Label(parts[part], text="s%d: " % (sensor + 1)) - label.pack() - labels.append(label) - -class DataProcessor(yarp.PortReader): - def read(self, connection): - print("in DataProcessor.read") - - if not connection.isValid(): - print("Connection shutting down") - return False - - b = yarp.Bottle() - - print("Trying to read from connection") - ok = b.read(connection) - - if not ok: - print("Failed to read input") - return False - - print("Received [%s]" % b.toString()) - - i = 0 - - for part in range(3): - for sensor in range(16): - sensors[part][sensor]['text'] = 's%d: %d' % (sensor + 1, b.get(i).asDouble()) - i += 1 - - return True - -p = yarp.Port() -r = DataProcessor() -p.setReader(r) -p.open("/sensor_reader_gui"); - -root.mainloop() - -p.close() - -yarp.Network.fini(); diff --git a/share/amorTools/scripts/sensors.xml b/share/amorTools/scripts/sensors.xml index 4e4bbee..a9fe302 100644 --- a/share/amorTools/scripts/sensors.xml +++ b/share/amorTools/scripts/sensors.xml @@ -17,9 +17,8 @@ python - sensor_reader.py + sensorReader.py localhost - /usr/local/share/amor/applications /amor