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
main.cpp
- Committer:
- chrigelburri
- Date:
- 2013-04-05
- Revision:
- 11:775ebb69d5e1
- Parent:
- 10:09ddb819fdcb
- Child:
- 12:235e318a414f
File content as of revision 11:775ebb69d5e1:
/*! \mainpage Index Page * @author Christian Burri * @author Arno Galliker * * @copyright Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe * All rights reserved. * * @brief * * This Programm is for a autonomous robot for the competition * at the Hochschule Luzern. * We are one of the 32 teams. In the team #1 is: * - Bauernfeind Julia <B>WI</B> <a href="mailto:julia.bauernfeind@stud.hslu.ch">julia.bauernfeind@stud.hslu.ch</a> * - Büttler Pirmin <B>WI</B> <a href="mailto:pirmin.buetler@stud.hslu.ch">pirmin.buetler@stud.hslu.ch</a> * - Amberg Reto <B>I</B> <a href="mailto:reto.amberg@stud.hslu.ch">reto.amberg@stud.hslu.ch</a> * - Galliker Arno <B>I</B> <a href="mailto:arno.galliker@stud.hslu.ch">arno.galliker@stud.hslu.ch</a> * - Amrein Marcel <B>M</B> <a href="mailto:marcel.amrein@stud.hslu.ch">marcel.amrein@stud.hslu.ch</a> * - Flühler Ramon <B>M</B> <a href="mailto:ramon.fluehler@stud.hslu.ch">ramon.fluehler@stud.hslu.ch</a> * - Burri Christian <B>ET</B> <a href="mailto:christian.burri@stud.hslu.ch">christian.burri@stud.hslu.ch</a> * * The postition control is based on polar coordiantes. * For more information see here: <a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf">a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a> * * */ /** * @file main.cpp */ #include "defines.h" #include "State.h" #include "RobotControl.h" //#include "android.h" //Android //AdkTerm adkTerm; /** * @name Hallsensor * @{ */ /** * @brief <code>hallsensorLeft</code> object with pin15, pin17 and pin16 */ Hallsensor hallLeft(p18, p17, p16); /** * @brief <code>hallsensorLeft</code> object with pin17, pin28 and pin29 */ Hallsensor hallRight(p27, p28, p29); /*! @} */ /** * @name Motors and Robot Control * @{ */ /** * @brief <code>leftMotor</code> object with pin26, pin25, pin24, pin19 and <code>hallsensorLeft</code> object */ MaxonESCON leftMotor(p26, p25, p24, p19, &hallLeft); /** * @brief <code>rightMotor</code> object with pin23, pin22, pin21, pin20 and <code>hallsensorRight</code> object */ MaxonESCON rightMotor(p23, p22, p21, p20, &hallRight); /** * @brief <code>robotControl</code> object with <code>leftMotor</code>, <code>rightMotor</code> and the sampling rate for the run method */ RobotControl robotControl(&leftMotor, &rightMotor, PERIOD_ROBOTCONTROL); /*! @} */ /** * @name Logging & State * @{ */ /** * @brief Define the struct for the State and the Logging */ state_t s; /** * @brief <code>state</code> object with <code>robotControl</code>, <code>rightMotor</code>, <code>leftMotor</code>, <code>battery</code>, and the sampling rate for the run method */ State state(&s, &robotControl, &leftMotor, &rightMotor, p15, PERIOD_STATE); /*! @} */ // PC USB communications DAs wird danach gelöscht //Serial pc(USBTX, USBRX); int main() { state.initPlotFile(); state.startTimerFromZero(); state.start(); robotControl.setEnable(false); wait(0.1); robotControl.setEnable(true); wait(0.1); robotControl.setAllToZero(0, 0, PI/2 ); // robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); robotControl.start(); // robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2); // robotControl.setDesiredPositionAndAngle(0, 0, PI/2); // wait(0.1); ////////////////////////////////////////// robotControl.setDesiredPositionAndAngle(0.0f, 1.0f, PI); while(!(robotControl.getDistanceError() <= 0.1)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.00f, 1.0f, -PI/2); while(!(robotControl.getDistanceError() <= 0.1)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0f, -0.8f, PI/2); while(!(robotControl.getDistanceError() <= 0.05)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0f, -0.2f, PI/2); while(!(robotControl.getDistanceError() <= 0.05)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0, 0.0f, PI/2); while(!(s.millis >= 32000)) { state.savePlotFile(s); }; ///////////////////////stay /* robotControl.setDesiredPositionAndAngle(0.0, 0.0f, PI/2); while(!(s.millis >= 25000)) { state.savePlotFile(s); }; */ //////////////////////////stay //////////////////////////////////////////////////////////////////////// /* //Zum Umfang einstellen 2m fahren robotControl.setDesiredPositionAndAngle(0.0f, 0.5f, PI/2); while(!(robotControl.getDistanceError() <= 0.2)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0f, 1.0f, PI/2); while(!(robotControl.getDistanceError() <= 0.2)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0f, 1.5f, PI/2); while(!(robotControl.getDistanceError() <= 0.2)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(0.0f, 2.0f, PI/2); while(!(s.millis >= 30000)) { state.savePlotFile(s); }; */ ///////////////oder//////////////////e // Zum radabstand einstellen /* robotControl.setDesiredPositionAndAngle(-0.7f, 1.0f, PI); while(!(robotControl.getDistanceError() <= 0.05)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-0.8f, 1.0f, PI); while(!(robotControl.getDistanceError() <= 0.05)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.0f, 1.0f, PI); while(!(s.millis >= 30000)) { state.savePlotFile(s); } */ //////////////////////////////////////////////////////// // Epä Parkour fahrä /* robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2); wait(0.1); robotControl.setDesiredPositionAndAngle(-1.50f, 1.50f, 3*PI/4); while(!(robotControl.getDistanceError() <= 0.9)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.20f, 2.1f, PI/4); while(!(robotControl.getDistanceError() <= 0.7)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-0.75f, 3.0f, PI/2); while(!(robotControl.getDistanceError() <= 0.7)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.0f, 3.75f, 3*PI/4); while(!(robotControl.getDistanceError() <= 0.55)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.5f, 3.6f, PI); while(!(robotControl.getDistanceError() <= 0.05)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-2.6f, 3.0f, -PI/2); while(!(robotControl.getDistanceError() <= 1.0)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.74f, 1.30f, -PI/2); while(!(robotControl.getDistanceError() <= 0.1)) { state.savePlotFile(s); }; robotControl.setDesiredPositionAndAngle(-1.75f, 0.80f, -PI/2); while(!(s.millis >= 32000)) { state.savePlotFile(s); } */ /* 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()); } state.savePlotFile(s); state.closePlotFile(); state.stop(); robotControl.setEnable(false); */ }