DERPS

Dependencies:   BMP280 BNO055_fusion PowerControl mbed

Fork of STRAIGHT_DRIVE_NO_SEP by Antoine Laurens

Revision:
35:68917796c30a
Parent:
34:083073e54dbd
Child:
36:dc69442c4c47
--- a/main.cpp	Wed Apr 20 18:25:43 2016 +0000
+++ b/main.cpp	Sun Apr 24 22:37:07 2016 +0000
@@ -32,13 +32,14 @@
 void BrownOut();
 
 int xTarget=120;
-int angle_error=2;
+int angle_error=0;
 bool xGood=false;
 bool yGood=false;
 bool angleGood=false;
+bool flip=false;
 int xState=X_INCREASE;
 int angleTarget=0;
-int yTarget=+10+ROB_SIZE/2;
+int yTarget=ROB_SIZE/2;
 int pressure;
 
 //bool flag=false;
@@ -89,10 +90,12 @@
     suction.pulsewidth_us(1250);
     wait(0.5);
     suction.pulsewidth_us(1300);
-    wait(0.5);
+    /*wait(0.5);
+    suction.pulsewidth_us(1350);
+    wait(0.5);*/
     while(1) {
-        suction.pulsewidth_us(1350);
-        /*pressure=(int)read[0];//(int)pres.getTemperature();
+        suction.pulsewidth_us(1300);
+         /*pressure=(int)read[0];//(int)pres.getTemperature();
         if(pressure==88)
             led1=1;
         else
@@ -105,15 +108,13 @@
         }
         loc.get_xy(&xya);
         motion.check_xya(&xGood,&yGood,&angleGood,xTarget,angleTarget,yTarget,xya,3,3,angle_error);
-
+ 
         motion.setXstate(&xState,&xTarget,xGood,angleGood,&angleTarget,&angle_error,yTarget);
         //motion.setAngleTol(&angle_error,yGood,xGood);
        // motion.setYgoal(xGood,angleGood,yGood,&yTarget);
-        if(motion.setAngle(angleTarget,xya.a,angle_error,ANGLE_TURN)) {
-            motion.setXPos(xTarget,xya.x,2,angleTarget);
-         //   motion.setYBias(yTarget,xya.y,2,angleTarget);
-
-        }
+        motion.setXPos(xTarget,xya.x,5,angleTarget,xya.a);
+        motion.setAngle(angleTarget,xya.a,angle_error,ANGLE_BIAS);
+            //motion.setYBias(0,xya.y,2,angleTarget);
         //loc.get_xy(&xya);
 #if defined(PC_MODE)
         pc.printf("X: %3d\tY: %3d\tP: %3d\txGood: %d\tAngleGood: %d\tState: %d \n",xya.y,yTarget,xya.a,xGood,angleGood,xState);