This program is for an autonomous robot for the competition at the Hochschule Luzern. We are one of the 32 teams. <a href="http://cruisingcrepe.wordpress.com/">http://cruisingcrepe.wordpress.com/</a> 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: <a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf">http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a>
Fork of autonomousRobotAndroid by
Diff: main.cpp
- Revision:
- 14:6a45a9f940a8
- Parent:
- 13:a7c30ee09bae
- Child:
- 15:cb1337567ad4
--- a/main.cpp Thu Apr 11 07:09:48 2013 +0000 +++ b/main.cpp Thu Apr 11 09:22:35 2013 +0000 @@ -36,19 +36,7 @@ #include "defines.h" #include "State.h" #include "RobotControl.h" -//#include "android.h" - -/** - * @name Communication - * @{ - */ - -/** - * @brief <code>adkTerm</code> object is for the communication with a smartphone. - * The operation system must be a android. - */ -//AdkTerm adkTerm; -/*! @} */ +#include "android.h" /** * @name Hallsensor @@ -108,8 +96,21 @@ State state(&s, &robotControl, &leftMotor, &rightMotor, p15, PERIOD_STATE); /*! @} */ +/** + * @name Communication + * @{ + */ + +/** + * @brief <code>adkTerm</code> object is for the communication with a smartphone. + * The operation system must be a android. + */ +AdkTerm adkTerm(&robotControl, &s, PERIOD_ANDROID); +/*! @} */ + + // @todo PC USB communications DAs wird danach gelöscht -//Serial pc(USBTX, USBRX); +Serial pc(USBTX, USBRX); /** * @brief Main function. Start the Programm here. @@ -140,6 +141,15 @@ robotControl.setAllToZero(0, 0, PI/2 ); // robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); robotControl.start(); + + pc.baud(460800); + pc.printf("Welcome to adkTerm\n\n\n\n\n\n\r"); + pc.printf("here we go... \n"); + adkTerm.setupDevice(); + pc.printf("Android Development Kit: start\r\n"); + USBInit(); + + adkTerm.start(); // robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2); @@ -147,7 +157,7 @@ // wait(0.1); ////////////////////////////////////////// - +/* robotControl.setDesiredPositionAndAngle(0.0f, 1.0f, PI); while(!(robotControl.getDistanceError() <= 0.1)) { state.savePlotFile(s); @@ -173,7 +183,7 @@ state.savePlotFile(s); }; - +*/ @@ -295,24 +305,16 @@ } */ - - - - /* - - pc.baud(460800); - pc.printf("Welcome to adkTerm\n\n\n\n\n\n\r"); - pc.printf("here we go... \n"); - adkTerm.setupDevice(); - pc.printf("Android Development Kit: start\r\n"); - USBInit(); + while (1) { USBLoop(); - pc.printf("Android x: %f ",adkTerm.getx()); - pc.printf("Android y: %f ",adkTerm.gety()); - pc.printf("Android t: %f\n",adkTerm.gett()); - robotControl.setDesiredPositionAndAngle(adkTerm.getx(), adkTerm.gety(), adkTerm.gett()); + pc.printf("From Android x: %f y: %f t: %f",adkTerm.getDesiredX(), adkTerm.getDesiredY(),adkTerm.getDesiredTheta()); + robotControl.setDesiredPositionAndAngle(adkTerm.getDesiredX(), adkTerm.getDesiredY(), adkTerm.getDesiredTheta()); + + pc.printf( "To Android: x: %f y: %f t: %f; \n \n", robotControl.getxActualPosition(), + robotControl.getyActualPosition(), + robotControl.getActualTheta()); }