This program is for an autonomous robot for the competition at the Hochschule Luzern. http://cruisingcrepe.wordpress.com/ We are one of the 32 teams. http://cruisingcrepe.wordpress.com/ 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: http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Files at this revision

API Documentation at this revision

Comitter:
chrigelburri
Date:
Thu Apr 04 06:43:43 2013 +0000
Parent:
9:d3cdcdef9719
Child:
11:775ebb69d5e1
Commit message:
vor dem sauberen kommentieren

Changed in this revision

StateDefines/defines.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/StateDefines/defines.h	Sat Mar 30 16:35:22 2013 +0000
+++ b/StateDefines/defines.h	Thu Apr 04 06:43:43 2013 +0000
@@ -1,27 +1,89 @@
 #ifndef _DEFINES_H_
 #define _DEFINES_H_
 
+/*! \file defines.h
+\brief All defines for the roboter you can see here.
+*/
+
 #include "mbed.h"
 
-// Physical dimensions
-#define PI                    3.141592654f  // Physical dimensions π. 
+/**
+ * Physical dimensions π
+ */
+#define PI                    3.141592654f
+
+/**
+ * @name maxon motor #339282 EC 45 flat 30W
+ * @{
+ */
+
+/**
+* Number of of pole pairs
+*/
+#define POLE_PAIRS            8u
 
-// maxon motor #339282 EC 45 flat 30W and GEAR 
-#define POLE_PAIRS            8u            // Number of of pole pairs
-#define GEAR                  1/11.6f       // Gear on the motor 1/11.6f
-#define PULSES_PER_STEP       6u            // Pulses per electrical step Hallsensor, have 6 steps
+/**
+* Gear on the motor 1/11.6f
+*/
+#define GEAR                  1/11.6f
+
+/**
+* Pulses per electrical step form the Hallsensor, have 6 steps
+*/
+#define PULSES_PER_STEP       6u
+/*! @} */
+
+/**
+ * @name Physical Dimension of the car
+ * @{
+ */
+
+/**
+ * Value for the diffrerenz between left an right, given in [m]
+ */
+#define WHEEL_RADIUS_DIFF     0.0000f
 
-// Physical Dimension of the car
-#define WHEEL_RADIUS_DIFF     0.0000f      // positiv zu weit rechts, given in [m]
-#define WHEEL_RADIUS_LEFT     0.040280f     // radius of the left wheel, given in [m] 0.040280f
-#define WHEEL_RADIUS_RIGHT    (WHEEL_RADIUS_LEFT - WHEEL_RADIUS_DIFF)    // radius of the left wheel, given in [m]
-#define WHEEL_DISTANCE        0.2000f       // Distance of the wheel, given in [m] Grösser --> mehr drehen
+/**
+ * radius of the left wheel, given in [m]
+ */
+#define WHEEL_RADIUS_LEFT     0.040280f
+
+/**
+ * radius of the left wheel, given in [m]
+ */
+#define WHEEL_RADIUS_RIGHT    (WHEEL_RADIUS_LEFT - WHEEL_RADIUS_DIFF)
+
+/**
+ * Distance of the wheel, given in [m] Greater --> turn more
+ */
+#define WHEEL_DISTANCE        0.2000f
+/*! @} */
+
+/**
+ * @name State Bits of the car
+ * @{
+ */
 
-// State Bits of the car
-#define STATE_STOP            1u            // Bit0 = stop pressed 
-#define STATE_UNDER           2u            // Bit1 = Undervoltage battery   
-#define STATE_LEFT            4u            // Bit2 = left ESCON in error state
-#define STATE_RIGHT           8u            // Bit3 = right ESCON in error state     
+/**
+ * Bit0 = stop pressed
+ */
+#define STATE_STOP            1u
+
+/**
+ * Bit1 = Undervoltage battery
+ */ 
+#define STATE_UNDER           2u 
+
+/**
+ * Bit2 = left ESCON in error state
+ */  
+#define STATE_LEFT            4u
+
+/**
+ * Bit3 = right ESCON in error state
+ */
+#define STATE_RIGHT           8u
+/*! @} */    
 
 // ESCON Constands
 #define ESCON_SET_FACTOR      1500.0f       // Speed Factor how set in the ESCON 
@@ -40,11 +102,11 @@
 #define THETA_ACCELERATION    1.0f          // maximum rotational acceleration, given in [rad/s2]
 
 // position controller
-#define GAIN                  0.8f         // Main Gain
+#define GAIN                  0.8f          // Main Gain
 #define K1                    0.8f * GAIN
-#define K2                    3.0f * GAIN // deafult 3.0f
-#define K3                    2.0f * GAIN   // deafult 2.0f
-#define MIN_DISTANCE_ERROR    -0.005f         // min. Distance to switch the position controller off. Because when Distance Error goes to zero the ATAN2 is not define, given in [m]                 
+#define K2                    3.0f * GAIN   // deafult 3.0f
+#define K3                    2.0f * GAIN   // default 2.0f
+#define MIN_DISTANCE_ERROR    -0.005f       // min. Distance to switch the position controller off. Because when Distance Error goes to zero the ATAN2 is not define, given in [m]                 
 
 // LiPo Batterie
 #define BAT_MULTIPLICATOR     21.633333333f // R2 / (R1 + R2) = 0.153    R2= 10k , R1 = 1.8k 1/0.153 = 6.555  ---> 3.3 * 6.555 = 21.6333333f
@@ -56,23 +118,14 @@
 #define PERIOD_STATE          0.001f        // 1kHz Rate for State Objekt 
 #define PERIOD_ANDROID        0.1f          // 10Hz Rate for State Objekt 
 
-// Compass Maxima und Minima for the Filter
-#define SET_MAXIMAS_MINIMAS   true          // For Set the maximas und minimas when false the object search the maximas minimas by your own
-#define COMP_X_MAX            391.219910f   // Maximum X-Range
-#define COMP_Y_MAX            382.915161f   // Maximum Y-Range      
-#define COMP_Z_MAX            -237.855042f  // Maximum Z-Range not used in this side      
-#define COMP_X_MIN            -169.952530f  // Minimum X-Range      
-#define COMP_Y_MIN            -247.647675f  // Minimum Y-Range      
-#define COMP_Z_MIN            -385.915009f  // Minimun Z-Range not used in this side 
-
 // Android Buffer Size for communication
 #define OUTL 100
-#define INBL 100 
+#define INBL 100
 
-    /**
-    * struct state
-    * structure containing system sensor data
-    **/
+/**
+* struct state
+* structure containing system sensor data
+**/
 typedef struct state {
     /** millis Time [ms]*/
     int millis;
--- a/main.cpp	Sat Mar 30 16:35:22 2013 +0000
+++ b/main.cpp	Thu Apr 04 06:43:43 2013 +0000
@@ -1,7 +1,5 @@
-/**
- * \mainpage Index Page
+/*! \mainpage Index Page
  *
- * @file main.cpp
  * @author Christian Burri
  *
  * @section LICENSE
@@ -41,8 +39,10 @@
 //Android
 //AdkTerm AdkTerm;
 
-// LiPo Batterie
-AnalogIn battery(p15);           // Battery check
+/**
+ * LiPo Batterie for check an undervoltage.
+ */
+AnalogIn battery(p15);
 
 // compass
 //HMC5883L compass(p9, p10, PERIOD_COMPASS);       // sda, sdl (I2C)
@@ -79,11 +79,11 @@
 int main()
 {
     /** Normal mbed power level for this setup is around 690mW
-    * assuming 5V used on Vin pin
-    * If you don't need networking...
-    * Power down Ethernet interface - saves around 175mW
-    * Also need to unplug network cable - just a cable sucks power
-    */
+     * assuming 5V used on Vin pin
+     * If you don't need networking...
+     * Power down Ethernet interface - saves around 175mW
+     * Also need to unplug network cable - just a cable sucks power
+     */
     PHY_PowerDown();
 
     //  robotControl.start();
@@ -99,7 +99,7 @@
     robotControl.setEnable(true);
     wait(0.1);
     //robotControl.setAllToZero(0, 0, PI/2 );
-          robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 );
+    robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 );
     robotControl.start();
 
 
@@ -253,30 +253,30 @@
     robotControl.setDesiredPositionAndAngle(-1.75f, 0.80f,  -PI/2);
     while(!(s.millis >= 32000)) {
         state.savePlotFile(s);
-}
+    }
 
 
 
 
 
-        /*
-            printf("here we go... \n");
-            AdkTerm.setupDevice();
-            printf("Android Development Kit: start\r\n");
-            USBInit();
-            while (!(s.millis >= 60000)) {
-                USBLoop();
+    /*
+        printf("here we go... \n");
+        AdkTerm.setupDevice();
+        printf("Android Development Kit: start\r\n");
+        USBInit();
+        while (!(s.millis >= 60000)) {
+            USBLoop();
 
-                printf("x: %f y: %f theta: %f", AdkTerm.getx(), AdkTerm.getx(), AdkTerm.getx() )
+            printf("x: %f y: %f theta: %f", AdkTerm.getx(), AdkTerm.getx(), AdkTerm.getx() )
 
-                if( AdkTerm.getx() == 99) {
-                    break;
-                }
+            if( AdkTerm.getx() == 99) {
+                break;
             }
-        */
+        }
+    */
 
-        state.savePlotFile(s);
-        state.closePlotFile();
-        state.stop();
-        robotControl.setEnable(false);
-    }
+    state.savePlotFile(s);
+    state.closePlotFile();
+    state.stop();
+    robotControl.setEnable(false);
+}