Mapping for TP2

Dependencies:   ISR_Mini-explorer mbed

Fork of GoToPointWithAngle by Georgios Tsamis

Revision:
17:caf393b63e27
Parent:
16:ff73cc7b3156
Child:
19:6a9062d54eb0
Child:
22:6a3b14e284ee
--- a/main.cpp	Mon Mar 27 16:51:07 2017 +0000
+++ b/main.cpp	Mon Mar 27 16:59:31 2017 +0000
@@ -31,10 +31,14 @@
 int speed=999; // Max speed at beggining of movement
 
 //Target example x,y values
-float target_x=46.8, target_y=78.6, target_angle=1.7;
+float target_x, target_y, target_angle;
 
 //Timeout time;
 int main(){
+    target_x=200*rand();
+    target_y=200*rand();
+    target_angle=3.1416*2*rand()-3.1416;
+    
     i2c1.frequency(100000);
     initRobot(); //Initializing the robot
     pc.baud(9600); // baud for the pc communication
@@ -54,8 +58,14 @@
     beta = -alpha-theta+target_angle;
     //beta = atan(sin(beta)/cos(beta));
 
-    goToPointWithAngle(target_x, target_y, target_angle);
-
+    while(1){
+        goToPointWithAngle(target_x, target_y, target_angle);
+    
+        target_x=200*rand();
+        target_y=200*rand();
+        target_angle=3.1416*2*rand()-3.1416;
+    }
+    
     //Stop at the end
     leftMotor(1,0);
     rightMotor(1,0);