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

Committer:
chrigelburri
Date:
Mon Jun 10 14:40:37 2013 +0000
Revision:
39:a4fd6206da89
Parent:
38:d76e488e725f
V1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrigelburri 18:306d362d692b 1 #ifndef _ANDROIDADB_H_
chrigelburri 18:306d362d692b 2 #define _ANDROIDADB_H_
chrigelburri 18:306d362d692b 3
chrigelburri 18:306d362d692b 4 #include "mbed.h"
chrigelburri 18:306d362d692b 5 #include "Adb.h"
chrigelburri 20:01b233b0e606 6 #include "defines.h"
chrigelburri 18:306d362d692b 7
chrigelburri 18:306d362d692b 8 #include <string>
chrigelburri 18:306d362d692b 9 #include <sstream>
chrigelburri 18:306d362d692b 10 #include <vector>
chrigelburri 18:306d362d692b 11 #include <iostream>
chrigelburri 18:306d362d692b 12 #include <stdlib.h>
chrigelburri 18:306d362d692b 13
chrigelburri 18:306d362d692b 14 /**
chrigelburri 34:62996eed658a 15 * @author Arno Galliker
chrigelburri 34:62996eed658a 16 *
chrigelburri 38:d76e488e725f 17 * @copyright Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe
chrigelburri 34:62996eed658a 18 * All rights reserved.
chrigelburri 34:62996eed658a 19 *
chrigelburri 34:62996eed658a 20 * @brief
chrigelburri 34:62996eed658a 21 *
chrigelburri 34:62996eed658a 22 * This File is for the connection to te self written java android app.
chrigelburri 34:62996eed658a 23 * The connection works with the ADB class from rom Junichi Katsu.
chrigelburri 34:62996eed658a 24 * For more information see here: <a href="http://mbed.org/users/jksoft/code/MicroBridge/">http://mbed.org/users/jksoft/code/MicroBridge/</a>
chrigelburri 38:d76e488e725f 25 *
chrigelburri 38:d76e488e725f 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
chrigelburri 38:d76e488e725f 27 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
chrigelburri 38:d76e488e725f 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
chrigelburri 38:d76e488e725f 29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
chrigelburri 38:d76e488e725f 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
chrigelburri 38:d76e488e725f 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
chrigelburri 38:d76e488e725f 32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chrigelburri 34:62996eed658a 33 */
chrigelburri 34:62996eed658a 34
chrigelburri 34:62996eed658a 35 /**
chrigelburri 34:62996eed658a 36 * @file androidADB.h
chrigelburri 34:62996eed658a 37 */
chrigelburri 34:62996eed658a 38
chrigelburri 34:62996eed658a 39 /**
chrigelburri 34:62996eed658a 40 * @brief Takes an string, a vector of strings for the delimited tokens.
chrigelburri 34:62996eed658a 41 * Tokens is the array to separated with the delimiters.
chrigelburri 34:62996eed658a 42 * @param str to
chrigelburri 34:62996eed658a 43 * @param tokens is the vecotr array
chrigelburri 34:62996eed658a 44 * @param delimiters of the string
chrigelburri 21:48248c5b8992 45 */
chrigelburri 18:306d362d692b 46 void Tokenize(const string& str,
chrigelburri 18:306d362d692b 47 vector<string>& tokens,
chrigelburri 18:306d362d692b 48 const string& delimiters = " ");
chrigelburri 21:48248c5b8992 49
chrigelburri 21:48248c5b8992 50 /**
chrigelburri 33:ac39982fd3b2 51 * @brief Parse the Message, split and save it to the Attributes.
chrigelburri 33:ac39982fd3b2 52 * @param length length of the data
chrigelburri 33:ac39982fd3b2 53 * @param data Data to parse
chrigelburri 21:48248c5b8992 54 */
chrigelburri 21:48248c5b8992 55 void parseMessage(uint16_t length, uint8_t * data);
chrigelburri 21:48248c5b8992 56
chrigelburri 21:48248c5b8992 57 /**
chrigelburri 33:ac39982fd3b2 58 * @brief Connecting to android.
chrigelburri 21:48248c5b8992 59 */
chrigelburri 18:306d362d692b 60 void connect();
chrigelburri 18:306d362d692b 61
chrigelburri 21:48248c5b8992 62 /**
chrigelburri 21:48248c5b8992 63 * @brief Gets the desired &theta; value.
chrigelburri 32:767044a3e421 64 * @return the desired &theta;, given in [°]
chrigelburri 21:48248c5b8992 65 */
chrigelburri 19:b2f76b0fe4c8 66 float getDesiredTheta();
chrigelburri 21:48248c5b8992 67
chrigelburri 21:48248c5b8992 68 /**
chrigelburri 21:48248c5b8992 69 * @brief Gets the desired X-postition.
chrigelburri 21:48248c5b8992 70 * @return the desired X-postition, given in [m]
chrigelburri 21:48248c5b8992 71 */
chrigelburri 19:b2f76b0fe4c8 72 float getDesiredX();
chrigelburri 21:48248c5b8992 73
chrigelburri 21:48248c5b8992 74 /**
chrigelburri 21:48248c5b8992 75 * @brief Gets the desired Y-postition.
chrigelburri 21:48248c5b8992 76 * @return the desired Y-postition, given in [m]
chrigelburri 21:48248c5b8992 77 */
chrigelburri 19:b2f76b0fe4c8 78 float getDesiredY();
chrigelburri 19:b2f76b0fe4c8 79
chrigelburri 21:48248c5b8992 80 /**
chrigelburri 28:b3e195e80439 81 * @brief Sets the desired &theta; value.
chrigelburri 28:b3e195e80439 82 * @param t desired &theta; value, given in [°]
chrigelburri 28:b3e195e80439 83 */
chrigelburri 28:b3e195e80439 84 void setDesiredTheta(float t);
chrigelburri 28:b3e195e80439 85
chrigelburri 28:b3e195e80439 86 /**
chrigelburri 21:48248c5b8992 87 * @brief Initialise the ADB subsystem. Open an ADB stream on tcp port 4568.
chrigelburri 21:48248c5b8992 88 */
chrigelburri 19:b2f76b0fe4c8 89 void init();
chrigelburri 19:b2f76b0fe4c8 90
chrigelburri 21:48248c5b8992 91 /**
chrigelburri 21:48248c5b8992 92 * @brief Write the Parameterlist to the android smartphone.
chrigelburri 33:ac39982fd3b2 93 * @param x Acutal X-Position
chrigelburri 33:ac39982fd3b2 94 * @param y Acutal Y-Position
chrigelburri 33:ac39982fd3b2 95 * @param t Acutal &theta;-Position
chrigelburri 33:ac39982fd3b2 96 * @param state_u Actual State Undervoltage
chrigelburri 33:ac39982fd3b2 97 * @param state_l Actual Left State
chrigelburri 33:ac39982fd3b2 98 * @param state_r Actual Right State
chrigelburri 33:ac39982fd3b2 99 * @param volt_b Actual battery voltage
chrigelburri 21:48248c5b8992 100 */
chrigelburri 20:01b233b0e606 101 void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b);
chrigelburri 19:b2f76b0fe4c8 102
chrigelburri 18:306d362d692b 103 #endif