Speedy Retraction Team / Mbed 2 deprecated Nucleo_Dynamixel_18V

Dependencies:   Dynamixel Protocol Utilities mbed

Fork of Nucleo_Dynamixel_18V by Timofey Ilin

Revision:
6:414eb29191ad
Parent:
5:c74f23e4325f
Child:
7:761930a5373d
--- a/main.cpp	Sun Jul 10 04:23:11 2016 +0000
+++ b/main.cpp	Sun Jul 10 05:06:52 2016 +0000
@@ -44,7 +44,7 @@
     Elbow.setGoalPosition(150);
     Wrist.setGoalPosition(180);
     pos = 2;
-    wait(2);
+    wait(1);
 }
 
 void leftPosition() {
@@ -73,7 +73,7 @@
     Elbow.setGoalPosition(60);
     Wrist.setGoalPosition(370);
     pos = 3;
-    wait(2);
+    wait(1);
 }
 
 void rightPosition() {
@@ -91,10 +91,10 @@
         }
     }
     if  (pos == 3) {
-        Base.setGoalPosition(150);      // To lessen lever disadvantage
+        //Base.setGoalPosition(150);      // To lessen lever disadvantage
         Elbow.setGoalPosition(150);
-        Wrist.setMovingSpeed(1024+50);
-        Wrist.setGoalPosition(140);
+        //Wrist.setMovingSpeed(1024+50);
+        //Wrist.setGoalPosition(140);
         wait(1);
     }
     
@@ -106,7 +106,7 @@
     wait_us(100);
     Wrist.setGoalPosition(60);
     pos = 4;
-    wait(2);
+    wait(1);
 }
 
 void retractedPosition() {
@@ -120,7 +120,7 @@
         currentPosElbow = Elbow.getPresentPosition();
         while(currentPosBase < 155 && currentPosElbow < 145) {
             currentPosBase = Base.getPresentPosition();
-        }
+        }   
         Base.setMovingSpeed(1024+120);
     }
     else if (pos == 4) {
@@ -141,7 +141,7 @@
     Elbow.setGoalPosition(350);
     Wrist.setGoalPosition(60);
     pos = 1;
-    wait(2);
+    wait(1);
 }
 
 void measureTime() {
@@ -164,8 +164,8 @@
     Base.setMovingSpeed(1024+speed);
     Elbow.setMovingSpeed(1024+2.3*speed); // was 1024+2.2*speed
     Wrist.setMovingSpeed(1024+1.4*speed);  
-    Pan.setMovingSpeed(1024+0.3*speed);
-    Tilt.setMovingSpeed(1024+0.3*speed);
+    //Pan.setMovingSpeed(1024+0.3*speed);
+    //Tilt.setMovingSpeed(1024+0.3*speed);
 }
 
 void setLimits() {
@@ -227,10 +227,10 @@
     setSpeed(100);
     uint16_t currentPosTilt;
     uint16_t currentPosPan;
-    Pan.setCWAngleLimit(0);
-    Pan.setCCWAngleLimit(4095);
-    Pan.setGoalPosition(1850);
-    Tilt.setGoalPosition(195);
+    //Pan.setCWAngleLimit(0);
+    //Pan.setCCWAngleLimit(4095);
+    //Pan.setGoalPosition(1850);
+    //Tilt.setGoalPosition(195);
     
     Base.setGoalPosition(60);
     Elbow.setGoalPosition(350);
@@ -256,16 +256,17 @@
         else if (echo == 97) {    panIncrementLeft();   }
         else if (echo == 100) {   panIncrementRight();   }
         else {  
+            continue;
             //Tilt.setMovingSpeed(1024);
             //Pan.setMovingSpeed(1024);
-            currentPosPan = Pan.getPresentPosition();
-            Pan.setGoalPosition(currentPosPan);
+            //currentPosPan = Pan.getPresentPosition();
+            //Pan.setGoalPosition(currentPosPan);
         }
     
-        currentPosTilt = Tilt.getPresentPosition();
-        pc.printf("Tilt Position: %d\r\n",currentPosTilt);
-        currentPosPan = Pan.getPresentPosition();
-        pc.printf("Pan Position: %d\r\n",currentPosPan);
+        //currentPosTilt = Tilt.getPresentPosition();
+        //pc.printf("Tilt Position: %d\r\n",currentPosTilt);
+        //currentPosPan = Pan.getPresentPosition();
+        //pc.printf("Pan Position: %d\r\n",currentPosPan);
         
             
         /*