Christian Burri / Mbed 2 deprecated autonomous Robot Android

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers androidADB.h Source File

androidADB.h

Go to the documentation of this file.
00001 #ifndef _ANDROIDADB_H_
00002 #define _ANDROIDADB_H_
00003 
00004 #include "mbed.h"
00005 #include "Adb.h"
00006 #include "defines.h"
00007 
00008 #include <string>
00009 #include <sstream>
00010 #include <vector>
00011 #include <iostream>
00012 #include <stdlib.h>
00013 
00014 /**
00015  * @author Arno Galliker
00016  *
00017  * @copyright Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe
00018  * All rights reserved.
00019  *
00020  * @brief
00021  *
00022  * This File is for the connection to te self written java android app.
00023  * The connection works with the ADB class from rom Junichi Katsu.
00024  * For more information see here: <a href="http://mbed.org/users/jksoft/code/MicroBridge/">http://mbed.org/users/jksoft/code/MicroBridge/</a>
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
00027  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00029  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00031  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00032  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  */
00034  
00035  /**
00036  * @file androidADB.h
00037  */
00038 
00039 /**
00040 * @brief Takes an string, a vector of strings for the delimited tokens. 
00041 * Tokens is the array to separated with the delimiters.
00042 * @param str to 
00043 * @param tokens is the vecotr array
00044 * @param delimiters of the string
00045 */
00046 void Tokenize(const string& str,
00047               vector<string>& tokens,
00048               const string& delimiters = " ");
00049 
00050 /**
00051 * @brief Parse the Message, split and save it to the Attributes.
00052 * @param length length of the data
00053 * @param data Data to parse
00054 */
00055 void parseMessage(uint16_t length, uint8_t * data);
00056 
00057 /**
00058 * @brief Connecting to android.
00059 */
00060 void connect();
00061 
00062 /**
00063 * @brief Gets the desired &theta; value.
00064 * @return the desired &theta;, given in [°]
00065 */
00066 float getDesiredTheta();
00067 
00068 /**
00069 * @brief Gets the desired X-postition.
00070 * @return the desired X-postition, given in [m]
00071 */
00072 float getDesiredX();
00073 
00074 /**
00075 * @brief Gets the desired Y-postition.
00076 * @return the desired Y-postition, given in [m]
00077 */
00078 float getDesiredY();
00079 
00080 /**
00081 * @brief Sets the desired &theta; value.
00082 * @param t desired &theta; value, given in [°]
00083 */
00084 void setDesiredTheta(float t);
00085 
00086 /**
00087 * @brief Initialise the ADB subsystem. Open an ADB stream on tcp port 4568.
00088 */
00089 void init();
00090 
00091 /**
00092 * @brief Write the Parameterlist to the android smartphone.
00093 * @param x Acutal X-Position
00094 * @param y Acutal Y-Position
00095 * @param t Acutal &theta;-Position
00096 * @param state_u Actual State Undervoltage
00097 * @param state_l Actual Left State
00098 * @param state_r Actual Right State
00099 * @param volt_b Actual battery voltage
00100 */
00101 void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b);
00102 
00103 #endif