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: main.cpp
- Revision:
- 2:7de884ffc9d9
- Parent:
- 1:b44f69eb07c4
- Child:
- 3:3bc2882232a6
diff -r b44f69eb07c4 -r 7de884ffc9d9 main.cpp
--- a/main.cpp Thu Apr 15 06:44:26 2021 +0000
+++ b/main.cpp Thu Apr 15 07:24:07 2021 +0000
@@ -15,6 +15,10 @@
// valeur de Te
float tems = 10;
+// variable asserv position
+float erreurPosition, erreurPosition_p, consignePosition = 0;
+float KPP = 0.001;
+
// varailble necessire à la mesure de la position angulaire du gyropode
float accelero[3]= {0};
float gyro[3] = {0};
@@ -144,6 +148,19 @@
/**********************************************************************************************/
+ /* Asserv Position */
+ /**********************************************************************************************/
+
+ erreurPosition = consignePosition - (g-d);
+ CommandeVitesse = KPP * (erreurPosition-erreurPosition_p);
+ erreurPosition_p = erreurPosition;
+
+ if (CommandeVitesse>3) CommandeVitesse = 3;
+ else if (CommandeVitesse < -3) CommandeVitesse = -3;
+
+
+
+ /**********************************************************************************************/
/* Asserv Vitesse */
/**********************************************************************************************/