From 35a455363cba8d6da8e9cf9df3a217cf608eccf7 Mon Sep 17 00:00:00 2001 From: Jazmin Ferreiro Date: Fri, 21 Jan 2022 20:35:50 +0100 Subject: [PATCH 1/4] remove inclination --- lib/datacollection/storage.dart | 3 -- lib/edgeimpulse/api_client.dart | 41 ---------------------- lib/model/glove_measurement.dart | 48 +++----------------------- lib/pages/file_content_chart_page.dart | 10 ------ 4 files changed, 4 insertions(+), 98 deletions(-) diff --git a/lib/datacollection/storage.dart b/lib/datacollection/storage.dart index b8f0402..0850854 100644 --- a/lib/datacollection/storage.dart +++ b/lib/datacollection/storage.dart @@ -183,9 +183,6 @@ class SensorMeasurements { measurementList.add(finger.gyro.x); measurementList.add(finger.gyro.y); measurementList.add(finger.gyro.z); - measurementList.add(finger.inclination.roll); - measurementList.add(finger.inclination.pitch); - measurementList.add(finger.inclination.yaw); return measurementList; } diff --git a/lib/edgeimpulse/api_client.dart b/lib/edgeimpulse/api_client.dart index 9499111..6283ab1 100644 --- a/lib/edgeimpulse/api_client.dart +++ b/lib/edgeimpulse/api_client.dart @@ -73,9 +73,6 @@ class EdgeImpulseApiClient { SensorParameter("thumbGyroX", "deg"), SensorParameter("thumbGyroY", "deg"), SensorParameter("thumbGyroZ", "deg"), - SensorParameter("thumbRoll", "deg"), - SensorParameter("thumbPitch", "deg"), - SensorParameter("thumbYaw", "deg"), //index SensorParameter("indexAccX", "m/s2"), SensorParameter("indexAccY", "m/s2"), @@ -83,9 +80,6 @@ class EdgeImpulseApiClient { SensorParameter("indexGyroX", "deg"), SensorParameter("indexGyroY", "deg"), SensorParameter("indexGyroZ", "deg"), - SensorParameter("indexRoll", "deg"), - SensorParameter("indexPitch", "deg"), - SensorParameter("indexYaw", "deg"), //middle SensorParameter("middleAccX", "m/s2"), SensorParameter("middleAccY", "m/s2"), @@ -93,9 +87,6 @@ class EdgeImpulseApiClient { SensorParameter("middleGyroX", "deg"), SensorParameter("middleGyroY", "deg"), SensorParameter("middleGyroZ", "deg"), - SensorParameter("middleRoll", "deg"), - SensorParameter("middlePitch", "deg"), - SensorParameter("middleYaw", "deg"), //ring SensorParameter("ringAccX", "m/s2"), SensorParameter("ringAccY", "m/s2"), @@ -103,9 +94,6 @@ class EdgeImpulseApiClient { SensorParameter("ringGyroX", "deg"), SensorParameter("ringGyroY", "deg"), SensorParameter("ringGyroZ", "deg"), - SensorParameter("ringRoll", "deg"), - SensorParameter("ringPitch", "deg"), - SensorParameter("ringYaw", "deg"), //pinky SensorParameter("pinkyAccX", "m/s2"), SensorParameter("pinkyAccY", "m/s2"), @@ -113,9 +101,6 @@ class EdgeImpulseApiClient { SensorParameter("pinkyGyroX", "deg"), SensorParameter("pinkyGyroY", "deg"), SensorParameter("pinkyGyroZ", "deg"), - SensorParameter("pinkyRoll", "deg"), - SensorParameter("pinkyPitch", "deg"), - SensorParameter("pinkyYaw", "deg"), ]; } @@ -146,32 +131,6 @@ class SecretLoader { } } -/* -* { - "protected": { - "ver": "v1", - "alg": "HS256", - "iat": 1625527314 - }, - "signature": "emptySignature", - "payload": { - "device_name": "ac:87:a3:0a:2d:1b", - "device_type": "DISCO-L475VG-IOT01A", - "interval_ms": 10, - "sensors": [ - { "name": "accX", "units": "m/s2" }, - { "name": "accY", "units": "m/s2" }, - { "name": "accZ", "units": "m/s2" } - ], - "values": [ - [ -9.81, 0.03, 1.21 ], - [ -9.83, 0.04, 1.27 ], - [ -9.12, 0.03, 1.23 ], - [ -9.14, 0.01, 1.25 ] - ] - } -} -*/ class EdgeImpulseBody { final Protected protected; diff --git a/lib/model/glove_measurement.dart b/lib/model/glove_measurement.dart index a822900..1b51800 100644 --- a/lib/model/glove_measurement.dart +++ b/lib/model/glove_measurement.dart @@ -101,8 +101,7 @@ class GloveMeasurement { enum SensorValue { Acceleration, - Gyroscope, - Inclination + Gyroscope } extension SensorValueExtension on SensorValue { @@ -112,8 +111,6 @@ extension SensorValueExtension on SensorValue { return "Acelerómetro"; case SensorValue.Gyroscope: return "Giroscopio"; - case SensorValue.Inclination: - return "Inclinación"; } } @@ -123,8 +120,6 @@ extension SensorValueExtension on SensorValue { return "x (m/s²)"; case SensorValue.Gyroscope: return "x (º/s)"; - case SensorValue.Inclination: - return "roll"; } } String getYLabel() { @@ -133,8 +128,6 @@ extension SensorValueExtension on SensorValue { return "y (m/s²)"; case SensorValue.Gyroscope: return "y (º/s)"; - case SensorValue.Inclination: - return "pitch"; } } String getZLabel() { @@ -143,8 +136,6 @@ extension SensorValueExtension on SensorValue { return "z (m/s²)"; case SensorValue.Gyroscope: return "z (º/s)"; - case SensorValue.Inclination: - return "yaw"; } } } @@ -152,24 +143,20 @@ extension SensorValueExtension on SensorValue { class Finger { final Acceleration acc; final Gyro gyro; - final Inclination inclination; - Finger(this.acc, this.gyro, this.inclination); + Finger(this.acc, this.gyro); Finger.fromJson(Map json) : acc = Acceleration.fromJson(json['acc'] as Map), - gyro = Gyro.fromJson(json['gyro'] as Map), - inclination = Inclination.fromJson(json['inclination']as Map); + gyro = Gyro.fromJson(json['gyro'] as Map); Map toJson() => { 'acc': acc.toJson(), 'gyro': gyro.toJson(), - 'inclination': inclination.toJson(), }; Finger.fromList(List m): acc = Acceleration(m[0],m[1], m[2]), - gyro = Gyro(m[3],m[4], m[5]), - inclination = Inclination(m[6],m[7], m[8]); + gyro = Gyro(m[3],m[4], m[5]); Vector3 getSensorValues(SensorValue sensorName) { switch (sensorName) { @@ -177,8 +164,6 @@ class Finger { return acc; case SensorValue.Gyroscope: return gyro; - case SensorValue.Inclination: - return inclination; } } } @@ -234,31 +219,6 @@ class Gyro with Vector3 { double getZ() => z; } -class Inclination with Vector3 { - final double roll; - final double pitch; - final double yaw; - Inclination(this.roll, this.pitch, this.yaw); - - Inclination.fromJson(Map json) - : roll = json['roll'], pitch = json['pitch'], yaw = json['yaw']; - - Map toJson() => { - 'roll': roll, - 'pitch': pitch, - 'yaw': yaw, - }; - - @override - double getX() => roll; - - @override - double getY() => pitch; - - @override - double getZ() => yaw; -} - abstract class Vector3 { double getX(); double getY(); diff --git a/lib/pages/file_content_chart_page.dart b/lib/pages/file_content_chart_page.dart index 22bd043..3024d16 100644 --- a/lib/pages/file_content_chart_page.dart +++ b/lib/pages/file_content_chart_page.dart @@ -72,14 +72,6 @@ class _FileContentChartPageState extends State { sensor: SensorValue.Gyroscope, title: "Velocidad angular", legend: false)), - Expanded( - child: MeasurementsChart( - measurements: sensorMeasurements, - finger: FingerValue.values[_fingerChosen], - key: ValueKey(_fingerChosen), - sensor: SensorValue.Inclination, - title: "Inclinacion", - legend: true)) ], )), ))); @@ -191,8 +183,6 @@ class _MeasurementsChartState extends State { return Acceleration(m[0], m[1], m[2]); case SensorValue.Gyroscope: return Gyro(m[3], m[4], m[5]); - case SensorValue.Inclination: - return Inclination(m[6], m[7], m[8]); } } } From d1ad907d9945f2bf3a3b493285a5c19b020ef88e Mon Sep 17 00:00:00 2001 From: Jazmin Ferreiro Date: Fri, 21 Jan 2022 20:46:56 +0100 Subject: [PATCH 2/4] fix graphics --- lib/model/glove_measurement.dart | 2 +- lib/pages/file_content_chart_page.dart | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/model/glove_measurement.dart b/lib/model/glove_measurement.dart index 1b51800..9f2bc27 100644 --- a/lib/model/glove_measurement.dart +++ b/lib/model/glove_measurement.dart @@ -25,7 +25,7 @@ extension FingerValueTranslation on FingerValue { } class GloveMeasurement { - static const int measurementsNumber = 9; + static const int measurementsNumber = 6; static const String pinkyLetter = "P"; static const String ringLetter = "R"; static const String middleLetter = "M"; diff --git a/lib/pages/file_content_chart_page.dart b/lib/pages/file_content_chart_page.dart index 3024d16..15d3aa5 100644 --- a/lib/pages/file_content_chart_page.dart +++ b/lib/pages/file_content_chart_page.dart @@ -165,15 +165,15 @@ class _MeasurementsChartState extends State { List getFingerValues(List m) { switch (finger) { case FingerValue.Thumb: - return m.sublist(0, 9); + return m.sublist(0, 6); case FingerValue.Index: - return m.sublist(9, 18); + return m.sublist(6, 12); case FingerValue.Middle: - return m.sublist(18, 27); + return m.sublist(12, 18); case FingerValue.Ring: - return m.sublist(27, 36); + return m.sublist(18, 24); case FingerValue.Pinky: - return m.sublist(36); + return m.sublist(24); } } From f258d7b13579291646e57314224085e200f4bab5 Mon Sep 17 00:00:00 2001 From: Jazmin Ferreiro Date: Mon, 24 Jan 2022 22:33:10 +0100 Subject: [PATCH 3/4] fix finger order --- lib/datacollection/storage.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/datacollection/storage.dart b/lib/datacollection/storage.dart index 0850854..4772f2e 100644 --- a/lib/datacollection/storage.dart +++ b/lib/datacollection/storage.dart @@ -166,10 +166,11 @@ class SensorMeasurements { } List measurementList = []; measurementList.addAll(extractFingerMeasurement(gloveMeasurement.thumb)); - measurementList.addAll(extractFingerMeasurement(gloveMeasurement.pinky)); + measurementList.addAll(extractFingerMeasurement(gloveMeasurement.index)); measurementList.addAll(extractFingerMeasurement(gloveMeasurement.ring)); measurementList.addAll(extractFingerMeasurement(gloveMeasurement.middle)); - measurementList.addAll(extractFingerMeasurement(gloveMeasurement.index)); + measurementList.addAll(extractFingerMeasurement(gloveMeasurement.pinky)); + this.values.add(measurementList); this.timestamps.add(gloveMeasurement.timestampMillis); return true; From dadb74b4ac5f2769b2b2da6d9024cdc792772c39 Mon Sep 17 00:00:00 2001 From: Jazmin Ferreiro Date: Mon, 24 Jan 2022 23:37:33 +0100 Subject: [PATCH 4/4] fix finger order --- lib/datacollection/storage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datacollection/storage.dart b/lib/datacollection/storage.dart index 4772f2e..032f4f4 100644 --- a/lib/datacollection/storage.dart +++ b/lib/datacollection/storage.dart @@ -167,8 +167,8 @@ class SensorMeasurements { List measurementList = []; measurementList.addAll(extractFingerMeasurement(gloveMeasurement.thumb)); measurementList.addAll(extractFingerMeasurement(gloveMeasurement.index)); - measurementList.addAll(extractFingerMeasurement(gloveMeasurement.ring)); measurementList.addAll(extractFingerMeasurement(gloveMeasurement.middle)); + measurementList.addAll(extractFingerMeasurement(gloveMeasurement.ring)); measurementList.addAll(extractFingerMeasurement(gloveMeasurement.pinky)); this.values.add(measurementList);