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
Diff: main.cpp
- Revision:
- 6:48eeb41188dd
- Parent:
- 5:48a258f6335e
- Child:
- 7:34be8b3a979c
--- a/main.cpp Thu Mar 21 08:56:53 2013 +0000 +++ b/main.cpp Sat Mar 23 13:52:48 2013 +0000 @@ -1,4 +1,6 @@ /** + * \mainpage Index Page + * * @file main.cpp * @author Christian Burri * @@ -34,6 +36,10 @@ #include "RobotControl.h" #include "Ping.h" #include "PowerControl/EthernetPowerControl.h" +//#include "android.h" + +//Android +//AdkTerm AdkTerm; // LiPo Batterie AnalogIn battery(p15); // Battery check @@ -66,7 +72,6 @@ DigitalOut myled(LED1); -//float magout[3] = {0}; // LiPo Batterie float batterie_voltage; @@ -89,10 +94,11 @@ robotControl.start(); robotControl.setEnable(false); - wait(0.01); + wait(0.1); robotControl.setEnable(true); - wait(0.01); - robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); + wait(0.1); + robotControl.setAllToZero(0, 0, PI/2 ); + // robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); leftMotor.setPulses(0); rightMotor.setPulses(0); @@ -100,44 +106,163 @@ state.startTimerFromZero(); state.start(); - robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2); + // 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.20f, 1.50f, 3*PI/4); - while(!(robotControl.getDistanceError() <= 0.4)) { - state.savePlotFile(s); - }; + robotControl.setDesiredPositionAndAngle(-1.00f, 1.0f, -PI/2); + while(!(robotControl.getDistanceError() <= 0.1)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-1.0f, 0.0f, 0); + while(!(robotControl.getDistanceError() <= 0.1)) { + state.savePlotFile(s); + }; - robotControl.setDesiredPositionAndAngle(-1.20f, 2.5f, PI/4); - while(!(robotControl.getDistanceError() <= 0.4)) { - state.savePlotFile(s); - }; + robotControl.setDesiredPositionAndAngle(0.0, 0.0f, PI/2); + while(!(s.millis >= 55000)) { + state.savePlotFile(s); + }; + + + + + + + + + + + + + //////////////////////////////////////////////////////////////////////// + + - robotControl.setDesiredPositionAndAngle(-0.45f, 3.2f, 3*PI/4); - while(!(robotControl.getDistanceError() <= 0.4)) { + //Zum Umfang einstellen + /* + robotControl.setDesiredPositionAndAngle(0.0f, 1.0f, PI/2); + while(!(s.millis >= 20000)) { state.savePlotFile(s); }; + - robotControl.setDesiredPositionAndAngle(-1.0f, 3.6f, PI); - while(!(robotControl.getDistanceError() <= 0.2)) { - state.savePlotFile(s); - }; +*/ + + ///////////////oder////////////////// + + + // Zum radabstand einstellen + + /* + int sek = 1000; + int step = 1000; + int i = 0; + int totalTurns = 5; + + while(i >= totalTurns) { + robotControl.setDesiredPositionAndAngle(0.0f, 0.0f, PI); + while(!(s.millis >= sek)) { + state.savePlotFile(s); + }; + sek += step; + + robotControl.setDesiredPositionAndAngle(0.0f, 0.0f, -PI/2); + while(!(s.millis >= sek)) { + state.savePlotFile(s); + }; + sek += step; - robotControl.setDesiredPositionAndAngle(-1.5f, 3.6f, PI); - while(!(robotControl.getDistanceError() <= 0.03)) { - state.savePlotFile(s); - }; + robotControl.setDesiredPositionAndAngle(0.0f, 0.0f, 0); + while(!(s.millis >= sek)) { + state.savePlotFile(s); + }; + sek += step; + + robotControl.setDesiredPositionAndAngle(0.0f, 0.0f, PI/2); + while(!(s.millis >= sek)) { + state.savePlotFile(s); + }; + sek += step; + + i++; + } +*/ + + +//////////////////////////////////////////////////////// + + + + // Epä Parkour fahrä +/* + robotControl.setDesiredPositionAndAngle(START_X_OFFSET, START_Y_OFFSET, PI/2); + wait(0.1); - robotControl.setDesiredPositionAndAngle(-2.5f, 3.0f, -PI/2); - while(!(robotControl.getDistanceError() <= 0.4)) { - state.savePlotFile(s); - }; + robotControl.setDesiredPositionAndAngle(-1.20f, 1.50f, 3*PI/4); + while(!(robotControl.getDistanceError() <= 0.4)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-1.20f, 2.5f, PI/4); + while(!(robotControl.getDistanceError() <= 0.4)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-0.45f, 3.2f, 3*PI/4); + while(!(robotControl.getDistanceError() <= 0.4)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-1.0f, 3.6f, PI); + while(!(robotControl.getDistanceError() <= 0.2)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-1.5f, 3.6f, PI); + while(!(robotControl.getDistanceError() <= 0.1)) { + state.savePlotFile(s); + }; - robotControl.setDesiredPositionAndAngle(-1.75f, 1.30f, -PI/2); - while(!(robotControl.getDistanceError() <= 0.04)) { - state.savePlotFile(s); - }; + robotControl.setDesiredPositionAndAngle(-2.5f, 3.0f, -PI/2); + while(!(robotControl.getDistanceError() <= 0.4)) { + state.savePlotFile(s); + }; + + robotControl.setDesiredPositionAndAngle(-1.75f, 1.30f, -PI/2); + while(!(robotControl.getDistanceError() <= 0.06)) { + state.savePlotFile(s); + }; + + */ + + + + + /* + printf("here we go... \n"); + AdkTerm.setupDevice(); + printf("Android Development Kit: start\r\n"); + USBInit(); + while (!(s.millis >= 60000)) { + USBLoop(); + + printf("x: %f y: %f theta: %f", AdkTerm.getx(), AdkTerm.getx(), AdkTerm.getx() ) + + if( AdkTerm.getx() == 99) { + break; + } + } + */ state.savePlotFile(s); state.closePlotFile();