private void DetectionCycle(PositionDataModel positions, List <ExerciceEvaluation> exoEvalList, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement ef = (ExerciceMouvement)exoEvalList[0]; if (ef.TypeDroite == DroiteType.Vertical)//Target { Target ExMvtsRythmiques = (Target)exoEvalList[0]; ExMvtsRythmiques.DecoupeCycle(positions, ref exoEvalList, ref ValeurReeducation, ref tempData, ref dectectINIT); } else if (ef.TypeDroite == DroiteType.VerticalLong)//FreeAmplitude { Init(positions, XINIT, YINITFREEAMP, DISTFREEAMP, ref tempData); longdroitetrou = true; } } else if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Forme)//Ex de type Forme { ExerciceForme exF = (ExerciceForme)exoEvalList[0]; if (exF.TypeForme == FormeType.Cercle) { Init(positions, XINIT, YINITCERCLE, DIST, ref tempData); longdroitetrou = true; } else if (exF.TypeForme == FormeType.Carré) { Init(positions, XINIT, YINITCARRE, DIST, ref tempData); longdroitetrou = true; carreCycle = true; } } }
public void DataAfterEvaluation(ref List <ExerciceEvaluation> exoEvalList, ref ExerciceEvaluation exo, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { tempDataFilted = new List <DataPosition>(); if (tempData.Count != 0) { VitMoy = 0.0; resultDist = 0.0; Stra = 0.0; SpeedMet = 0.0; JerkM = 0.0; Ampli = 0.0; Presi = 0.0; VitMax = 0.0; //Filtres tempDataFilted = FiltreSurDonnees(exoEvalList, tempDataFilted, ref ValeurReeducation, ref tempData); //Calculs Calculs(exoEvalList, tempDataFilted, ref ValeurReeducation); if (cycleInfo == cycleTot) // Vérifier si la moyenne est complète + RAZ pour next cycle { CalculMoyennes(); //On calcule les moyennes if (exoEvalList[0].TypeExercice == ExerciceTypes.Evaluation) { if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Forme) { ExerciceForme ef = (ExerciceForme)exoEvalList[0]; if (ef.TypeForme == FormeType.Carré) { exo = new Square(cycleTot, VitMoy, tabVitMoy, VitMax, tabVitMax, SpeedMet, tabSpeedMet, JerkM, tabJerkM, Presi, tabPresi); } else { exo = new Circle(cycleTot, VitMoy, tabVitMoy, VitMax, tabVitMax, SpeedMet, tabSpeedMet, JerkM, tabJerkM, Presi, tabPresi); } } else { ExerciceMouvement ef = (ExerciceMouvement)exoEvalList[0]; if (ef.TypeDroite == DroiteType.VerticalLong)//FreeAmpl { exo = new FreeAmplitude(cycleTot, VitMoy, tabVitMoy, VitMax, tabVitMax, SpeedMet, tabSpeedMet, JerkM, tabJerkM, Stra, tabStra, Ampli, tabCoordYMax); } else { exo = new Target(cycleTot, VitMoy, tabVitMoy, VitMax, tabVitMax, SpeedMet, tabSpeedMet, JerkM, tabJerkM, Stra, tabStra, Presi, tabPresi); } } } CleanCycle(ref tempData); //On clean le cycle } } }
private void Calculs(List <ExerciceEvaluation> exoEvalList, List <DataPosition> tempDataFilted, ref SingletonReeducation ValeurReeducation) { //Calculs tabVitMoy[cycleInfo] = Ax_Vitesse.VitesseMoy(tempDataFilted, ref VitMax, 0.008); // Calc de la vitesse moyenne tabVitMax[cycleInfo] = VitMax; tabJerkM[cycleInfo] = Ax_Vitesse.JerkMet(tempDataFilted, VitMax, 0.008); // Calc du Jerk tabResultDist[cycleInfo] = Ax_Position.Distance(tempDataFilted); // Calc de la distance réelle tabDoub[0] = tabResultDist[cycleInfo]; double ampStrain = 0.0; double coordYMax = 0.0; if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement ef1 = (ExerciceMouvement)exoEvalList[0]; if (ef1.TypeDroite == DroiteType.VerticalLong) //FreeAmplitude { ampStrain = FreeAmplitude.CalAmpliFree(tempDataFilted, ref coordYMax); // special aller/retour :p tabCoordYMax[cycleInfo] = coordYMax; tabStra[cycleInfo] = Ax_Position.Straightness(ampStrain, tabDoub); // Calc de la Straightness } else if (ef1.TypeDroite == DroiteType.Vertical) { ampStrain = Target.CalAmpli(tempDataFilted); // Calc de l'amplitude tabStra[cycleInfo] = Ax_Position.Straightness(ampStrain, tabDoub); // Calc de la Straightness tabPresi[cycleInfo] = Target.PresciTarget(tempDataFilted); // calc precision target droite } } else if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Forme) { ExerciceForme ef = (ExerciceForme)exoEvalList[0]; if (ef.TypeForme == FormeType.Cercle) { DataPosition centre = new DataPosition(XCENTRE, YCENTRE); // 37.0 46.0 double Rayon = 4.0; tabPresi[cycleInfo] = Circle.PreciCercle(tempDataFilted, centre, Rayon); } else { DataPosition centre = new DataPosition(XCENTRE, YCENTRE); double longCot = 6.0, Orientation = 0.0; tabPresi[cycleInfo] = Square.PreciCarre(tempDataFilted, centre, longCot, Orientation); } } tabSpeedMet[cycleInfo] = tabVitMoy[cycleInfo] / tabVitMax[cycleInfo]; // Calc de la Speed Metrique cycleInfo++; }
private List <DataPosition> FiltreSurDonnees(List <ExerciceEvaluation> exoEvalList, List <DataPosition> tempDataFilted, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData) { //Filtres sur les données en entrées if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement ef = (ExerciceMouvement)exoEvalList[0]; if (ef.TypeDroite == DroiteType.Vertical) //target { tempDataFilted = Ax_Filter.Filtre125Hz(postTempData); } else { TraitementFiltre(ref tempDataFilted); } } else { TraitementFiltre(ref tempDataFilted); } //On supprime les positions en trop tempDataFilted.RemoveRange(0, 10); if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement ef = (ExerciceMouvement)exoEvalList[0]; if (ef.TypeDroite == DroiteType.Vertical) { if (tempDataFilted.Count >= 50) { tempDataFilted.RemoveRange((tempDataFilted.Count - 50), 50); } ValeurReeducation.StartStop = true; tempData.Clear(); } else { tempDataFilted.RemoveRange((tempDataFilted.Count - 10), 10); } } else { tempDataFilted.RemoveRange((tempDataFilted.Count - 10), 10); } return(tempDataFilted); }
public static FrameExerciceDataModel ExercicesEvaluationToFrameExercice(ExerciceEvaluation exercice, int i) { FrameExerciceDataModel _exFrame = new FrameExerciceDataModel(); if (exercice.TypeEval == ExerciceEvalTypes.Forme) { ExerciceForme temps = (ExerciceForme)exercice; _exFrame.Address = ConfigAddresses.Formes; switch (temps.TypeForme) // polygones { case FormeType.Carré: _exFrame.Data1 = 0x04; break; case FormeType.Cercle: _exFrame.Data1 = 0x28; // 0x1E break; case FormeType.Triangle: _exFrame.Data1 = 0x06; // Hexagone break; } _exFrame.Data2 = (byte)(4 * temps.Taille); _exFrame.Data3 = temps.Origine; // TODO : peut etre ? _exFrame.Data4 = Convert.ToByte(temps.AllerRetour); } else { //if (exercice.Exercice[i].ExerciceType == ExerciceTypes.Cibles) //{ // ExerciceXDent temps = (ExerciceXDent)exercice.Exercice[i]; // _exFrame.Address = ConfigAddresses.Cibles; // _exFrame.Data1 = temps.NbrsCibles; // _exFrame.Data2 = temps.DistCibles; // _exFrame.Data3 = temps.Anglecible; // //_exFrame.Data4 = temps.Origine; // TODO : peut etre ? ////} //else //{ //if (exercice.TypeExercice == ExerciceTypes.Mouvements_Complexes) //{ // ExerciceMouvement temps = (ExerciceMouvement)exercice.Exercice[i]; // _exFrame.Address = ConfigAddresses.Mouvements; // switch (temps.DroiteType) // { // case DroiteType.Horizontal: _exFrame.Data1 = 0x02; // break; // case DroiteType.Oblique: _exFrame.Data1 = 0x03; // break; // case DroiteType.Vertical: _exFrame.Data1 = 0x01; // break; // default: _exFrame.Data1 = 0x01; // TODO : Erreur ! // break; // } // _exFrame.Data2 = temps.PositionDroite; //} //else //{ if (exercice.TypeEval == ExerciceEvalTypes.Mouvement) { ExerciceMouvement temps = (ExerciceMouvement)exercice; _exFrame.Address = ConfigAddresses.Mouvements; // TODO : faire un mod spécifique ! switch (temps.TypeDroite) { case DroiteType.Vertical: _exFrame.Data1 = 0x01; break; case DroiteType.VerticalLong: _exFrame.Data1 = 0x04; break; case DroiteType.Tonus: _exFrame.Data1 = 0x05; // TONUS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! break; default: _exFrame.Data1 = 0x01; // TODO : Erreur ! break; } _exFrame.Data2 = temps.PositionDroite; } else { // TODO : Erreur ! } //} //} } return(_exFrame); }