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
Fork of autonomous Robot Android by
Revision 20:01b233b0e606, committed 2013-05-03
- Comitter:
- chrigelburri
- Date:
- Fri May 03 14:39:24 2013 +0000
- Parent:
- 19:b2f76b0fe4c8
- Child:
- 21:48248c5b8992
- Commit message:
- writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b) zus?tzliche states
Changed in this revision
--- a/MicroBridge/androidADB.cpp Fri May 03 13:34:34 2013 +0000 +++ b/MicroBridge/androidADB.cpp Fri May 03 14:39:24 2013 +0000 @@ -17,17 +17,17 @@ float getDesiredX() { - return androidx; + return androidx/1000; } float getDesiredY() { - return androidy; + return androidy/1000; } float getDesiredTheta() { - return androidt; + return androidt * PI / 180; } void Tokenize(const string& str, vector<string>& tokens, @@ -128,18 +128,25 @@ connection->write(sizeof(str),(unsigned char*)&str); } -void writeActualPosition(float x, float y, float t) +void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b) { - + // reconnect funktioniert trotzdem nicht!? while(!(androidConnected)) { connect(); wait(0.5); } - char str[32]; - sprintf( str, "%f;%f;%f;", x, y, t); + char str[100]; + + //send to android + sprintf( str, "%f;%f;%f;%i;%i;%i;%f;;", x, + y, + t * 180 / PI, + state_u == 0 ? 0 : 1, + state_l == 0 ? 0 : 1, + state_r == 0 ? 0 : 1, + volt_b); - //pc.printf("Sending: %s\n\r",str); connection->write(sizeof(str),(unsigned char*)&str); }
--- a/MicroBridge/androidADB.h Fri May 03 13:34:34 2013 +0000 +++ b/MicroBridge/androidADB.h Fri May 03 14:39:24 2013 +0000 @@ -3,7 +3,8 @@ #include "mbed.h" #include "Adb.h" -//#include "androidADB.cpp" +#include "defines.h" +#include "RobotControl.h" #include <string> #include <sstream> @@ -33,6 +34,6 @@ void write2Android(char str [32]); -void writeActualPosition(float x, float y, float t); +void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b); #endif \ No newline at end of file
--- a/main.cpp Fri May 03 13:34:34 2013 +0000 +++ b/main.cpp Fri May 03 14:39:24 2013 +0000 @@ -241,29 +241,20 @@ pc.printf("connection isOpen\n"); - float flt = 0.0f; - float flt2 = 0.2f; - float flt3 = 1.2f; - while(1) { ADB::poll(); - - flt = flt - 0.1f; - flt2 = flt2 + 0.2f; - flt3 = flt3 - 0.05f; + + robotControl.setDesiredPositionAndAngle(getDesiredX(), getDesiredY(), getDesiredTheta()); - robotControl.setDesiredPositionAndAngle(getDesiredX(), getDesiredY(), getDesiredTheta()); - - writeActualPosition(robotControl.getxActualPosition(),robotControl.getyActualPosition(), robotControl.getActualTheta()); + //void writeActualPosition(float x, float y, float t, int state_u, int state_l, int state_r, float volt_b) + writeActualPosition(robotControl.getxActualPosition(),robotControl.getyActualPosition(), robotControl.getActualTheta(), s.state&STATE_UNDER, s.state&STATE_LEFT, s.state&STATE_RIGHT, s.voltageBattery); //connection->write(sizeof(str),(unsigned char*)&str); wait(1); } - - state.savePlotFile(s); state.closePlotFile(); state.stop();