From a74b05e7acc1883fce8f9799bb7e2131cb99c084 Mon Sep 17 00:00:00 2001 From: ym13n22 <ym13n22@soton.ac.uk> Date: Tue, 23 Jul 2024 17:43:49 +0100 Subject: [PATCH] origion combine --- integration/IMUEMGCombined.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/integration/IMUEMGCombined.py b/integration/IMUEMGCombined.py index b3611dd..0a4128b 100644 --- a/integration/IMUEMGCombined.py +++ b/integration/IMUEMGCombined.py @@ -11,7 +11,7 @@ data_collection_duration = 3 num_measurements_hand = 1 # Initialize the arduino object -arduino = serial.Serial('COM17', 115200) +arduino = serial.Serial('COM7', 115200) # braccio = serial.Serial('COM6', 115200) sleep(1) @@ -49,8 +49,8 @@ def collect_emg_data(duration): try: emg1 = float(data[0]) emg2 = float(data[1]) - #print("Emg1: ",emg1) - #print("Emg2: ",emg2) + print("Emg1: ",emg1) + print("Emg2: ",emg2) emg_data.append((emg1, emg2)) except ValueError: continue @@ -167,6 +167,8 @@ def main(): pitch = -asin(2 * (q0 * q2 - q3 * q1)) yaw = -atan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3)) + print(f"roll: {roll}, pitch: {pitch}, yaw: {yaw}") + k = vector(cos(yaw) * cos(pitch), sin(pitch), sin(yaw) * cos(pitch)) # this is the x vector y = vector(0, 1, 0) # y vector: pointing down s = cross(k, y) # this is pointing to the side -- GitLab