春ロボ ロケット団 / Mbed 2 deprecated Spring_motor_test2

Dependencies:   mbed SpeedController Encoder CruizCore_R1370P

Revision:
21:46b85fee5e88
Parent:
20:acb13e232678
Child:
22:5c78d75fb2f2
--- a/main.cpp	Mon Mar 09 08:35:41 2020 +0000
+++ b/main.cpp	Mon Mar 09 09:16:48 2020 +0000
@@ -117,10 +117,10 @@
     }
     void calOmega()
     {
-        omega[0]=max_*vx_/sqrt(2.0)-max_*vy_/sqrt(2.0)+theta_*k_;
-        omega[1]=-max_*vx_/sqrt(2.0)-max_*vy_/sqrt(2.0)+theta_*k_;
-        omega[2]=-max_*vx_/sqrt(2.0)+max_*vy_/sqrt(2.0)+theta_*k_;
-        omega[3]=max_*vx_/sqrt(2.0)+max_*vy_/sqrt(2.0)+theta_*k_;
+        omega[0]=max_*vx_*cos(45+theta)-max_*vy_*cos(45-theta)+theta_*k_;
+        omega[1]=-max_*vx_*cos(45-theta)-max_*vy_*cos(45+theta)+theta_*k_;
+        omega[2]=-max_*vx_*cos(45+theta)+max_*vy_*cos(45-theta)+theta_*k_;
+        omega[3]=max_*vx_*cos(45-theta)+max_*vy_*cos(45+theta)+theta_*k_;
     };
     double getOmega(int i)
     {
@@ -230,7 +230,7 @@
         if(distance<400) {
             z=0;
             while(1) {
-                d=aimTheta[n]-gyro.getAngle();
+                d=aimTheta[n]-theta;
                 if(d>-10 && d<10) {
                     break;
                 }