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.
Diff: algorithme.h
- Revision:
- 5:73aac5fe9696
- Parent:
- 4:c393c14f4502
- Child:
- 6:9af875ef7b30
--- a/algorithme.h Wed Jun 05 22:55:03 2019 +0000
+++ b/algorithme.h Thu Jun 06 14:04:56 2019 +0000
@@ -28,7 +28,7 @@
// Paramètres de la voiture variable
-float voiture_angle = 0.0; // self.angle (angle du repère)
+float voiture_angle = 90.0; // self.angle (angle du repère)
float voiture_angle_roues = 0.0; // self.angleroues
float facteur_angle = 0.0;
@@ -43,7 +43,7 @@
float b;
bool compensation;
-float facteur_vitesse = pi*pi/(log(vitesse_max/0.5));
+float facteur_vitesse = 180/(log(vitesse_max/0.5));
float min(float a, float b){
// Fonction permettant de déterminer le minimum entre a et b
@@ -159,14 +159,14 @@
}
//On se ramène dans le repère général
- angleSuivreMini = voiture_angle + sauts[indiceSauts][0] - pi/2;
+ angleSuivreMini = voiture_angle + sauts[indiceSauts][0] - 180/2;
if (data_distances[sauts[indiceSauts][2]] == 0){ //On vérifie que l'on a pas de problemes
- angleSuivreSol = angleSuivreMini + pi/2;
+ angleSuivreSol = angleSuivreMini + 180/2;
}
else{
//On ne veut pas passer trop près du mur
- deltaAngle=min(pi/20,atan(largeur_voiture/data_distances[sauts[indiceSauts][2]]));
+ deltaAngle=min(180/20,atan(largeur_voiture/data_distances[sauts[indiceSauts][2]])*180/pi);
//On détermine le signe de la compensation (virage à droite ou gauche et repère général)
//On détermine les distances aux deux bords
int indPi2 = int(data_angles.size()/4) ;
@@ -210,7 +210,7 @@
sautsCara(sauts);
}
else{
- angleSuivreMini = voiture_angle - pi/2;
+ angleSuivreMini = voiture_angle - 180/2;
angleSuivreSol = angleSuivreMini;
compensation = false;
C = 10;
@@ -288,8 +288,8 @@
voiture_vitesse = calculVitesse(deltat);
voiture_angle_roues= calculAngle(deltat);
- facteur_angle = (angle_suivre-voiture_angle)*(1-exp(double( -1)));
- facteur_vitesse = (vitesse_suivre-voiture_vitesse)*(1-exp(double(-1)));
+ facteur_angle = (angle_suivre-voiture_angle)*(1-exp(double( -1/50)));
+ facteur_vitesse = (vitesse_suivre-voiture_vitesse)*(1-exp(double(-1/50)));
}