Robot using IMU and IR sensor data to drive autonomously and create a map

Dependencies:   mbed mbed-rtos LSM9DS1_Library_cal Motor

Revision:
12:dfa473dd9311
Parent:
11:805ef606a29d
Child:
13:f8e7af7ad87a
--- a/main.cpp	Mon May 02 04:39:20 2016 +0000
+++ b/main.cpp	Mon May 02 05:19:35 2016 +0000
@@ -111,13 +111,15 @@
 }
 void pos_thread(void const *args) {
     while(1) {
+        
         shiftArrays();
         imu[0] = xaccel;
         compass[0] = head;
         velX[0] += imu[0]*cos(compass[0])  * deltat;
         velY[0] += imu[0]*sin(compass[0])  * deltat;
-        posX[0] += velX[0] * deltat;
-        posY[0] += velY[0] * deltat;    
+        posX[0] += velX[0] * .1;
+        posY[0] += velY[0] * .1;  
+        wait(.1);  
     }    
 }    
 void left_thread(void const *args) {
@@ -154,8 +156,9 @@
         deltat = ti-timelast;
         stdio_mutex.lock();
         sprintf (str, "%0.6f,%0.6f,%0.6f,%d,%d,%d,%0.6f\n", posX[0], posY[0], heading, fdist, ldist, rdist, deltat);   //buffer data to be sent to computer
+//        pc.printf("%0.6f,%0.6f,%0.6f\r\n",xaccel,yaccel,deltat);
         pc.printf(str);
-        //pc.printf("%0.6f\r\n", zmag*9.8);
+//        pc.printf("%0.6f\r\n", zmag*9.8);
         xbee.printf(str);
         stdio_mutex.unlock();
         timelast = ti;