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

Revision:
11:775ebb69d5e1
Parent:
10:09ddb819fdcb
--- a/StateDefines/defines.h	Thu Apr 04 06:43:43 2013 +0000
+++ b/StateDefines/defines.h	Fri Apr 05 10:58:42 2013 +0000
@@ -8,9 +8,10 @@
 #include "mbed.h"
 
 /**
- * Physical dimensions π
+ * @name Physical dimensions π;
  */
 #define PI                    3.141592654f
+/*! @} */
 
 /**
  * @name maxon motor #339282 EC 45 flat 30W
@@ -18,17 +19,17 @@
  */
 
 /**
-* Number of of pole pairs
+* @brief Number of of pole pairs
 */
 #define POLE_PAIRS            8u
 
 /**
-* Gear on the motor 1/11.6f
+* @brief Gear on the motor 1/11.6f
 */
 #define GEAR                  1/11.6f
 
 /**
-* Pulses per electrical step form the Hallsensor, have 6 steps
+* @brief Pulses per electrical step form the Hallsensor, have 6 steps
 */
 #define PULSES_PER_STEP       6u
 /*! @} */
@@ -39,24 +40,34 @@
  */
 
 /**
- * Value for the diffrerenz between left an right, given in [m]
+ * @brief Value for the diffrerenz between left an right, given in [m]
  */
 #define WHEEL_RADIUS_DIFF     0.0000f
 
 /**
- * radius of the left wheel, given in [m]
+ * @brief Radius of the left wheel, given in [m]
  */
 #define WHEEL_RADIUS_LEFT     0.040280f
 
 /**
- * radius of the left wheel, given in [m]
+ * @brief 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
+ * @brief Distance of the wheel, given in [m] Greater --> turn more
  */
 #define WHEEL_DISTANCE        0.2000f
+
+/**
+ * @brief Sets the start X-point, given in [m]
+ */
+#define START_X_OFFSET        -0.8f
+
+/**
+ * @brief Sets the start Y-point, given in [m]
+ */
+#define START_Y_OFFSET        0.8f
 /*! @} */
 
 /**
@@ -65,119 +76,191 @@
  */
 
 /**
- * Bit0 = stop pressed
+ * @brief Bit0 = stop pressed
  */
 #define STATE_STOP            1u
 
 /**
- * Bit1 = Undervoltage battery
- */ 
-#define STATE_UNDER           2u 
+ * @brief Bit1 = Undervoltage battery
+ */
+#define STATE_UNDER           2u
 
 /**
- * Bit2 = left ESCON in error state
- */  
+ * @brief Bit2 = left ESCON in error state
+ */
 #define STATE_LEFT            4u
 
 /**
- * Bit3 = right ESCON in error state
+ * @brief Bit3 = right ESCON in error state
  */
 #define STATE_RIGHT           8u
-/*! @} */    
+/*! @} */
+
+/**
+ * @name ESCON Constands
+ * @{
+ */
 
-// ESCON Constands
-#define ESCON_SET_FACTOR      1500.0f       // Speed Factor how set in the ESCON 
-#define ESCON_GET_FACTOR      1600.4f       // Speed Factor how get in the ESCON 
+/**
+ * @brief Speed Factor how set in the ESCON Studio
+ */
+#define ESCON_SET_FACTOR      1500.0f
+
+/**
+ * @brief Speed Factor how get in the ESCON Studio
+ */
+#define ESCON_GET_FACTOR      1600.4f
 
-//Error patch of the drift of Analog input and pwn output
-#define SET_SPEED_PATCH       (1+0.00262f)  // patch factor of set speed
-#define GET_SPEED_PATCH       (1+0.0019f)   // patch factor of get speed              
+/**
+ * @brief Error patch of the drift of Analog input and pwn output for set speed
+ */
+#define SET_SPEED_PATCH       (1+0.00262f)
 
-// Start Defintition
-#define START_X_OFFSET        -0.8f         // Sets the start X-point [m]
-#define START_Y_OFFSET        0.8f          // Sets the start Y-point [m]
+/**
+ * @brief Error patch of the drift of Analog input and pwn output for get speed
+ */
+#define GET_SPEED_PATCH       (1+0.0019f)
+/*! @} */
 
-// Maximum Aceeleration
-#define ACCELERATION          0.25f         // maximum translational acceleration, given in [m/s2]
-#define THETA_ACCELERATION    1.0f          // maximum rotational acceleration, given in [rad/s2]
+/**
+ * @name position controller
+ * @{
+ */
+
+/**
+ * @brief Main Gain for k1, k2 and k3
+ */
+#define GAIN                  0.8f
 
-// position controller
-#define GAIN                  0.8f          // Main Gain
+/**
+ * @brief Gain k1 default 1.0f
+ */
 #define K1                    0.8f * GAIN
-#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]                 
+
+/**
+ * @brief Gain k2 default 3.0f
+ */
+#define K2                    3.0f * GAIN
+
+/**
+ * @brief Gain k3 default 2.0f
+ */
+#define K3                    2.0f * GAIN
 
-// 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
-#define BAT_MIN               17.5f         // minium operate voltage [V] Battery Type: 1SP1P LG-18650 --> nominal voltage 3.6V   --> 5 batterys ==> 5 * 3.5V = 17.5V
+/**
+ * @brief Min. Distance to switch the position controller off.
+ * Because when Distance Error goes to zero the ATAN2 is not define, given in [m]
+ */
+#define MIN_DISTANCE_ERROR    0.01f
+/*! @} */
 
-// Frequenz for the Task
-#define PERIOD_COMPASS        0.050f        // 20Hz Rate for Compass HMC6352
-#define PERIOD_ROBOTCONTROL   0.001f        // 1kHz Rate for Robot Control
-#define PERIOD_STATE          0.001f        // 1kHz Rate for State Objekt 
-#define PERIOD_ANDROID        0.1f          // 10Hz Rate for State Objekt 
+/**
+ * @name Batterie control Battery Type: 1SP1P LG-18650
+ * * nominal voltage 3.6V
+ * * 5 batterys ==> 5 * 3.5V = 17.5V
+ * @{
+ */
 
-// Android Buffer Size for communication
-#define OUTL 100
-#define INBL 100
+/**
+ * @brief Battery Multiplicator for the potential divider.
+ * 
+ * R2 / (R1 + R2) = 0.153    R2= 10k , R1 = 1.8k 1/0.153 = 6.555  --> 3.3 * 6.555 = 21.6333333f
+ */
+#define BAT_MULTIPLICATOR     21.633333333f
+
+/**
+ * @brief minium operate voltage, given in [V]
+ */
+#define BAT_MIN               17.5f
+/*! @} */
 
 /**
-* struct state
-* structure containing system sensor data
-**/
+ * @name sampling rate for a Task Object
+ * @{
+ */
+
+/**
+ * @brief 1kHz Rate for Robot Control, given in [s]
+ */
+#define PERIOD_ROBOTCONTROL   0.001f
+
+/**
+ * @brief 1kHz Rate for State Objekt , given in [s]
+ */
+#define PERIOD_STATE          0.001f
+
+/**
+ * @brief 10Hz Rate for the Android communication , given in [s]
+ */
+#define PERIOD_ANDROID        0.1f
+/*! @} */
+
+/**
+ * @name Android Buffer Size for communication
+ * @{
+ */
+
+/**
+ * @brief Buffer Output
+ */
+#define OUTL 100
+
+/**
+ * @brief Buffer Input
+ */
+#define INBL 100
+/*! @} */
+
+/**
+ * @brief struct state
+ * structure containing system sensor data
+ */
 typedef struct state {
-    /** millis Time [ms]*/
+    /** @brief millis Time [ms]*/
     int millis;
-    /** Battery voltage [V] */
+    /** @brief Battery voltage [V] */
     float voltageBattery;
-    /** Number of pulses left */
+    /** @brief Number of pulses left */
     int leftPulses;
-    /** Number of pulses right */
+    /** @brief Number of pulses right */
     int rightPulses;
-    /** Velocity left [m/s] */
+    /** @brief Velocity left [m/s] */
     float leftVelocity;
-    /** Velocity right [m/s] */
+    /** @brief Velocity right [m/s] */
     float rightVelocity;
-    /** Velocity of the car [m/s] */
+    /** @brief Velocity of the car [m/s] */
     float velocity;
-    /** Velocity rotation [°/s] */
+    /** @brief Velocity rotation [°/s] */
     float omega;
-    /** X-Axis from co-ordinate [m] */
+    /** @brief X-Axis from co-ordinate [m] */
     float xAxis;
-    /** Y-Axis from co-ordinate [m] */
+    /** @brief Y-Axis from co-ordinate [m] */
     float yAxis;
-    /** X-Axis Error [m] */
+    /** @brief X-Axis Error [m] */
     float xAxisError;
-    /** X-Axis Error [m] */
+    /** @brief X-Axis Error [m] */
     float yAxisError;
-    /** Angle Error [°] */
+    /** @brief Angle Error [°] */
     float angleError;
-    /** Angle from Car [°] */
+    /** @brief Angle from Car [°] */
     float angle;
-    /** Setpoint X-Axis [m] */
+    /** @brief Setpoint X-Axis [m] */
     float setxAxis;
-    /** Setpoint Y-Axis [m] */
+    /** @brief Setpoint Y-Axis [m] */
     float setyAxis;
-    /** Setpoint Angel [°] */
+    /** @brief Setpoint Angel [°] */
     float setAngle;
-    /** Setpoint velocitiy [m/s] */
+    /** @brief Setpoint velocitiy [m/s] */
     float setVelocity;
-    /** Setpoint rotation velocitiy [rad/s] */
+    /** @brief Setpoint rotation velocitiy [rad/s] */
     float setOmega;
-    /** Compass X-Axis */
-    float compassxAxis;
-    /** Compass Y-Axis */
-    float compassyAxis;
-    /** State of the Car **/
     int state;
-    /** distance to Goal */
+    /** @brief distance to Goal */
     float rho;
-    /** theta to goal */
+    /** @brief theta to goal */
     float lamda;
-    /** theta from the goal */
+    /** @brief theta from the goal */
     float delta;
 } state_t;
 
-
-#endif
\ No newline at end of file
+#endif