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.
Dependents: 4thcomp 6th33222_copy
Fork of Locate by
Revision 9:69fe7b8350c6, committed 2016-09-16
- Comitter:
- choutin
- Date:
- Fri Sep 16 08:48:12 2016 +0000
- Parent:
- 8:ecd49a9ee2ee
- Child:
- 10:d88fe87720d2
- Commit message:
- a
Changed in this revision
| locate.cpp | Show annotated file Show diff for this revision Revisions of this file |
| locate.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/locate.cpp Sun Sep 11 12:05:24 2016 +0000
+++ b/locate.cpp Fri Sep 16 08:48:12 2016 +0000
@@ -36,11 +36,11 @@
//counting on both A&B inputs, 4 ticks per cycle, 16-bit count
//use PB6 PB7 = Nucleo D7 D8
- EncoderInit(&encoder1, &timer1, TIM4, 0xffff, TIM_ENCODERMODE_TI12);
+ EncoderInit(&encoder1, &timer1, TIM4, 0xffff, TIM_ENCODERMODE_TI1);
//counting on both A&B inputs, 4 ticks per cycle, 16-bit count
//use PA0 PA1 = Nucleo A0 A1
- EncoderInit(&encoder2, &timer2, TIM2, 0xffff, TIM_ENCODERMODE_TI12);
+ EncoderInit(&encoder2, &timer2, TIM2, 0xffff, TIM_ENCODERMODE_TI1);
teamcolor = team;
}
--- a/locate.h Sun Sep 11 12:05:24 2016 +0000 +++ b/locate.h Fri Sep 16 08:48:12 2016 +0000 @@ -9,12 +9,12 @@ #define OUTERRING_D 140 //外輪間距離(mm) #define INNERRING_D 136 //内輪間距離(mm) #define PI 3.14159 //π -#define RESOLUSION 400 //P/R(分解能) +#define RESOLUSION 200 //P/R(分解能) #define DIAMETER 31.8 //タイヤの直径(mm) -#define ROUND_HOSEI 1.038 //角度のズレを補正 - -// エンコーダの1ステップあたりの距離(mm) -#define LOCATE_STEP (DIAMETER*PI / RESOLUSION) +#define ROUND_HOSEI 1.038 //角度のズレを補正.038 +#define HOSEI 1.00 +// エンコーダの1ステップあたりの距離;(mm) +#define LOCATE_STEP (DIAMETER*PI / RESOLUSION * HOSEI) //タイヤ間距離(mm) #define TIRE_DISTANCE ((OUTERRING_D + INNERRING_D) / 2) //機体が1回転するために必要なステップ数の”逆数”
