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 1:3513a2fbd81f, committed 2016-09-03
- Comitter:
- sakanakuuun
- Date:
- Sat Sep 03 10:53:09 2016 +0000
- Parent:
- 0:265d8ad19d2a
- Child:
- 2:d1d1f4d9b302
- Commit message:
- hi;
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 Fri Sep 02 12:40:36 2016 +0000
+++ b/locate.cpp Sat Sep 03 10:53:09 2016 +0000
@@ -24,6 +24,11 @@
/*************変数宣言終了******************/
+
+
+
+
+
void update ()
//位置情報を更新する。r,lはエンコーダから
{
@@ -33,7 +38,7 @@
dir2 = __HAL_TIM_IS_TIM_COUNTING_DOWN(&timer2);
r = -convert_enc_count(count1, dir1);
- l = convert_enc_count(count2, dir2);
+ l = -convert_enc_count(count2, dir2);
theta = (r - l) * ROUND - d_theta;
v = (r - pr + l - pl);
@@ -60,12 +65,12 @@
EncoderInit(&encoder2, &timer2, TIM2, 0xffff, TIM_ENCODERMODE_TI12);
}
-short coordinateX()
+int coordinateX()
{
return x * LOCATE_STEP / 2;
}
-short coordinateY()
+int coordinateY()
{
return y * LOCATE_STEP / 2;
}
--- a/locate.h Fri Sep 02 12:40:36 2016 +0000 +++ b/locate.h Sat Sep 03 10:53:09 2016 +0000 @@ -11,7 +11,7 @@ #define PI 3.14159 //π #define RESOLUSION 400 //P/R(分解能) #define DIAMETER 31.8 //タイヤの直径(mm) -#define ROUND_HOSEI 1.05 //角度のズレを補正 +#define ROUND_HOSEI 1.05 //角度のズレを補正 // エンコーダの1ステップあたりの距離(mm) #define LOCATE_STEP (DIAMETER*PI / RESOLUSION) @@ -34,10 +34,10 @@ void update (); //xをmm換算して整数値として返す -short coordinateX(); +int coordinateX(); //yをmm換算して整数値として返す -short coordinateY(); +int coordinateY(); //thetaを返す float coordinateTheta();
