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.
Dependencies: mbed X_NUCLEO_IHM02A1
Diff: odometrie.cpp
- Revision:
- 1:0690cf83f060
- Parent:
- 0:6ca63d45f0ee
- Child:
- 2:977799d72329
--- a/odometrie.cpp Tue Dec 11 19:12:55 2018 +0000
+++ b/odometrie.cpp Wed Dec 12 20:03:07 2018 +0000
@@ -66,7 +66,7 @@
angle += dep_roue_D * 2 / ECART_ROUE;
}
- angle = borne_angle(angle);
+ angle = borne_angle_r(angle);
x_actuel = (int) (cx + R * sin(angle) + 0.5);
y_actuel = (int) (cy - R * cos(angle) + 0.5);
@@ -76,20 +76,9 @@
y_actuel += (int) (dep_roue_D * sin(angle) + 0.5);
}
- printf("tick d : %d, tick g : %d, x : %d, y : %d. angle : %lf\n", nbr_tick_D, nbr_tick_G, x_actuel, y_actuel, angle*180/3.14);
+ printf("tick d : %d, tick g : %d, x : %d, y : %d. angle : %lf\n", nbr_tick_D, nbr_tick_G, x_actuel, y_actuel, angle*180/PI);
}
-double borne_angle(double angle)
-{
- if (angle > 3.14) {
- angle -= 2*3.14;
- }
- else if (angle <= -3.14) {
- angle += 2*3.14;
- }
- return angle;
-}
-
long int get_x_actuel()
{
return x_actuel;
@@ -102,5 +91,5 @@
double get_angle()
{
- return angle*180/3.14;
+ return angle*180/PI;
}
\ No newline at end of file