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

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Revision:
5:48a258f6335e
Parent:
3:92ba0254af87
Child:
6:48eeb41188dd
--- a/RobotControl/RobotControl.cpp	Fri Mar 08 09:54:34 2013 +0000
+++ b/RobotControl/RobotControl.cpp	Thu Mar 21 08:56:53 2013 +0000
@@ -61,26 +61,41 @@
     this->omega = omega;
 }
 
-void RobotControl::setxPosition(float xposition)
+void RobotControl::setDesiredxPosition(float xposition)
 {
     Desired.xposition = xposition;
 }
 
-void RobotControl::setyPosition(float yposition)
+void RobotControl::setDesiredyPosition(float yposition)
 {
     Desired.yposition = yposition;
 }
 
-void RobotControl::setTheta(float theta)
+void RobotControl::setDesiredTheta(float theta)
 {
     Desired.theta = theta;
 }
 
-void RobotControl::setPositionAngle(float xposition, float yposition, float theta)
+float RobotControl::getDesiredxPosition()
+{
+    return Desired.xposition;
+}
+
+float RobotControl::getDesiredyPosition()
 {
-    setxPosition(xposition);
-    setyPosition(yposition);
-    setTheta(theta);
+    return Desired.yposition;
+}
+
+float RobotControl::getDesiredTheta()
+{
+    return Desired.theta;
+}
+
+void RobotControl::setDesiredPositionAndAngle(float xposition, float yposition, float theta)
+{
+    setDesiredxPosition(xposition);
+    setDesiredyPosition(yposition);
+    setDesiredTheta(theta);
 }
 
 float RobotControl::getTheta()
@@ -243,8 +258,8 @@
         omega = K2 * getThetaErrorToGoal() +
                 K1 * ( ( sin(getThetaErrorToGoal()) * cos(getThetaErrorToGoal()) ) / (getThetaErrorToGoal()) ) * ( getThetaErrorToGoal() + K3 * getThetaGoal() );
 
-        motorControllerLeft->setVelocity( ( ( (2 * speed) - (WHEEL_DISTANCE * omega) ) / 2 ) / (2 * WHEEL_RADIUS * PI) * GEAR );
-        motorControllerRight->setVelocity(-( ( (2 * speed) + (WHEEL_DISTANCE * omega) ) / 2) / (2 * WHEEL_RADIUS * PI) * GEAR );
+        motorControllerLeft->setVelocity( ( ( (2 * speed) - (WHEEL_DISTANCE * omega) ) / 2 ) / (2 * WHEEL_RADIUS * PI * GEAR) );
+        motorControllerRight->setVelocity(-( ( (2 * speed) + (WHEEL_DISTANCE * omega) ) / 2) / (2 * WHEEL_RADIUS * PI * GEAR) );
 
     } else {