drive down

Dependencies:   BMP280 BNO055_fusion PowerControl mbed

Fork of TEAM_G_FLOW_RIDA by Edwin Cho

Revision:
33:baf24c59affc
Parent:
31:69caabc10879
Child:
34:083073e54dbd
--- a/main.cpp	Wed Apr 20 14:39:38 2016 +0000
+++ b/main.cpp	Wed Apr 20 16:11:08 2016 +0000
@@ -36,9 +36,9 @@
 bool xGood=false;
 bool yGood=false;
 bool angleGood=false;
-int xState=X_BEGINING;
-int angleTarget=180;
-int yTarget=ROB_SIZE/2;
+int xState=X_INCREASE;
+int angleTarget=0;
+int yTarget=+10+ROB_SIZE/2;
 int pressure;
 
 //bool flag=false;
@@ -88,14 +88,16 @@
     wait(0.5);
     suction.pulsewidth_us(1200);
     wait(0.5);
+    suction.pulsewidth_us(1250);
+    wait(0.5);
     while(1) {
-        suction.pulsewidth_us(1250);
+        suction.pulsewidth_us(1300);
         /*pressure=(int)read[0];//(int)pres.getTemperature();
         if(pressure==88)
             led1=1;
         else
             led1=0;*/
-        /*uncomment this part if you want the robot to just drive down the window with no separtor
+        //uncomment this part if you want the robot to just drive down the window with no separtor
         if (xState==0) {
             motion.mStop();
             safe.kick();
@@ -111,7 +113,8 @@
             motion.setXPos(xTarget,xya.x,2,angleTarget);
             motion.setYBias(yTarget,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);
 #endif
@@ -123,7 +126,7 @@
 void send()
 {
     //Print over serial port to WiFi MCU
-    pc.printf("%c%c%c%c\n",(char)xya.x,(char)xya.y,pressure/10,pressure%10);
+    pc.printf("%c%c%c%c\n",(char)xya.x,(char)xGood,xya.a/10,xya.a%10);
 }
 
 void BrownOut()
@@ -131,7 +134,7 @@
     //Stop Motors and Driver
     motion.eStop();
     //Ensure suction on
-    suction.pulsewidth_us(2000);
+    suction.pulsewidth_us(1250);
     //Light Up Error Light Pattern
     led1=1;
     led2=0;