簡易的な加減速が可能な走行プログラム

Dependencies:   mbed AQM0802 CRotaryEncoder TB6612FNG

Files at this revision

API Documentation at this revision

Comitter:
GGU
Date:
Wed Nov 20 04:41:18 2019 +0000
Parent:
20:3b35311f4576
Commit message:
test;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3b35311f4576 -r 97cc65e61580 main.cpp
--- a/main.cpp	Tue Nov 19 11:12:26 2019 +0000
+++ b/main.cpp	Wed Nov 20 04:41:18 2019 +0000
@@ -7,7 +7,7 @@
 
 //☆★☆★各種パラメータ調整箇所☆★☆★☆★
 #define     DEFAULT_SPEED   300     //1走目の基本速度[mm/sec]
-#define     DEFAULT_SPEED1  600
+#define     DEFAULT_SPEED1  800
 #define     DEFAULT_SPEED2  900
 #define     STOP_DISTANCE   200000  //停止距離200000[um]⇒20[cm]
 #define     TURN_POWER      0.6     //コースアウト時の旋回力
@@ -338,23 +338,22 @@
     
     /////各モータの目標速度の設定
     if(Sw==0){
+        Target_Speed_A=Medium_Speed;
+        Target_Speed_B=Medium_Speed;
+        
         Motor_A_Diff[1]=Motor_A_Diff[0];
         Motor_B_Diff[1]=Motor_B_Diff[0];
-        
-//        Target_Speed_A=Medium_Speed;
-//        Target_Speed_B=Medium_Speed;
-        
+                
         Motor_A_Diff[0]=(Target_Speed_A-Speed_A);
         Motor_B_Diff[0]=(Target_Speed_B-Speed_B);
     }
     else {
+        Target_Speed_A1=High_Speed;
+        Target_Speed_B1=High_Speed;
         
         Motor_A_Diff[1]=Motor_A_Diff[0];
         Motor_B_Diff[1]=Motor_B_Diff[0];   
-        
-//        Target_Speed_A1=High_Speed;
-//        Target_Speed_B1=High_Speed;
-        
+                
         Motor_A_Diff[0]=(Target_Speed_A1-Speed_A);
         Motor_B_Diff[0]=(Target_Speed_B1-Speed_B);
     }
@@ -480,8 +479,8 @@
                 wait(2);
                 Stop_Distance=0;
                 Machine_Status&=0x7F;//ストップ状態解除 
-                Target_Speed_A=Medium_Speed;
-                Target_Speed_B=Medium_Speed;
+                //Target_Speed_A=Medium_Speed;
+                //Target_Speed_B=Medium_Speed;
                 
                   
             }else{//機体走行中であったとき