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:
14:6a45a9f940a8
Parent:
12:235e318a414f
Child:
15:cb1337567ad4
--- a/AndroidADKTerm/android.h	Thu Apr 11 07:09:48 2013 +0000
+++ b/AndroidADKTerm/android.h	Thu Apr 11 09:22:35 2013 +0000
@@ -1,6 +1,7 @@
 #ifndef _ANDROID_H_
 #define _ANDROID_H_
 
+#include "RobotControl.h"
 #include "mbed.h"
 #include "AndroidAccessory.h"
 #include "defines.h"
@@ -13,12 +14,10 @@
 /**
  * @author Arno Galliker
  *
- * @subsection LICENSE
- *
- * Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe
+ * @copyright Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe
  * All rights reserved.
  *
- * @subsection DESCRIPTION
+ * @brief
  *
  * This class implements communication with the android smartphone
  * For more information see the Android ADK Cookbook:
@@ -27,127 +26,116 @@
  * Originally created by p07gbar from work by Makoto Abe
  */
 
-#define OUTL 100
-#define INBL 100
+//#define OUTL 100
+//#define INBL 100
 
-class AdkTerm : public AndroidAccessory
+class AdkTerm : public AndroidAccessory, public Task
 {
 
 private:
     
-    /** Attaches a tick to send messages over the USB buffer in a certain interval */
-    void AttachTick();
+    /** @brief Instance of RobotControl*/
+    RobotControl* robotControl;
     
-    /** Method to call when a tick period is over */
-    void onTick();
-    
-    /** Char buffer with a size of OUTL */
+    float period;
+
+    /** @brief Char buffer with a size of OUTL */
     char buffer[OUTL];
     
-    /** Buffer count ??? */
+    state_t* s;
+
+    /** @brief Buffer count ??? */
     int bcount;
-    
-    /** Instance of ticker */
-    Ticker tick;
-    
-    //float right,left,rl,ll;
-    //int tl,tr;
-    
-    //Timeout n;
-    
-    /** States if tick is on */
-    bool settick;
-    
-    /** States if something is written to the buffer?? */
+
+    /** @brief States if something is written to the buffer?? */
     bool ind;
-    
-    /** Desired position in meters for x-coordinate, given by android */
-    float x;
-    
-    /** Desired position in meters for y-coordinate, given by android */
-    float y;
-    
-    /** Desired position in degrees for theta, given by android */
-    float t;
+
+    /** @brief Desired position in meters for x-coordinate, given by android */
+    float desiredX;
+
+    /** @brief Desired position in meters for y-coordinate, given by android */
+    float desiredY;
+
+    /** @brief Desired position in degrees for theta, given by android */
+    float desiredTheta;
 
 public:
 
     /**
-     * Creates a <code>AdkTerm</code> object and initializes all private
+     * @brief Creates a <code>AdkTerm</code> object and initializes all private
      * state variables. Constructor
+     * @param robotControl RobotControl obejct reference
+     * @param period length of a period in seconds
      */
-    AdkTerm();
+    AdkTerm(RobotControl* robotControl, state_t* s, float period);
 
     /**
-     * Sets initial configurations and clears the buffer 
-     * 
+     * @brief Sets initial configurations and clears the buffer
+     *
      */
     void setupDevice();
 
     /**
-     * Returns the desired position in meters for x-coordinate, given by android
+     * @brief Returns the desired position in meters for x-coordinate, given by android
      * @return x-coordinate,given in [m]
      */
-    float getx();
+    float getDesiredX();
 
     /**
      * Returns the desired position in meters for y-coordinate, given by android
      * @return y-coordinate,given in [m]
      */
-    float gety();
+    float getDesiredY();
 
-     /**
-     * Returns the esired position in degrees for theta, given by android
-     * @return y-coordinate,given in degrees [°]
-     */
-    float gett();
+    /**
+    * @brief Returns the esired position in degrees for theta, given by android
+    * @return y-coordinate,given in degrees [°]
+    */
+    float getDesiredTheta();
+
+    /** @brief Method to call when a tick period is over */
+    void onTick();
 
 private:
 
     /**
-     *
-     *
-     */
-    //void AttachTick();
-
-    /**
-     *
-     *
-     */
-    // void onTick();
-
-    /**
-     * Clears the buffer and bcount
-     *
+     * @brief Clears the buffer and bcount
      */
     void resetDevice();
 
     /**
-     * Takes an string, a vector of strings for the delimited tokens, and a with the 
+     * @brief Takes an string, a vector of strings for the delimited tokens, and a with the
      * @param str
      * @param tokens
      * @param delimiters
      */
-    void Tokenize(const string& str, vector<string>& tokens, const string& delimiters = " ");
+    void Tokenize(const string& str,
+                  vector<string>& tokens,
+                  const string& delimiters = " ");
 
     /**
-     *
+     * @brief
      * @param buf
      * @param len
      */
     int callbackRead(u8 *buf, int len);
 
     /**
-     *
+     * @brief
      *
      */
     int callbackWrite();
 
     /**
-     *
+     * @brief
      *
      */
     void serialIRQ();
+    
+    /**
+     * @brief Run method actualize every period
+     */
+    void run();
 
 };