Skip to content

Commit

Permalink
Merge pull request #50 from Gloveland/remove_inclination
Browse files Browse the repository at this point in the history
Remove inclination
  • Loading branch information
jazminsofiaf authored Jan 27, 2022
2 parents 029f96c + dadb74b commit 079f4fd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 107 deletions.
10 changes: 4 additions & 6 deletions lib/datacollection/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ class SensorMeasurements {
}
List<double> measurementList = [];
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.thumb));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.pinky));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.ring));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.middle));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.index));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.middle));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.ring));
measurementList.addAll(extractFingerMeasurement(gloveMeasurement.pinky));

this.values.add(measurementList);
this.timestamps.add(gloveMeasurement.timestampMillis);
return true;
Expand All @@ -183,9 +184,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;
}

Expand Down
41 changes: 0 additions & 41 deletions lib/edgeimpulse/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,49 +73,34 @@ 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"),
SensorParameter("indexAccZ", "m/s2"),
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"),
SensorParameter("middleAccZ", "m/s2"),
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"),
SensorParameter("ringAccZ", "m/s2"),
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"),
SensorParameter("pinkyAccZ", "m/s2"),
SensorParameter("pinkyGyroX", "deg"),
SensorParameter("pinkyGyroY", "deg"),
SensorParameter("pinkyGyroZ", "deg"),
SensorParameter("pinkyRoll", "deg"),
SensorParameter("pinkyPitch", "deg"),
SensorParameter("pinkyYaw", "deg"),
];
}

Expand Down Expand Up @@ -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;
Expand Down
50 changes: 5 additions & 45 deletions lib/model/glove_measurement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -101,8 +101,7 @@ class GloveMeasurement {

enum SensorValue {
Acceleration,
Gyroscope,
Inclination
Gyroscope
}

extension SensorValueExtension on SensorValue {
Expand All @@ -112,8 +111,6 @@ extension SensorValueExtension on SensorValue {
return "Acelerómetro";
case SensorValue.Gyroscope:
return "Giroscopio";
case SensorValue.Inclination:
return "Inclinación";
}
}

Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -143,42 +136,34 @@ extension SensorValueExtension on SensorValue {
return "z (m/s²)";
case SensorValue.Gyroscope:
return "z (º/s)";
case SensorValue.Inclination:
return "yaw";
}
}
}

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<String, dynamic> json)
: acc = Acceleration.fromJson(json['acc'] as Map<String, dynamic>),
gyro = Gyro.fromJson(json['gyro'] as Map<String, dynamic>),
inclination = Inclination.fromJson(json['inclination']as Map<String, dynamic>);
gyro = Gyro.fromJson(json['gyro'] as Map<String, dynamic>);
Map<String, dynamic> toJson() => {
'acc': acc.toJson(),
'gyro': gyro.toJson(),
'inclination': inclination.toJson(),
};

Finger.fromList(List<double> 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) {
case SensorValue.Acceleration:
return acc;
case SensorValue.Gyroscope:
return gyro;
case SensorValue.Inclination:
return inclination;
}
}
}
Expand Down Expand Up @@ -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<String, dynamic> json)
: roll = json['roll'], pitch = json['pitch'], yaw = json['yaw'];

Map<String, dynamic> 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();
Expand Down
20 changes: 5 additions & 15 deletions lib/pages/file_content_chart_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ class _FileContentChartPageState extends State<FileContentChartPage> {
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))
],
)),
)));
Expand Down Expand Up @@ -173,15 +165,15 @@ class _MeasurementsChartState extends State<MeasurementsChart> {
List<double> getFingerValues(List<double> 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);
}
}

Expand All @@ -191,8 +183,6 @@ class _MeasurementsChartState extends State<MeasurementsChart> {
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]);
}
}
}
Expand Down

0 comments on commit 079f4fd

Please sign in to comment.