配列を用いて記憶走行を行っていく

Dependencies:   mbed AQM0802 CRotaryEncoder TB6612FNG

Files at this revision

API Documentation at this revision

Comitter:
GGU
Date:
Mon Nov 18 05:35:04 2019 +0000
Parent:
16:017874772ea7
Commit message:
test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 017874772ea7 -r b29e2c88b3c5 main.cpp
--- a/main.cpp	Mon Nov 18 04:31:02 2019 +0000
+++ b/main.cpp	Mon Nov 18 05:35:04 2019 +0000
@@ -274,8 +274,8 @@
     ////モータ現在速度の取得            
     Enc_Count_A=encoder_a.Get();   //エンコーダパルス数を取得
     Enc_Count_B=-encoder_b.Get();
-    //Distance_A=(Enc_Count_A*PULSE_TO_UM);  //移動距離をmm単位で格納
-    //Distance_B=(Enc_Count_B*PULSE_TO_UM);
+    Distance_A=(Enc_Count_A*PULSE_TO_UM);  //移動距離をmm単位で格納
+    Distance_B=(Enc_Count_B*PULSE_TO_UM);
     
     Distance_memory_A=(Enc_Count_A*PULSE_TO_UM);
     Distance_memory_B=(Enc_Count_B*PULSE_TO_UM);
@@ -297,8 +297,8 @@
         Marker_Run_Distance+=(Distance_A+Distance_B)/2;
     }
     //エンコーダ関連情報のリセット
-    //Distance_A=0;
-    //Distance_B=0;
+    Distance_A=0;
+    Distance_B=0;
     
     encoder_a.Set(0);
     encoder_b.Set(0);
@@ -329,7 +329,7 @@
         Motor_A_Diff[0]=(Target_Speed_A1-Speed_A);
         Motor_B_Diff[0]=(Target_Speed_B1-Speed_B);
     }
-    
+    /*
     /////モータの速度制御
     //過去の速度偏差を退避
     Motor_A_Diff[1]=Motor_A_Diff[0];
@@ -340,7 +340,7 @@
     
     Motor_A_Diff[0]=(Target_Speed_A1-Speed_A);
     Motor_B_Diff[0]=(Target_Speed_B1-Speed_B);
-    
+    */
     
     //P成分演算
     Motor_A_P=Motor_A_Diff[0]*M_KP;