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>

Dependencies:   mbed

Fork of autonomousRobotAndroid by Christian Burri

Revision:
11:775ebb69d5e1
Parent:
8:696c2f9dfc62
--- a/StateDefines/State.cpp	Thu Apr 04 06:43:43 2013 +0000
+++ b/StateDefines/State.cpp	Fri Apr 05 10:58:42 2013 +0000
@@ -8,14 +8,20 @@
 // LocalFileSystem
 LocalFileSystem local("local");
 
-State::State(state_t* s, RobotControl* robotControl, MaxonESCON* motorControllerLeft, MaxonESCON* motorControllerRight, /*HMC6352* compass,*/ AnalogIn* battery, float period) : Task(period)
+State::State(state_t* s,
+             RobotControl* robotControl,
+             MaxonESCON* motorControllerLeft,
+             MaxonESCON* motorControllerRight,
+             PinName batteryPin,
+             float period)
+    : Task(period) ,
+      battery(batteryPin)
 {
     /* get peripherals */
     this->s = s;
     this->robotControl = robotControl;
     this->motorControllerLeft = motorControllerLeft;
     this->motorControllerRight = motorControllerRight;
-    // this->compass = compass;
     this->battery =battery;
     this->period = period;
 }
@@ -48,10 +54,8 @@
                 "SetpointAngel[grad]\t" //17
                 "SetpointVelocitiy[m/s]\t"
                 "SetpointVelocitiyRotations[rad/s]\t"
-                "CompassX-Axis\t" //20
-                "CompassY-Axis\t"
-                "State\t"
-                "distanceToGoal[m]\t" //23
+                "State\t" //20
+                "distanceToGoal[m]\t" //21
                 "angleToGoal[grad]\t"
                 "thetaFromTheGoal[grad]\n");
     }
@@ -63,7 +67,7 @@
     char buf[256];
 
     sprintf(buf,"%d\t%f\t%d\t%d\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t"
-            "%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%d\t%f\t%f\t%f",
+            "%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%d\t%f\t%f\t%f",
             s.millis,
             s.voltageBattery,
             s.leftPulses,
@@ -83,8 +87,6 @@
             s.setAngle,
             s.setVelocity,
             s.setOmega,
-            s.compassxAxis,
-            s.compassyAxis,
             s.state,
             s.rho,
             s.lamda,
@@ -96,11 +98,6 @@
     fprintf(logp, "\n"); // new line
 }
 
-void State::savePlotText(char text[])
-{
-    fprintf(logp, text);
-}
-
 void State::closePlotFile(void)
 {
     fclose(logp);
@@ -108,7 +105,7 @@
 
 float State::readBattery()
 {
-    return battery->read()*BAT_MULTIPLICATOR;
+    return battery.read()*BAT_MULTIPLICATOR;
 }
 
 void State::setBatteryBit()
@@ -165,7 +162,6 @@
     s->setxAxis = robotControl->getDesiredxPosition();
     s->setyAxis = robotControl->getDesiredyPosition();
     s->setAngle = robotControl->getDesiredTheta() * 180 / PI;
-    // s->compassAngle = compass->getFilteredAngle() * 180 / PI;
     s->setVelocity = robotControl->getDesiredSpeed();
     s->setOmega = robotControl->getDesiredOmega();