Easy Training / Mbed 2 deprecated Teach_demo

Dependencies:   mbed Teach memory

Files at this revision

API Documentation at this revision

Comitter:
MarcelPortmann
Date:
Tue Apr 28 13:36:51 2020 +0000
Parent:
3:b22580585b9c
Commit message:
sdcvsdvc;

Changed in this revision

Memory_def.lib Show diff for this revision Revisions of this file
Teach.lib Show annotated file Show diff for this revision Revisions of this file
memory.lib Show annotated file Show diff for this revision Revisions of this file
teach.cpp Show diff for this revision Revisions of this file
teach.h Show diff for this revision Revisions of this file
--- a/Memory_def.lib	Mon Apr 27 05:07:00 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/Easy-Training/code/Memory_def/#a70b9c34ae10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Teach.lib	Tue Apr 28 13:36:51 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Easy-Training/code/Teach/#c203f964c949
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memory.lib	Tue Apr 28 13:36:51 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Easy-Training/code/memory/#85595af0a93b
--- a/teach.cpp	Mon Apr 27 05:07:00 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-/*
-Hear cold stand a discription
-
-*/
-
-
-#include "teach.h"
-
-
-teach::teach(void)                          // constructor
-{
-
-    lowcount = 0, highcount = 0;            //sets startvalue
-    data_vec.clear();
-}
-
-void teach::setstart(float posx,float posy,float posz, int time)
-{
-    lowcount = 0;
-
-    temp.start = true;
-    temp.end = false;
-    temp.hi = highcount;
-    temp.low = lowcount;
-    temp.time = time;
-    temp.pos[0] = posx;
-    temp.pos[1] = posy;
-    temp.pos[2] = posz;
-    data_vec.push_back(temp);
-
-    lowcount++;
-    highcount++;
-
-    contr_sice();
-}
-
-void teach::setpoint(float posx,float posy,float posz, int time)
-{
-    lowcount++;
-
-    temp.start = false;
-    temp.end = false;
-    temp.hi = highcount;
-    temp.low = lowcount;
-    temp.time = time;
-    temp.pos[0] = posx;
-    temp.pos[1] = posy;
-    temp.pos[2] = posz;
-    data_vec.push_back(temp);
-
-    contr_sice();
-}
-
-void teach::setend(float posx,float posy,float posz, int time)
-{
-    temp.start = false;
-    temp.end = true;
-    temp.hi = highcount;
-    temp.low = lowcount;
-    temp.time = time;
-    temp.pos[0] = posx;
-    temp.pos[1] = posy;
-    temp.pos[2] = posz;
-    data_vec.push_back(temp);
-
-    lowcount = 0;
-    highcount++;
-
-    contr_sice();
-}
-
-void teach::save(string name)
-{   tr_name = name;
-    store.ErstellenDatenblock(tr_name);
-    process();
-    
-}
-
-void teach::stop(void)
-{
-
-}
-
-void teach::process(void)
-{
-    int i=0, k=0, p=0, count=0,forward = 100000, backward = 100000;
-    float tempsum[3] = {};
-    int max = data_vec.size();
-
-    for(i=0; i<=max; i++) {                                                     // avrage starting Point
-        if(data_vec[i].start) {
-            tempsum[0] += data_vec[i].pos[0];
-            tempsum[1] += data_vec[i].pos[1];
-            tempsum[2] += data_vec[i].pos[2];
-            k++;
-        }
-    }
-    tempsum[0] = tempsum[0]/k;
-    tempsum[1] = tempsum[1]/k;
-    tempsum[2] = tempsum[2]/k;
-
-    float empty[3] = {0,0,1};                                                   // status: 000 standart point
-    store.SpeichernPosition(tr_name,0,tempsum,empty,empty);                     //         001 start point
-                                                                                //         010 end point                  
-
-    i = 0, k = 0, tempsum[0] = 0, tempsum[1] = 0, tempsum[2] = 0;               // reset counters
-
-    for(i=0; i<=max; i++) {                                                     // avrage end Point
-        if(data_vec[i].end) {
-            tempsum[0] += data_vec[i].pos[0];
-            tempsum[1] += data_vec[i].pos[1];
-            tempsum[2] += data_vec[i].pos[2];
-            k++;
-        }
-    }
-    tempsum[0] = tempsum[0]/k;
-    tempsum[1] = tempsum[1]/k;
-    tempsum[2] = tempsum[2]/k;
-
-    // save endpoint to memory
-
-    i = 0, k = 0, tempsum[0] = 0, tempsum[1] = 0, tempsum[2] = 0;               // reset counters
-
-    for(i=0; i<=max; i++) {                                                     // forward point number
-
-        while(!data_vec[k].end) {
-            count++;
-            k++;
-        }
-
-        if(count<forward) {
-            forward = count;
-        }
-        while(!data_vec[k].start) {
-            k++;
-        }
-        i = k;
-        count = 0;
-
-    }
-
-    k = 0;
-    for(i=0; i<=max; i++) {                                                   // backward point number
-
-        while(!data_vec[k].end) {
-            k++;
-        }
-
-        while(!data_vec[k].start) {
-            count++;
-            k++;
-        }
-        if(count<backward) {
-            backward = count;
-        }
-        i = k;
-        count = 0;
-
-    }
-
-    k = 0;
-    struct temp_arry forw[forward];                                         // temp array initialise and zerowing
-    for(i=0; i<forward; i++) {
-        forw[i].time=0;
-        forw[i].pos[0]=0;
-        forw[i].pos[1]=0;
-        forw[i].pos[2]=0;
-    }
-
-    for(i=0; i<=max; i++) {                                                 // avrage forward points
-        for(p=0; p<=forward; p++) {
-            forw[p].time += data_vec[k].time;
-            forw[p].pos[0] += data_vec[k].pos[0];
-            forw[p].pos[1] += data_vec[k].pos[1];
-            forw[p].pos[2] += data_vec[k].pos[2];
-            k++;
-        }
-
-        while(!data_vec[k].start) {
-            k++;
-        }
-        i = k;
-        count++;
-
-    }
-    for(i=0; i<=forward; i++) {
-        forw[i].time = (forw[i].time)/count;
-        forw[i].pos[0] = (forw[i].pos[0])/count;
-        forw[i].pos[1] = (forw[i].pos[1])/count;
-        forw[i].pos[2] = (forw[i].pos[2])/count;
-    }
-    count = 0;
-    k = 0, i = 0, p = 0;                                                    // reset counters
-    
-    // Save forward way to memory
-
-    struct temp_arry backw[backward];                                       // temp array initialise and zerowing
-    for(i=0; i<backward; i++) {
-        backw[i].time=0;
-        backw[i].pos[0]=0;
-        backw[i].pos[1]=0;
-        backw[i].pos[2]=0;
-    }
-
-    for(i=0; i<=max; i++) {                                                 // avrage backward points
-    
-        while(!data_vec[k].end) {
-            k++;
-        }
-
-        for(p=0; p<=backward; p++) {
-            backw[p].time += data_vec[k].time;
-            backw[p].pos[0] += data_vec[k].pos[0];
-            backw[p].pos[1] += data_vec[k].pos[1];
-            backw[p].pos[2] += data_vec[k].pos[2];
-            k++;
-        }
-        i = k;
-        count++;
-    }
-    
-    for(i=0; i<=backward; i++) {
-        backw[i].time = (backw[i].time)/count;
-        backw[i].pos[0] = (backw[i].pos[0])/count;
-        backw[i].pos[0] = (backw[i].pos[0])/count;
-        backw[i].pos[0] = (backw[i].pos[0])/count;
-    }
-    count = 0;
-    k = 0, i = 0, p = 0;                                                       // reset counters
-    
-    // save backward way to memory
-
-}
-
-void teach::temp_store()
-{
-
-}
-
-void teach::contr_sice()
-{
-    if((data_vec.size()*sizeof(posdata)) >= MAX_SIZE) {
-        // fehlermeldung oder speichern bei zu grossem temp speicher
-    }
-}
\ No newline at end of file
--- a/teach.h	Mon Apr 27 05:07:00 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-teach function:
-Class to aquier new tranings for the EasyFit Device.
-It Records a position in the 3d room and puts the them in serie to create a "hose" to
-be repeated in the mode Training.
-
-when questions ask someone else
-the autor is not responsible for any spelling mistakes
-
-*/
-#include <vector>
-#include "mbed.h"
-#include "memory.h"
-
-#ifndef teach_H                                         // no idea what this does
-#define teach_H                                         // seems important
-
-#define MAX_SIZE 500000000                              // maximal usebal flash befor error
-
-struct posdata{
-    int time;
-    int hi, low;
-    bool end, start;
-    float pos[3];
-};
-
-struct temp_arry{
-    int time;
-    float pos[3];
-};
-
-
-
-class teach
-{
-public:
-    teach(void);                                                // Sets all parameters for the class teach constructor
-    
-                    
-    //functions to be used outside of class
-    void setstart(float posx,float posy,float posz, int time); // creates a temporary begin of line point       
-    void setpoint(float posx,float posy,float posz, int time); // creates a temporary position point
-    void setend(float posx,float posy,float posz, int time);   // creates a temporary end of line point
-    void save(string name);                                    // wen calld from main stores the whole training in memory
-    void stop(void);                                           // deleats all temp data and resets counters/pointers
-    
-private:
-    std::vector<posdata> data_vec;                       // Vektor mit allen datenpunkten 
-    int  highcount,lowcount;                             // Counters for data recording
-    void temp_store(void);                               // Stors data temporary; Data==Pointer to a Data Array (position(x,y,z),time)
-    void process(void);                                  // rounds the houses to trainings
-    void contr_sice(void);                               // controlls the sice of temp array
-    struct posdata temp;                                 // temporary data storage
-    memory store;                                        // store and load data from memory
-    string tr_name;
-    
-    // objekte von display,memory,position               // für interaktion mit anderen Klassen
-    
-};
-
-#endif
-    
-    
-    
-    
-    
\ No newline at end of file