to takasou

Dependencies:   SerialMultiByte QEI chatteringremoval omni_wheel prototype01 towelest PID ikarashiMDC_2byte_ver air2 OmniPosition PS3

Revision:
1:e7413a7b013b
Parent:
0:d3db2b0afc76
Child:
2:d01bc3dcb247
diff -r d3db2b0afc76 -r e7413a7b013b main.cpp
--- a/main.cpp	Mon Sep 23 12:25:26 2019 +0000
+++ b/main.cpp	Mon Sep 23 23:30:38 2019 +0000
@@ -25,7 +25,7 @@
 DigitalOut LED(LED1);
 Timer timer;
 
-int num = 0,X,Y,b[12],stick[4],trigger[2],loli[3];
+int num = 0, X, Y, b[12], stick[4], trigger[2], loli[3], b+[12];
 int X0,Y0,X1,Y1;
 double valueX, valueY, value[4],mecha_power[4],spin_power=0, IRdistance[2],TFdistance[2],x2, y2;
 
@@ -50,6 +50,7 @@
 
 Proto1 proto(500, 700, 0.4, 0.14);
 
+
 void getSensorData()       //Receive sensor value 
 {
     UnionBytes bytedata;
@@ -220,7 +221,7 @@
         
         towel.setPulse(loli[2]);
         
-        //PS3 value
+//      PS3 value
         for(int i = 0; i < 12; i++) {
             b[i] = ps3.getButton(i);
             pc.printf("%2d", b[i] );
@@ -334,6 +335,10 @@
             proto.calculate();
             omni.computeXY(proto.getvalue_x(), proto.getvalue_y(), spin_power);
         }
+        /*
+        omni.conputeCircular(proto.getValue(), proto.gettheta(), spin_power);
+        機体の向きに関係ないスティック操作をしたい場合はspin_powerに、スティックの角度(atan2(スティックのy座標,スティックのx座標))を足せば良い
+        */
         
         for(int i = 0; i < 4; i++){
             value[i] = omni.wheel[i];
@@ -350,5 +355,8 @@
 //        pc.printf("x:%d y:%d θ:%f now:%f",posi.getX(),posi.getY(),posi.getTheta(),proto.nowDis);
         
         pc.printf("\r\n");
+        for(int i = 0; i < 12; i++) {
+            b+[i] = ps3.getButton(i);
+        }
     }
 }