2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
50:8ea4714316ce
Parent:
49:9276fda93084
Child:
51:cb430192b28b
Child:
54:9b209c5f25bc
--- a/main_ps3.cpp	Sat Sep 26 01:37:01 2015 +0000
+++ b/main_ps3.cpp	Sat Sep 26 08:43:21 2015 +0000
@@ -14,6 +14,7 @@
 #include "machine_ps3.h"
 
 Serial pc(USBTX, USBRX);
+//LocalFileSystem local("local");
 
 int main()
 {
@@ -28,9 +29,11 @@
 #endif
     Indicator4=1;
     Enable=1;
+//    FILE *fp_r = fopen("/local/velocity.dat", "w");
     /*sendData(4,31);
     wait(0.1);
     sendData(5,31);*/
+//    double time=0.0;
     while(1) {
         if(autoflag){
             autoPs3(); /*ps3 button*/
@@ -58,7 +61,7 @@
             if((x>7885.0)&&(CStep==3)) CStep=4,sendData(1,2);
             if((x<6074.0)&&(CStep==4)) CStep=5,sendData(1,4);
             if((x<5574.0)&&(CStep==5)) CStep=6,sendData(1,5);
-            pc.printf("sita:%f, x:%f, y:%f ,x1:%f, x2:%f ,velocity:%f\r\n",sita,x,y,x1,x2,velocity);
+//            pc.printf("sita:%f, x:%f, y:%f ,x1:%f, x2:%f ,velocity:%f\r\n",sita,x,y,x1,x2,velocity);
 #endif            
             move_following();
 //            pc.printf("sita:%f, x:%f, y:%f ,x1:%f, x2:%f ,velocity:%f\r\n",sita,x,y,x1,x2,velocity);
@@ -69,11 +72,18 @@
             manualPs3();     /*ps3 button*/
             //Swing
             swingFollowing();
-//            pc.printf("rad/s:%f",swingRadVelocity);.
+            /*if(square){
+                IndicatorAuto=0;
+                fclose(fp_r);
+            }
+            fprintf(fp_r, "time:%1.3f, %f[rad/s], pwm:%f\r\n",time,swingRadVelocity,cont);
+            time+=0.01;*/
         }
         /***update state***/
         mesure_state();
         mesureSwing();
         wait(RATE);
+        
+        pc.printf("%f %f\r\n",cont,swingRadVelocity);
     }
 }
\ No newline at end of file