2015_robocon_bteam / Mbed 2 deprecated 2015robot_main_zenkoku

Dependencies:   PID QEI mbed

Revision:
6:ca3a74a93ae2
Parent:
5:0e6dd1ff3ff2
Child:
10:8a2255451513
--- a/main_ps3.cpp	Sat Oct 31 09:03:47 2015 +0000
+++ b/main_ps3.cpp	Sun Nov 01 02:31:30 2015 +0000
@@ -86,16 +86,17 @@
 //                targ_sita=0.1;
                 targ_sita=0.0;
             }
-            if((step==3)&&(x<2000.0)) {
+//            if((step==3)&&(x<2000.0)) {
+            if((step==3)&&(x<1900.0)) {
                 targ_sita=PI/4;
                 step=4;
             }
-            if((step==4)&&(x<0.0)) {
+            if((step==4)&&(x<100.0)) {
                 targ_velocity=0.0;
                 step=114;
             }
             /***Cylinder***/
-            if((x>3030.0+deff)&&(CStep==1)) { 
+            if((x>3130.0+deff)&&(CStep==1)) { 
                 if(!skip) sendData(1,1);
                 CStep=2; 
             }
@@ -135,7 +136,7 @@
             if((step==7)&&((velocity<500.0)&&(velocity>-500.0))){
                 flagf=0;
                 spcount=0.0;
-                targ_sita=0.035;
+                targ_sita=0.0;
                 step=8;
             }
             if((step==8)&&(x<1900.0)) {
@@ -162,7 +163,7 @@
             /////////////////////////////////////////////////////////////////////////
             /*****************************Opponents Mode****************************/
             if((step==15)&&((5700.0>x)&&(x>50.0))) {
-                targ_sita=0.025;
+                targ_sita=0.0;
                 step=16;
             }
             if((step==16)&&(x>2850.0+deff)){
@@ -172,7 +173,7 @@
             if((step==17)&&((velocity<5000.0)&&(velocity>-5000.0))){
                 flagf=0;
                 spcount=0.0;
-                targ_sita=0.035;
+                targ_sita=0.0;
                 step=18;
                 direction_controller.reset();
                 direction_controller.setBias(0.0);
@@ -203,26 +204,29 @@
             //Red
             /********************************Nomal Mode*********************************/
             if((step==0)&&((8650.0>x)&&(x>800.0))) {
-                targ_sita=-0.025;
+                targ_sita=0.0;
                 step=1;
             }
             if((step==1)&&(x>8600.0+deff)) {
                 targ_velocity=0.0;
+                direction_controller.setBias(0.0);
                 direction_controller.reset();
-                direction_controller.setBias(0.0);
+                velocity_controller.setBias(0.0);
+                velocity_controller.reset();
                 step=2;
             }
             if((step==2)&&((velocity<500.0)&&(velocity>-500.0))){
                 step=3;
                 spcount=0.0;
                 flagf=0;
-                targ_sita=-0.035;
+                targ_sita=0.0;
             }
-            if((step==3)&&(x<2000.0)) {
+//            if((step==3)&&(x<2000.0)) {
+            if((step==3)&&(x<1850.0)) {
                 targ_sita=-PI/4;
                 step=4;
             }
-            if((step==4)&&(x<0.0)) {
+            if((step==4)&&(x<100.0)) {
                 targ_velocity=0.0;
                 step=114;
             }