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
Revision 15:cb1337567ad4, committed 2013-04-26
- Comitter:
- chrigelburri
- Date:
- Fri Apr 26 06:02:41 2013 +0000
- Parent:
- 14:6a45a9f940a8
- Child:
- 16:b5d949136a21
- Commit message:
- Vor dem ?ndern f?r das Testat2. Weil das andorid auskommentiert werden muss....
Changed in this revision
--- a/ActuatorsSensor/Hallsensor.h Thu Apr 11 09:22:35 2013 +0000 +++ b/ActuatorsSensor/Hallsensor.h Fri Apr 26 06:02:41 2013 +0000 @@ -11,7 +11,7 @@ * * @brief * - * Interface to count the Hallsensor input from a EC-Motor. + * Interface to count the Hallsensor input from an EC-Motor. * */ class Hallsensor @@ -41,7 +41,7 @@ /** * @brief Constructor of the class <code>Hallsensor</code>. * - * Reads the current values on Hall1 , Hall2 and Hall3 to determine the + * Reads the current values on Hall1, Hall2 and Hall3 to determine the * initial state. * Attaches the encode function to the rise/fall interrupt edges of * Hall1, Hall2 and Hall3.
--- a/ActuatorsSensor/MaxonESCON.h Thu Apr 11 09:22:35 2013 +0000 +++ b/ActuatorsSensor/MaxonESCON.h Fri Apr 26 06:02:41 2013 +0000 @@ -53,14 +53,14 @@ /** * @brief Set the speed of the motor with a pwm for 10%..90%. * 50% PWM is 0rpm. - * Caclulate from [1/s] in [1/min] and the Factor of the ESCON. + * Caclulate from [1/s] in [1/min] and the factor of the ESCON. * @param speed The speed of the motor as a normalised value, given in [1/s] */ void setVelocity(float speed); /** * @brief Return the speed from ESCON. - * 0 rpm is defined in the Analog input as 1.65V + * 0 rpm is defined in the analog input as 1.65V * @return speed of the motor, given in [1/s] */ float getActualSpeed(void); @@ -73,7 +73,7 @@ void period(float period); /** - * @brief Set the Motor to a enable sate. + * @brief Set the motor to a enable sate. * @param enb <code>false</code> for disable <code>true</code> for enable. */ void enable(bool enb); @@ -86,13 +86,13 @@ bool isEnabled(void); /** - * @brief Return the number of Pulses. + * @brief Return the number of pulses. * @return Pulses, given in [count] */ int getPulses(void); /** - * @brief Set the Pulses of the Motor, given in [count] + * @brief Set the pulses of the motor, given in [count] * @return Pulses, given in [count] */ int setPulses(int setPos);
--- a/AndroidADKTerm/android.cpp Thu Apr 11 09:22:35 2013 +0000 +++ b/AndroidADKTerm/android.cpp Fri Apr 26 06:02:41 2013 +0000 @@ -50,12 +50,12 @@ u8* wbuf = _writebuff; // floats to string - char str[32]; + char str[100]; //send to android - sprintf( str, "%f;%f;%f;%i;%i;%i;%f", robotControl->getxActualPosition(), + sprintf( str, "%f;%f;%f;%i;%i;%i;%f;;", robotControl->getxActualPosition(), robotControl->getyActualPosition(), - robotControl->getActualTheta(), + robotControl->getActualTheta() * 180 / PI, s->state&STATE_UNDER == 0 ? 0 : 1, s->state&STATE_LEFT == 0 ? 0 : 1, s->state&STATE_RIGHT == 0 ? 0 : 1, @@ -64,7 +64,7 @@ //copy to wbuf strcpy( (char*) wbuf, str ); - this->write(wbuf,32); + this->write(wbuf,100); }
--- a/AndroidADKTerm/android.h Thu Apr 11 09:22:35 2013 +0000 +++ b/AndroidADKTerm/android.h Fri Apr 26 06:02:41 2013 +0000 @@ -23,12 +23,9 @@ * For more information see the Android ADK Cookbook: * <a href="http://mbed.org/cookbook/mbed-with-Android-ADK">http://mbed.org/cookbook/mbed-with-Android-ADK</a> * - * Originally created by p07gbar from work by Makoto Abe + * Originally created by p07gbar from work by Makoto Abe. */ -//#define OUTL 100 -//#define INBL 100 - class AdkTerm : public AndroidAccessory, public Task { @@ -65,13 +62,13 @@ * @brief Creates a <code>AdkTerm</code> object and initializes all private * state variables. Constructor * @param robotControl RobotControl obejct reference + * @param s referenz to the state struct. * @param period length of a period in seconds */ AdkTerm(RobotControl* robotControl, state_t* s, float period); /** * @brief Sets initial configurations and clears the buffer - * */ void setupDevice(); @@ -82,13 +79,13 @@ float getDesiredX(); /** - * Returns the desired position in meters for y-coordinate, given by android + * @brief Returns the desired position in meters for y-coordinate, given by android * @return y-coordinate,given in [m] */ float getDesiredY(); /** - * @brief Returns the esired position in degrees for theta, given by android + * @brief Returns the desired position in degrees for theta, given by android * @return y-coordinate,given in degrees [°] */ float getDesiredTheta(); @@ -114,21 +111,21 @@ const string& delimiters = " "); /** - * @brief + * @brief Read and cast incomming messages. * @param buf * @param len + * @return success */ int callbackRead(u8 *buf, int len); /** - * @brief - * + * @brief To send the buffer over the USB-Connection + * @return success */ int callbackWrite(); /** - * @brief - * + * @brief Generating messages via serial interface for debuging. */ void serialIRQ();
--- a/defines.h Thu Apr 11 09:22:35 2013 +0000 +++ b/defines.h Fri Apr 26 06:02:41 2013 +0000 @@ -9,6 +9,7 @@ /** * @name Physical dimensions π; + * @{ */ #define PI 3.141592654f /*! @} */ @@ -57,7 +58,7 @@ /** * @brief Distance of the wheel, given in [m] Greater --> turn more */ -#define WHEEL_DISTANCE 0.2000f +#define WHEEL_DISTANCE 0.1870f /** * @brief Sets the start X-point, given in [m] @@ -98,6 +99,7 @@ /** * @name ESCON Constands + * * @{ */
--- a/main.cpp Thu Apr 11 09:22:35 2013 +0000 +++ b/main.cpp Fri Apr 26 06:02:41 2013 +0000 @@ -7,7 +7,7 @@ * * @brief * - * This Programm is for a autonomous robot for the competition + * This program is for an 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> @@ -20,13 +20,13 @@ * * 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">a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a> + * 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> * - * The connection to a android smartphone is realise with the library AndroidAccessory from Rich Bayliss. - * For more information see here: <a href="https://mbed.org/users/richbayliss/code/AndroidAccessory/docs/tip/">a href="https://mbed.org/users/richbayliss/code/AndroidAccessory/docs/tip/</a> + * The connection to an android smartphone is realise with the library AndroidAccessory from Rich Bayliss. + * For more information see here: <a href="https://mbed.org/users/richbayliss/code/AndroidAccessory/docs/tip/">https://mbed.org/users/richbayliss/code/AndroidAccessory/docs/tip/</a> * * The rest of the classes are only based on standard library from mbed. - * For more information see here: <a href="http://mbed.org/users/mbed_official/code/mbed/">a href="http://mbed.org/users/mbed_official/code/mbed/</a> + * For more information see here: <a href="http://mbed.org/users/mbed_official/code/mbed/">http://mbed.org/users/mbed_official/code/mbed/</a> */ /** @@ -123,7 +123,7 @@ * start the timer for the Logging to the file * and start the Task for logging **/ - state.initPlotFile(); + //state.initPlotFile(); state.startTimerFromZero(); state.start(); @@ -139,7 +139,7 @@ * Set the startposition and start the Task for controlling the roboter. */ robotControl.setAllToZero(0, 0, PI/2 ); -// robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); + //robotControl.setAllToZero(START_X_OFFSET, START_Y_OFFSET, PI/2 ); robotControl.start(); pc.baud(460800); @@ -149,118 +149,14 @@ pc.printf("Android Development Kit: start\r\n"); USBInit(); + //wait(3); + adkTerm.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); @@ -274,7 +170,7 @@ state.savePlotFile(s); }; - robotControl.setDesiredPositionAndAngle(-0.75f, 3.0f, PI/2); + robotControl.setDesiredPositionAndAngle(-0.55f, 3.0f, PI/2); //0.75 while(!(robotControl.getDistanceError() <= 0.7)) { state.savePlotFile(s); }; @@ -294,27 +190,36 @@ while(!(robotControl.getDistanceError() <= 1.0)) { state.savePlotFile(s); }; + + robotControl.setDesiredPositionAndAngle(-2.0f, 2.0f, -PI/2); + while(!(robotControl.getDistanceError() <= 1.0)) { + state.savePlotFile(s); + }; - robotControl.setDesiredPositionAndAngle(-1.74f, 1.30f, -PI/2); + robotControl.setDesiredPositionAndAngle(-2.65f, 1.30f, -PI/2); while(!(robotControl.getDistanceError() <= 0.1)) { state.savePlotFile(s); }; - robotControl.setDesiredPositionAndAngle(-1.75f, 0.80f, -PI/2); + robotControl.setDesiredPositionAndAngle(-2.65f, 0.80f, -PI/2); while(!(s.millis >= 32000)) { state.savePlotFile(s); } */ - + while (1) { USBLoop(); + + robotControl.setDesiredPositionAndAngle(adkTerm.getDesiredX(), adkTerm.getDesiredY(), adkTerm.getDesiredTheta()); + + //pc.printf("."); - 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("From Android x: %f y: %f t: %f",adkTerm.getDesiredX(), adkTerm.getDesiredY(),adkTerm.getDesiredTheta()); + pc.printf( "To Android: x: %f y: %f t: %f; \n \n", robotControl.getxActualPosition(), robotControl.getyActualPosition(), - robotControl.getActualTheta()); + robotControl.getActualTheta());*/ } @@ -322,10 +227,9 @@ /** * Close the File PLOTS.txt to read the file after with the computer and draw a diagramm */ - /* state.savePlotFile(s); state.closePlotFile(); state.stop(); robotControl.setEnable(false); - */ + }