DERPS

Dependencies:   BMP280 BNO055_fusion PowerControl mbed

Fork of STRAIGHT_DRIVE_NO_SEP by Antoine Laurens

Revision:
37:e8a6ea255c09
Parent:
36:dc69442c4c47
Child:
38:16208e003dc9
--- a/main.cpp	Mon Apr 25 17:47:51 2016 +0000
+++ b/main.cpp	Tue Apr 26 20:09:25 2016 +0000
@@ -38,7 +38,7 @@
 bool angleGood=false;
 bool flip=false;
 int xState=X_INCREASE;
-int angleTarget=0;
+int angleTarget=355;
 int yTarget=ROB_SIZE/2;
 int pressure;
 
@@ -87,14 +87,12 @@
     wait(0.5);
     suction.pulsewidth_us(1150);
     wait(0.5);
+    suction.pulsewidth_us(1200);
+    wait(0.5);
     suction.pulsewidth_us(1250);
     wait(0.5);
-    suction.pulsewidth_us(1300);
-    /*wait(0.5);
-    suction.pulsewidth_us(1350);
-    wait(0.5);*/
     while(1) {
-        suction.pulsewidth_us(1300);
+        suction.pulsewidth_us(1285);
         /*pressure=(int)read[0];//(int)pres.getTemperature();
         if(pressure==88)
            led1=1;
@@ -115,9 +113,10 @@
         //motion.setXPos(xTarget,xya.x,5,angleTarget,xya.a);
         xGood=motion.setXPos(xTarget,xya.x,2,0);
         if(!xGood)
-            motion.setAngle(0,xya.a,angle_error,ANGLE_BIAS);
+            motion.setAngle(angleTarget,xya.a,angle_error,ANGLE_BIAS);
         else {
             xTarget=(xTarget==120)?30:120;
+            angleTarget=(angleTarget==5)?-5:5;
         }
             //motion.setYBias(0,xya.y,2,angleTarget);
             //loc.get_xy(&xya);