Time is good

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Files at this revision

API Documentation at this revision

Comitter:
IceTeam
Date:
Sun Jan 31 16:11:32 2016 +0000
Parent:
35:4e3d9ab1b94b
Child:
37:da3a2c781672
Child:
38:a17f8a61bc0d
Commit message:
sauvegarde

Changed in this revision

Map/Map.cpp Show annotated file Show diff for this revision Revisions of this file
Odometry/Odometry.cpp Show annotated file Show diff for this revision Revisions of this file
Odometry/Odometry.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Map/Map.cpp	Tue Jan 26 17:21:11 2016 +0000
+++ b/Map/Map.cpp	Sun Jan 31 16:11:32 2016 +0000
@@ -68,7 +68,9 @@
     obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P13,1750,3000-90,30));// P13
     obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P14,1850,3000-90,30));// P14
     obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P15,1770,3000-1100,30));// P15*/
-    obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P16,700,1000,1));// P16
+    obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P16,700,1000,30));// P16
+    obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P15,1100,600,30));// P16
+    obstacles.push_back(new Obs_circle(ROBOTRADIUS,IDO_P15,900,800,50));// P16
 }
 
 int Map::getHeight(float x, float y)
--- a/Odometry/Odometry.cpp	Tue Jan 26 17:21:11 2016 +0000
+++ b/Odometry/Odometry.cpp	Sun Jan 31 16:11:32 2016 +0000
@@ -73,18 +73,18 @@
         x = xO + R*sin(theta);
         y = yO - R*cos(theta);
     }*/
+    
+    
+    
+    double dx = deltaS*cos(theta+deltaTheta/2);
+    double dy = deltaS*sin(theta+deltaTheta/2);
+    x += dx;
+    y += dy;
+    
     theta += deltaTheta;
     while(theta > PI) theta -= 2*PI;
     while(theta <= -PI) theta += 2*PI;
     
-    
-    double dx = deltaS*cos(theta-deltaTheta/2);
-    double dy = deltaS*sin(theta-deltaTheta/2);
-    x += dx;
-    y += dy;
-    
-
-    
 }
 
 void Odometry::GotoXY(double x_goal, double y_goal)
--- a/Odometry/Odometry.h	Tue Jan 26 17:21:11 2016 +0000
+++ b/Odometry/Odometry.h	Sun Jan 31 16:11:32 2016 +0000
@@ -8,9 +8,9 @@
 #define C 1.0
 
 /* Vitesse d'acceleration d'angle reduite de 8000->4000 */
-#define accel_angle 4000
+#define accel_angle 8000
 #define vitesse_angle 16000
-#define deccel_angle 4000
+#define deccel_angle 8000
 
 #define accel_dista 8000
 #define vitesse_dista 16000
--- a/main.cpp	Tue Jan 26 17:21:11 2016 +0000
+++ b/main.cpp	Sun Jan 31 16:11:32 2016 +0000
@@ -5,6 +5,7 @@
 #define ATTENTE 0
 #define GO 1
 #define STOP 2
+#define ENTRAXE 248.25
 
 InterruptIn mybutton(USER_BUTTON);
 DigitalIn button(USER_BUTTON);
@@ -15,7 +16,7 @@
 Serial logger (PA_9, PA_10);
 RoboClaw roboclaw(460800, PA_11, PA_12);
 /* Changement entraxe : 252->253 */
-Odometry odo(63.2, 63.3, 253, 4096, roboclaw);
+Odometry odo(63.2, 63.3, ENTRAXE, 4096, roboclaw);
 
 int i = 0;
 
@@ -34,9 +35,9 @@
     
     init();
     //Construction des obstacles
-    //map.build();
+    map.build();
     
-    /*float x=odo.getX();
+    float x=odo.getX();
     float y=odo.getY();
     float the = 0;
     
@@ -56,13 +57,14 @@
         odo.GotoXYT(path[i].x, path[i].y, the);
     }
     
-    odo.GotoThet(PI);
+    //odo.GotoThet(PI);
+    odo.GotoThet(0);
+    //odo.TestEntraxe(3);
+   /*
+    odo.GotoXYT(1000, 1000, 0);
+    odo.GotoXYT(0, 1000, PI);
     odo.GotoThet(0);*/
     
-    odo.GotoXYT(1000, 1000, 0);
-    odo.GotoXYT(0, 1000, PI);
-    odo.GotoThet(0);
-
     //odo.GotoThet(-PI/2);
     wait(2000);
     //odo.GotoXYT(2250,500,0);