asservissement robot 2, C++, doc fournie

Dependencies:   mbed QEI L298 Asservissement

Files at this revision

API Documentation at this revision

Comitter:
hamaint
Date:
Wed Mar 20 00:28:46 2019 +0000
Parent:
1:11cbd2bf65d7
Commit message:
version shlag mais c++ en mode bg;

Changed in this revision

Asservissement.lib Show annotated file Show diff for this revision Revisions of this file
L298.lib Show annotated file Show diff for this revision Revisions of this file
Moteur.cpp Show diff for this revision Revisions of this file
Moteur.h Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Asservissement.lib	Wed Mar 20 00:28:46 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Polybot-Grenoble/code/Asservissement/#3827dab9a2eb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/L298.lib	Wed Mar 20 00:28:46 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Polybot-Grenoble/code/L298/#e6ed3d459a99
--- a/Moteur.cpp	Tue Mar 19 19:24:04 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#include "Moteur.h"
-
-
-#define PERIODE_PWM_MOTEUR 0.001
-
-PwmOut mypwm_a(D6);
-PwmOut mypwm_b(D11);
-
-DigitalOut in1(D7);
-DigitalOut in2(D8);
-DigitalOut in3(D9);
-DigitalOut in4(D10);
-
-
-
-void moteur_init()
-{
-    mypwm_a.period(PERIODE_PWM_MOTEUR);
-    mypwm_b.period(PERIODE_PWM_MOTEUR);
-    mypwm_a.pulsewidth(0);
-    mypwm_b.pulsewidth(0);
-}
-
-void moteur_a(float percent)
-{
-
-    if (percent>=0) {
-        in1 = 1;
-        in2 = 0;
-    } else {
-        in1 = 0;
-        in2 = 1;
-        percent = -1 * percent;
-    }
-    mypwm_a.pulsewidth((float)percent*(float)PERIODE_PWM_MOTEUR);
-}
-
-void moteur_b(float percent)
-{
-
-    if (percent>=0) {
-        in4 = 1;
-        in3 = 0;
-    } else {
-        in4 = 0;
-        in3 = 1;
-        percent = -1 * percent;
-    }
-
-    mypwm_b.pulsewidth((float)percent*(float)PERIODE_PWM_MOTEUR);
-}
--- a/Moteur.h	Tue Mar 19 19:24:04 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#ifndef MOTEUR_H
-#define MOTEUR_H
-
-#include "mbed.h"
-
-void moteur_init();
-void moteur_a(float percent);
-void moteur_b(float percent);
-
-#endif
\ No newline at end of file
--- a/main.cpp	Tue Mar 19 19:24:04 2019 +0000
+++ b/main.cpp	Wed Mar 20 00:28:46 2019 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
 #include "QEI.h"
-#include "Moteur.h"
+#include "L298.h"
 #include "math.h"
 
 Serial pc(SERIAL_TX,SERIAL_RX);
@@ -40,6 +40,8 @@
 float PID(float erreur,float type);
  
 int main() {
+    
+    L298 pontH();
 
     float distance = 0;
     float orientation_deg = 90;
@@ -64,9 +66,7 @@
     
     float orientation_dist = orientation_deg * (float)DISTANCE_ENTRE_ROUES * 3.14 / 360;
     
-    printf("%f\n\r",orientation_dist);
-    
-    moteur_init();
+    //moteur_init();
     
     while(1)
     {
@@ -102,8 +102,8 @@
             n_commande_b = -LIMITE_VITESSE;
             
         
-        moteur_a(n_commande_a);
-        moteur_b(n_commande_b);
+        //moteur_a(n_commande_a);
+        //moteur_b(n_commande_b);
         wait(FREQ_CORRECTION);     
         
     }
--- a/mbed.bld	Tue Mar 19 19:24:04 2019 +0000
+++ b/mbed.bld	Wed Mar 20 00:28:46 2019 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file