Projet

Général

Profil

« Précédent | Suivant » 

Révision 279

Ajouté par aueuphrasi il y a plus de 6 ans

Validation terrain_rouge

Voir les différences:

branch/euphrasie_auguste/Emb_App/programme_principal_etud.c
short commande_V;
unsigned short num_piste;
unsigned short cap_touch;
unsigned short coul_cap_touch;
unsigned short num_cap_touch;
unsigned short num_cap_touch_prec;
unsigned short nb_tour;
FLGPTN flag;
void main()
{
......
for(i=0;i<100;i++){ assser_tourelle(); dly_tsk(10);}
periph_command('T', 0);
while((periph_requete('M') >> 15) == 0 ) dly_tsk(50); // attente feux vert
nb_tour = 1;
periph_command('D', 0);
periph_command('V', 60);
dly_tsk(250);
......
asser_roue_vitesse();
capteur();
switch(cap_touch)
switch(coul_cap_touch)
{
case 86: //ligne droite
k_D = 1.0;
commande_V_max = 60;
distance_centre = 700; break;
distance_centre = 700;
break;
case 74 :
case 82 :
case 66 :
case 67 : //virage
k_D = 1.25;
commande_V_max = 40;
distance_centre = 800; break;
distance_centre = 800;
break;
default :
k_D = 1.25;
commande_V_max = 40;
distance_centre = 650; break;
}
distance_centre = 650;
break;
}
num_piste = (periph_requete('M') << 8) >> 8;
dly_tsk(50);
}
......
for(i=0;i<100;i++){ assser_tourelle(); dly_tsk(10);}
periph_command('T', 0);
while((periph_requete('M') >> 15) == 0 ) dly_tsk(50); // attente feux vert
nb_tour = 1;
periph_command('D', 0);
periph_command('V', 60);
dly_tsk(250);
......
asser_roue_vitesse();
capteur();
switch(cap_touch)
switch(coul_cap_touch)
{
case 86: //ligne droite
k_D = 1.3;
commande_V_max = 50;
distance_centre = 500; break;
commande_V_max = 65;
distance_centre = 500;
break;
case 74 :
case 82 :
case 66 :
case 67 : //virage
k_D = 1.4;
k_D = 1.75;
commande_V_max = 25;
distance_centre = 500; break;
default :
......
for(i=0;i<100;i++){ assser_tourelle(); dly_tsk(10);}
periph_command('T', 0);
while((periph_requete('M') >> 15) == 0 ) dly_tsk(50); // attente feux vert
nb_tour = 1;
while((num_piste == 3) || (num_piste == 7)){
assser_tourelle();
asser_roue_vitesse();
capteur();
switch(cap_touch)
switch(coul_cap_touch)
{
case 86: //ligne droite
k_D = 1.0;
commande_V_max = 100;
distance_centre = 500;
k_D = 1.3;
distance_centre = 500;
commande_V_max = 45;
if(num_cap_touch == 3){ //saut
commande_V_max = 45;
k_D = 0.8;
}
else{commande_V_max = 45;}
break;
case 74 :
case 82 :
case 66 :
case 67 : //virage
k_D = 1.25;
commande_V_max = 15;
distance_centre = 500;
k_D = 1.75;
distance_centre = 500;
if(num_cap_touch == 3){commande_V_max = 10;} //saut
else{commande_V_max = 25;}
break;
default :
k_D = 1.0;
commande_V_max = 100;
distance_centre = 500; break;
}
k_D = 1.3;
commande_V_max = 50;
distance_centre = 500;
break;
}
num_piste = (periph_requete('M') << 8) >> 8;
dly_tsk(50);
}
......
for(i=0;i<100;i++){ assser_tourelle(); dly_tsk(10);}
periph_command('T', 0);
while((periph_requete('M') >> 15) == 0 ) dly_tsk(50); // attente feux vert
nb_tour = 1;
while((num_piste == 4) || (num_piste == 8)){
......
}
}
void capteur(void){
cap_touch = (periph_requete('C') >> 8);
coul_cap_touch = (periph_requete('C') >> 8);
num_cap_touch_prec = num_cap_touch;
num_cap_touch = (periph_requete('C') & 0x00FF);
if((num_cap_touch == 5) && (num_cap_touch != num_cap_touch_prec)){ nb_tour++; }
}
void decode_int(void){
//short i = 0;
//while(touche != '#'){
......
//}
}
void asser_roue_vitesse(void){
dist_mur_droit = periph_requete('U')*sin((3.1415f*(periph_requete('R')))/1800.0f);
if((dist_mur_droit > 1500) || (dist_mur_droit < -1500)){ dist_mur_droit = distance_centre;} //filtre valeurs aberantes pour trous
commande_D = k_D * (dist_mur_droit - distance_centre);
if(commande_D < -450) commande_D = -450;
if(commande_D > 450) commande_D = 450;
periph_command('D', commande_D);
if(commande_D < 0) commande_D = commande_D * (-1);
//commande_V = commande_V_max - (k_V * (commande_D/10));
//if(commande_V < 0) commande_V = commande_V * (-1);
if(Bp_D == 1){commande_V_max = 0;}
periph_command('V', commande_V_max);
}
void initialisation(void){
ports_mcu();
lcd_init();
......
void acqui()
{
LED_V=!LED_V;
//consigne_T = ad00;
//commande_V_max = ad01/10;
}
void assser_tourelle(void){

Formats disponibles : Unified diff