Easy Training / Training

Dependents:   Easyfit

Revision:
0:0c6d1b9144af
Child:
1:aa8497b98ef4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/training.cpp	Tue Apr 28 12:58:54 2020 +0000
@@ -0,0 +1,78 @@
+/*
+Hear cold stand a discription
+
+
+*/
+
+
+#include "training.h"
+//#include "math.h"
+
+training::training()
+{
+    fail_pos = 0;
+    time_short = 0;
+    time_long = 0;
+
+}
+
+
+void training::load_training(string name)
+{
+    tr_name = name;
+    //loading.AuslesenPositionsdaten()
+    
+}
+
+void training::start_training(void)
+{
+    fail_pos = 0;
+    time_short = 0;
+    time_long = 0;
+    point_count = 0;
+    repet = 0;
+
+}
+
+void training::compire_point(float posx,float posy,float posz, int time)
+{
+    float temp_pos[3] = {};
+    float dist = 0, timediv = 0;
+
+    if(data_vec[point_count].start) {                                           // counts the repetitions
+        repet++;
+        
+    }
+
+    temp_pos[0] = posx - data_vec[point_count].pos[0];                          // calculates distance curent to needed
+    temp_pos[1] = posx - data_vec[point_count].pos[1];
+    temp_pos[2] = posx - data_vec[point_count].pos[2];
+
+    dist = sqrt(pow(temp_pos[0],2)+pow(temp_pos[1],2)+pow(temp_pos[2],2));
+
+    if(dist>= POSTOL) {                                                         // counts position fail
+        fail_pos++;
+    }
+
+    if(data_vec[point_count].end) {                                             // counts time too short and time too long
+        timediv = time - (data_vec[point_count].time);
+        if(timediv>=TIMETOL) {
+            time_long++;
+        }
+        if(timediv<=(-TIMETOL)) {
+            time_short++;
+        }
+    }
+    
+    point_count++;
+    
+    if(point_count>= data_vec.size()){                                          // resets the piontecount after a complet cycle
+        point_count = 0;
+        }
+
+}
+
+void training::end_training(void)
+{
+    // writhe status to memory / update memory
+}
\ No newline at end of file