ジャイロ補正を追加したプログラム
Dependencies: mbed YKNCT_Movement SBDBT BNO055 YKNCT_MD YKNCT_I2C
main.h@1:b9f698be841c, 2020-03-14 (annotated)
- Committer:
- yoshikawaryota
- Date:
- Sat Mar 14 05:29:14 2020 +0000
- Revision:
- 1:b9f698be841c
- Parent:
- 0:9e851dc42cde
add Gyro;Ver.Yoshikawa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TakushimaYukimasa | 0:9e851dc42cde | 1 | |
TakushimaYukimasa | 0:9e851dc42cde | 2 | /** |
TakushimaYukimasa | 0:9e851dc42cde | 3 | ****************************************************************************** |
TakushimaYukimasa | 0:9e851dc42cde | 4 | * @file main.h |
TakushimaYukimasa | 0:9e851dc42cde | 5 | * @author You |
TakushimaYukimasa | 0:9e851dc42cde | 6 | * @version V?.?.? |
TakushimaYukimasa | 0:9e851dc42cde | 7 | * @date Today |
TakushimaYukimasa | 0:9e851dc42cde | 8 | * @brief メインのヘッダファイル |
TakushimaYukimasa | 0:9e851dc42cde | 9 | ****************************************************************************** |
TakushimaYukimasa | 0:9e851dc42cde | 10 | */ |
TakushimaYukimasa | 0:9e851dc42cde | 11 | /* Includes ------------------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 12 | #include <mbed.h> |
TakushimaYukimasa | 0:9e851dc42cde | 13 | #include <BNO055.h> |
TakushimaYukimasa | 0:9e851dc42cde | 14 | #include <SBDBT.h> |
TakushimaYukimasa | 0:9e851dc42cde | 15 | #include <YKNCT_I2C.h> |
TakushimaYukimasa | 0:9e851dc42cde | 16 | #include <YKNCT_MD.h> |
TakushimaYukimasa | 0:9e851dc42cde | 17 | #include <movement.h> |
TakushimaYukimasa | 0:9e851dc42cde | 18 | |
TakushimaYukimasa | 0:9e851dc42cde | 19 | /* 型定義 --------------------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 20 | |
TakushimaYukimasa | 0:9e851dc42cde | 21 | /* 座標管理構造体 X,Y,thetaはいずれもdouble型 */ |
TakushimaYukimasa | 0:9e851dc42cde | 22 | struct ROCATION |
TakushimaYukimasa | 0:9e851dc42cde | 23 | { |
TakushimaYukimasa | 0:9e851dc42cde | 24 | double X; |
TakushimaYukimasa | 0:9e851dc42cde | 25 | double Y; |
TakushimaYukimasa | 0:9e851dc42cde | 26 | double theta; |
TakushimaYukimasa | 0:9e851dc42cde | 27 | }; |
TakushimaYukimasa | 0:9e851dc42cde | 28 | |
TakushimaYukimasa | 0:9e851dc42cde | 29 | /* 定数定義 ------------------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 30 | |
TakushimaYukimasa | 0:9e851dc42cde | 31 | /* π */ |
TakushimaYukimasa | 0:9e851dc42cde | 32 | #define PI 3.1415926535 |
TakushimaYukimasa | 0:9e851dc42cde | 33 | |
TakushimaYukimasa | 0:9e851dc42cde | 34 | /* Encoderの最大数 */ |
TakushimaYukimasa | 0:9e851dc42cde | 35 | #define EncoderMAX 2 |
TakushimaYukimasa | 0:9e851dc42cde | 36 | |
TakushimaYukimasa | 0:9e851dc42cde | 37 | /* マクロ定義 ----------------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 38 | /* 2つの値を比較して小さい方を返す */ |
TakushimaYukimasa | 0:9e851dc42cde | 39 | #define M_MIN(__VALUE1__, __VALUE2__) ((__VALUE1__) < (__VALUE2__) ? (__VALUE1__) : (__VALUE2__)) |
TakushimaYukimasa | 0:9e851dc42cde | 40 | |
TakushimaYukimasa | 0:9e851dc42cde | 41 | /* 2つの値を比較して大きい方を返す */ |
TakushimaYukimasa | 0:9e851dc42cde | 42 | #define M_MAX(__VALUE1__, __VALUE2__) ((__VALUE1__) > (__VALUE2__) ? (__VALUE1__) : (__VALUE2__)) |
TakushimaYukimasa | 0:9e851dc42cde | 43 | |
TakushimaYukimasa | 0:9e851dc42cde | 44 | /* 絶対値を返す */ |
TakushimaYukimasa | 0:9e851dc42cde | 45 | #define ABS(__VALUE1__) ((__VALUE1__) < 0 ? -(__VALUE1__) : (__VALUE1__)) |
TakushimaYukimasa | 0:9e851dc42cde | 46 | |
TakushimaYukimasa | 0:9e851dc42cde | 47 | /* Enc角度から距離に変換 */ |
TakushimaYukimasa | 0:9e851dc42cde | 48 | #define DEG_TO_DIS(__DEGREE__) (50.8 * PI * (__DEGREE__) / 360) |
TakushimaYukimasa | 0:9e851dc42cde | 49 | |
TakushimaYukimasa | 0:9e851dc42cde | 50 | /* Enc角度から距離に変換 */ |
TakushimaYukimasa | 0:9e851dc42cde | 51 | #define DEG_TO_HIGH(__DEGREE__) (50.0 * PI * (__DEGREE__) / 360) |
TakushimaYukimasa | 0:9e851dc42cde | 52 | |
TakushimaYukimasa | 0:9e851dc42cde | 53 | /* Radian,Degree変換 */ |
TakushimaYukimasa | 0:9e851dc42cde | 54 | /* 定義被ったためコメントアウト */ |
TakushimaYukimasa | 0:9e851dc42cde | 55 | //#define RAD_TO_DEG(__RADIAN__) (180 * (__RADIAN__) / PI) |
TakushimaYukimasa | 0:9e851dc42cde | 56 | //#define DEG_TO_RAD(__DEGREE__) ((__DEGREE__)*PI / 180) |
TakushimaYukimasa | 0:9e851dc42cde | 57 | |
TakushimaYukimasa | 0:9e851dc42cde | 58 | /* lim以上のデータを補整する */ |
TakushimaYukimasa | 0:9e851dc42cde | 59 | #define Rest(__val__, __Limit__) ((__val__) >= (__Limit__) ? (__Limit__) : ((__val__) <= (-(__Limit__)) ? (-(__Limit__)) : (__val__))) |
TakushimaYukimasa | 0:9e851dc42cde | 60 | |
TakushimaYukimasa | 0:9e851dc42cde | 61 | /* コントローラー SerectとStartを実装 */ |
TakushimaYukimasa | 0:9e851dc42cde | 62 | #define Select (DS3.LEFTkey+DS3.RIGHTkey==2) |
TakushimaYukimasa | 0:9e851dc42cde | 63 | #define Start (DS3.UPkey+DS3.DOWNkey==2) |
TakushimaYukimasa | 0:9e851dc42cde | 64 | |
TakushimaYukimasa | 0:9e851dc42cde | 65 | /* 関数プロトタイプ宣言 -------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 66 | /* 変数定義 ------------------------------------------------------------------*/ |
TakushimaYukimasa | 0:9e851dc42cde | 67 | /* クラス定義 ----------------------------------------------------------------*/ |