Différences entre les versions de « Code (CDR2020) »

De Ares Wiki
Aller à la navigation Aller à la recherche
Ligne 15 : Ligne 15 :
##Début du match
##Début du match
#Compteur global
#Compteur global
= Fonction Asservissement =
== Programme Moteurs ==
<code>
= Fonction Initialisation_des_drivers=
Fonction Asservissement()
#Désactivation des moteurs
  Appel fonction odométrie
#Rotation du moteur gauche vers l'avant
  distanceCible
#Rotation du moteur droit vers l'avant
 
= Fonction Rotation du moteur gauche vers l'avant =
  Si y > yC
#Dirige le moteur gauche vers l'avant
      Alors signe = -1
= Fonction Rotation du moteur droit vers l'avant =
  Sinon signe = 1
#Dirige le moteur droit vers l'avant
 
= Fonction Rotation du moteur gauche vers l'arrière =
  Si (xC >= x)
#Dirige le moteur gauche vers l'arrière
        consigneOrientation = signe * acos((abs(xC-x))/distanceCible);
= Fonction Rotation du moteur droit vers l'arrière =
 
#Dirige le moteur droit vers l'arrière
    Sinon
        consigneOrientation = signe * (3.1415 - acos((abs(xC-x))/distanceCible));
 
  Selon l'action
      Cas 1 : Robot arrêté
          Appel fonction moteur_éteint
      Cas 2 : Rotation
          Appel fonction moteur_activé
          // Si on doit reculer
          Si (objRecule[indiceStrategie]==1)
            Alors consigneOrientation = consigneOrientation
+ 3.1415
          Si(consigneOrientation>3.1415)
            Alors consigneOrientation-=2*3.1415
          Si consigneOrientation<-3.1415
            Alors consigneOrientation+=2*3.1415
           
          // Choix du sens de rotation
          sens_orientation = 0
          Si orientation < 0
            Alors sens_orientation = orientation + 2.0f*3.1415f
          Sinon
            Alors sens_orientation = orientation
         
          sens_consigne = 0
          Si (orientation_consigne <0)
            Alors sens_consigne = orientation_consigne + (2.0f*3.1415f)
          Sinon
            Alors sens_consigne = orientation_consigne
 
          choix_sens = sens_consigne - sens_orientation
</code>

Version du 10 novembre 2020 à 16:27

Fonction Main

  1. Initialisation
    1. Drivers
    2. Codeurs
    3. Broches
    4. Pavillons
    5. Timers et tikers
    6. Capteurs à ultrasons
  2. Debug
    1. PC et Blutooth
  3. Choix de la statégie
    1. Bleu ou jaune
  4. Boucle infinie
    1. Le match n'a pas encore commencé
    2. Début du match
  5. Compteur global

Programme Moteurs

Fonction Initialisation_des_drivers

  1. Désactivation des moteurs
  2. Rotation du moteur gauche vers l'avant
  3. Rotation du moteur droit vers l'avant

Fonction Rotation du moteur gauche vers l'avant

  1. Dirige le moteur gauche vers l'avant

Fonction Rotation du moteur droit vers l'avant

  1. Dirige le moteur droit vers l'avant

Fonction Rotation du moteur gauche vers l'arrière

  1. Dirige le moteur gauche vers l'arrière

Fonction Rotation du moteur droit vers l'arrière

  1. Dirige le moteur droit vers l'arrière