Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed AQM0802 CRotaryEncoder TB6612FNG
Revision 15:9a35d77ac845, committed 2020-02-17
- Comitter:
- 1817106
- Date:
- Mon Feb 17 02:29:40 2020 +0000
- Parent:
- 14:584e778a20ea
- Commit message:
- test;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Sep 01 06:10:26 2019 +0000
+++ b/main.cpp Mon Feb 17 02:29:40 2020 +0000
@@ -6,14 +6,14 @@
//☆★☆★各種パラメータ調整箇所☆★☆★☆★
-#define DEFAULT_SPEED 700 //1走目の基本速度[mm/sec]
+#define DEFAULT_SPEED 800 //1走目の基本速度[mm/sec]
#define STOP_DISTANCE 200000 //停止距離200000[um]⇒20[cm]
#define TURN_POWER 0.3 //コースアウト時の旋回力
-#define PULSE_TO_UM 30 //エンコーダ1パルス当たりのタイヤ移動距離[um]
+#define PULSE_TO_UM 28 //エンコーダ1パルス当たりのタイヤ移動距離[um]
#define INTERRUPT_TIME 1000 //割りこみ周期[us]
#define DEFAULT_GRAY 0.3f //フォトリフレクタデジタル入力の閾値
//シリアル通信でSensor_Digital値を確認し調整する。
-#define MARKER_WIDTH 13000 //マーカ幅[um](ビニルテープ幅19[um]以内)
+#define MARKER_WIDTH 9000 //マーカ幅[um](ビニルテープ幅19[um]以内)
//コースの傷によってマーカ誤検知する場合は値を大きくする。
#define CROSS_JUDGE 4 //ラインセンサいくつ以上白線検知で交差点認識するか設定。
//モータ速度のゲイン関連(むやみに調整しない)
@@ -22,12 +22,12 @@
//フォトリフレクタのゲイン(外側に行くにつれ値を何倍させたいか調整する。)
#define S_K1 1.0f //float演算させる値には必ずfを付ける
-#define S_K2 2.0f //2倍
-#define S_K3 3.0f //4倍
+#define S_K2 2.1f //2倍
+#define S_K3 3.2f //4倍
//ラインセンサ各種制御成分
-#define S_KP 0.5f //ラインセンサ比例成分。大きいほど曲がりやすい
-#define S_KD 0.5f //ラインセンサ微分成分。大きいほど急なラインずれに強くなる。
+#define S_KP 0.3f //ラインセンサ比例成分。大きいほど曲がりやすい
+#define S_KD 0.4f //ラインセンサ微分成分。大きいほど急なラインずれに強くなる。
//////////☆★☆★☆★☆★☆★//////////////
@@ -48,13 +48,13 @@
//デジタル入力オブジェクト定義
DigitalIn push_sw(D13);
/////アナログ入力オブジェクト定義//////////
-AnalogIn s1(A1);
-AnalogIn s2(D3);
-AnalogIn s3(A6);
-AnalogIn s4(A5);
-AnalogIn s5(A4);
-AnalogIn s6(A3);
-AnalogIn s7(A2);
+AnalogIn s1(D3);
+AnalogIn s2(A6);
+AnalogIn s3(A5);
+AnalogIn s4(A4);
+AnalogIn s5(A3);
+AnalogIn s6(A2);
+AnalogIn s7(A1);
AnalogIn s8(A0);
///////////////////////////////////////
Serial PC(USBTX,USBRX);
@@ -328,7 +328,7 @@
lcd.print(" ");
lcd.locate(0,0);
lcd.print("STOP");
- wait(5);
+ wait(3);
Gray=DEFAULT_GRAY;
Machine_Speed=DEFAULT_SPEED;
}