Project Paint / Mbed 2 deprecated arm_control

Dependencies:   mbed QEI biquadFilter

Revision:
20:66513b3c09b7
Parent:
16:66326e4a40b1
Child:
21:2aed81380bc3
--- a/test_main.cpp	Thu Nov 03 15:59:30 2016 +0000
+++ b/test_main.cpp	Thu Nov 03 16:33:37 2016 +0000
@@ -279,6 +279,13 @@
     }    
 }
 
+void getXandY(float &x, float &y) {
+    float lower = robotController.getLowerArmLength();
+    float upper = robotController.getUpperArmLength();
+    getRollerPositionForArmLengths(upper, lower, x, y);
+}
+
+
 /* executes the robot command */
 void processCommand(RobotCommand cmd) {
     if (cmd == robotCommand) return;
@@ -286,6 +293,8 @@
     robotCommand = cmd;
     
     switch (robotCommand) {
+        float x;
+        float y;
         case UP:
             robotController.paintUp();
             break;
@@ -293,10 +302,14 @@
             robotController.paintDown();
             break;
         case FORWARD:
-            //TODO
+            getXandY(x, y);
+            if (x < 40)
+                robotController.moveTo(x + 5.0f, y);
             break;
         case BACKWARD:
-            //TODO
+            getXandY(x, y);
+            if (x > 5)
+                robotController.moveTo(x - 5.0f, y);
             break;
         case NOTHING: