春ロボ1班(元F3RC4班+) / PathFollowing1-ver2

Dependencies:   CruizCore_R1370P

Fork of PathFollowing1 by 春ロボ1班(元F3RC4班+)

Revision:
1:9858517eef98
Parent:
0:3d9101dd0061
diff -r 3d9101dd0061 -r 9858517eef98 PathFollowing1.cpp
--- a/PathFollowing1.cpp	Wed Oct 31 09:56:08 2018 +0000
+++ b/PathFollowing1.cpp	Wed Oct 31 10:13:49 2018 +0000
@@ -49,9 +49,10 @@
     old_timeR=now_timeR;
 
 //////////////////////////<XYRmotorout関数内>以下、x軸方向、y軸方向、旋回の出力をそれぞれad_x_out,ad_y_out,ad_r_outの指すアドレスに書き込む/////////////////////////////
+////////////////////////////////////////////その際、x軸方向、y軸方向の出力はフィールドの座標系から機体の座標系に変換する。///////////////////////////////////////////////
 
-    *ad_x_out = VectorOut_P[0]+VectorOut_Q[0];
-    *ad_y_out = VectorOut_P[1]+VectorOut_Q[1];
+    *ad_x_out = (VectorOut_P[0]+VectorOut_Q[0])*cos(now_angle)-(VectorOut_P[1]+VectorOut_Q[1])*sin(now_angle);
+    *ad_y_out = (VectorOut_P[0]+VectorOut_Q[0])*sin(now_angle)+(VectorOut_P[1]+VectorOut_Q[1])*cos(now_angle);
     *ad_r_out = out_dutyR;
    
 }