Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
training.cpp
- Committer:
- MarcelPortmann
- Date:
- 2020-04-28
- Revision:
- 0:0c6d1b9144af
- Child:
- 1:aa8497b98ef4
File content as of revision 0:0c6d1b9144af:
/*
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
}