This program is for an autonomous robot for the competition at the Hochschule Luzern. We are one of the 32 teams. <a href="http://cruisingcrepe.wordpress.com/">http://cruisingcrepe.wordpress.com/</a> The postition control is based on this Documentation: Control of Wheeled Mobile Robots: An Experimental Overview from Alessandro De Luca, Giuseppe Oriolo, Marilena Vendittelli. For more information see here: <a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf">http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a>

Dependencies:   mbed

Fork of autonomousRobotAndroid by Christian Burri

Revision:
29:937c74ff040e
Parent:
28:b3e195e80439
Child:
30:c32fc6174efe
--- a/main.cpp	Mon May 20 11:59:25 2013 +0000
+++ b/main.cpp	Mon May 20 12:44:49 2013 +0000
@@ -121,8 +121,6 @@
      * and start the Task for logging
      **/
     state.start();
-    state.initPlotFile();
-    state.closePlotFile();
     while(s.voltageBattery < BAT_MIN) {
         for (float f = 0.1f; f < 6.3f; f += 0.1f) {
             for(int i = 0; i <= 3; i  ++) {
@@ -143,9 +141,7 @@
         led[i] = state.dim( 0, 0.0f );
     }
 
-    state.stop();
     wait(0.5);
-    state.start();
     state.initPlotFile();
     state.startTimerFromZero();
     robotControl.start();
@@ -163,26 +159,28 @@
     pc.baud(460800);
     pc.printf("********************* MicroBridge 4568 ********************************\n\r");
 
-
-    // Initialise the ADB subsystem.
+    /**
+    * Initialise the ADB subsystem.
+    */
     init();
     setDesiredTheta(400.0f);
     pc.printf("connection isOpen\n");
 
     while(getDesiredTheta() < (4 * PI)) {
-
         ADB::poll();
         if (getDesiredTheta() > (2 * PI)) {
-            // Runs at first till the Startbutton has pressed
+            /**
+            * Runs at first till the Startbutton has pressed
+            */
             state.startTimerFromZero();
             robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 );
             robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2);
             robotControl.setEnable(false);
+            wait(0.1);
         } else {
             robotControl.setEnable(true);
             robotControl.setDesiredPositionAndAngle(getDesiredX(), getDesiredY(), getDesiredTheta());
-
-
+             wait(0.1);
             state.savePlotFile(s);
             //void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b)
         }
@@ -196,11 +194,12 @@
                             s.voltageBattery);
         //connection->write(sizeof(str),(unsigned char*)&str);
 
-        wait(0.25);
+        wait(0.1);
 
     }
 
     /**
+     * Sets the acutal value for a fast stop.
      * Close the File PLOTS.txt to read the file with the computer afterwards and draw a diagramm
      */
     robotControl.setDesiredPositionAndAngle(robotControl.getxActualPosition(),
@@ -210,9 +209,9 @@
     state.savePlotFile(s);
     leftMotor.setVelocity(0.0f);
     rightMotor.setVelocity(0.0f);
-    while(!(s.millis >= 15000)) {
-        state.savePlotFile(s);
-    };
+  //  while(!(s.millis >= 15000)) {
+  //      state.savePlotFile(s);
+  //  };
 
     /**
      * Close the File PLOTS.txt to read the file with the computer afterwards and draw a diagramm