teamALI / Mbed 2 deprecated HB2018

Dependencies:   mbed FreeRTOS

Committer:
MasashiNomura
Date:
Wed Feb 13 11:55:39 2019 +0000
Revision:
45:3b51dd26b579
Parent:
39:1b76f7df8804
Child:
46:5074781a28dd
20190208 change and add comment. add setting val to fpga every-timing.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MasashiNomura 45:3b51dd26b579 1 /**
MasashiNomura 45:3b51dd26b579 2 * @file typedef.h
MasashiNomura 45:3b51dd26b579 3 * @brief 共通で使用する型の定義
MasashiNomura 45:3b51dd26b579 4 * @author Shirota, Nomura
MasashiNomura 45:3b51dd26b579 5 * @date 2018/10/01 ?
MasashiNomura 45:3b51dd26b579 6 */
MasashiNomura 45:3b51dd26b579 7
takeru0x1103 0:ecd925601fc6 8 #ifndef _TYPEDEF_H_
takeru0x1103 0:ecd925601fc6 9 #define _TYPEDEF_H_
takeru0x1103 0:ecd925601fc6 10 /////////////////////////////////////////////////////////////////////
takeru0x1103 18:5aa48aec9cae 11 #include "debug.h"
MasashiNomura 25:f3a6e7eec9c3 12 #include <bitset>
takeru0x1103 0:ecd925601fc6 13
MasashiNomura 45:3b51dd26b579 14
MasashiNomura 45:3b51dd26b579 15 /**
MasashiNomura 45:3b51dd26b579 16 * @def G_CMD_BUF_SIZ
MasashiNomura 45:3b51dd26b579 17 * @brief コマンド受け渡しバッファサイズ
MasashiNomura 45:3b51dd26b579 18 * @details コマンド解析タスクで使用するコマンド受け渡しバッファサイズの定義
MasashiNomura 45:3b51dd26b579 19 */
MasashiNomura 45:3b51dd26b579 20
MasashiNomura 45:3b51dd26b579 21 /**
MasashiNomura 45:3b51dd26b579 22 * @def BS
MasashiNomura 45:3b51dd26b579 23 * @brief Asciiコード BackSpace
MasashiNomura 45:3b51dd26b579 24 */
takeru0x1103 17:f9610f3cfa1b 25 #define BS 0x08
MasashiNomura 45:3b51dd26b579 26 /**
MasashiNomura 45:3b51dd26b579 27 * @def HT
MasashiNomura 45:3b51dd26b579 28 * @brief Asciiコード BackSpace
MasashiNomura 45:3b51dd26b579 29 */
takeru0x1103 17:f9610f3cfa1b 30 #define HT 0x09
takeru0x1103 17:f9610f3cfa1b 31 #define TAB 0x09
takeru0x1103 17:f9610f3cfa1b 32 #define LF 0x0A
takeru0x1103 17:f9610f3cfa1b 33 #define CR 0x0D
takeru0x1103 17:f9610f3cfa1b 34 #define SPC 0x20
takeru0x1103 17:f9610f3cfa1b 35 #define ESC 0x1B
takeru0x1103 17:f9610f3cfa1b 36
takeru0x1103 0:ecd925601fc6 37 /*
takeru0x1103 0:ecd925601fc6 38 * 共通で使用する型の定義
takeru0x1103 0:ecd925601fc6 39 *
takeru0x1103 0:ecd925601fc6 40 */
takeru0x1103 0:ecd925601fc6 41
takeru0x1103 18:5aa48aec9cae 42 typedef unsigned char UCHAR;
takeru0x1103 18:5aa48aec9cae 43 typedef unsigned short UINT16;
takeru0x1103 18:5aa48aec9cae 44 typedef short INT16;
takeru0x1103 18:5aa48aec9cae 45 typedef unsigned int UINT32;
takeru0x1103 0:ecd925601fc6 46
MasashiNomura 22:24c9c2dedca9 47 //ユーザースイッチ(ハンドル)のレジスタ読み値のビットフィールド
MasashiNomura 22:24c9c2dedca9 48 typedef union{
MasashiNomura 22:24c9c2dedca9 49 UINT16 w;
MasashiNomura 22:24c9c2dedca9 50 struct{
MasashiNomura 39:1b76f7df8804 51 UCHAR brk_l : 1; //ブレーキ左
MasashiNomura 39:1b76f7df8804 52 UCHAR flt_off : 1; //エンジンスロットル閉鎖(アイドリング)
MasashiNomura 39:1b76f7df8804 53 UCHAR r_eng_down: 1; //リアエンジンスロットルをわずかに閉じる
MasashiNomura 39:1b76f7df8804 54 UCHAR r_eng_up : 1; //リアエンジンスロットルをわずかに開く
MasashiNomura 39:1b76f7df8804 55 UCHAR rsv_1 : 1;
MasashiNomura 34:234b87f3e6ce 56 UCHAR brk_r : 1; //ブレーキ右
MasashiNomura 34:234b87f3e6ce 57 UCHAR flt_on : 1; //エンジンスロットル開放(全開 浮上)
MasashiNomura 39:1b76f7df8804 58 UCHAR f_eng_down: 1; //フロントエンジンスロットルをわずかに閉じる
MasashiNomura 36:2cc739c7e4cb 59 UCHAR f_eng_up : 1; //フロントエンジンスロットルをわずかに開く
MasashiNomura 39:1b76f7df8804 60 UCHAR all_stop : 1; //すべてのモーターストップ&エンジンスロットル閉鎖(アイドリング)-->不使用
MasashiNomura 22:24c9c2dedca9 61 }bf;
MasashiNomura 22:24c9c2dedca9 62 }typUserSw;
MasashiNomura 22:24c9c2dedca9 63
MasashiNomura 24:c5945aaae777 64 //姿勢制御用PIDパラメータ構造体
MasashiNomura 24:c5945aaae777 65 typedef struct{
MasashiNomura 24:c5945aaae777 66 float PP;
MasashiNomura 24:c5945aaae777 67 float P;
MasashiNomura 24:c5945aaae777 68 float I;
MasashiNomura 24:c5945aaae777 69 float D;
MasashiNomura 24:c5945aaae777 70 float IMax;
MasashiNomura 24:c5945aaae777 71 float IMin;
MasashiNomura 31:56c554c560c1 72 float V;
MasashiNomura 24:c5945aaae777 73 }typPidPara;
MasashiNomura 24:c5945aaae777 74
MasashiNomura 25:f3a6e7eec9c3 75 //モーターのパラメータ構造体
MasashiNomura 25:f3a6e7eec9c3 76 typedef struct{
MasashiNomura 25:f3a6e7eec9c3 77 //UCHAR num;
MasashiNomura 25:f3a6e7eec9c3 78 //INT16 offset;
MasashiNomura 25:f3a6e7eec9c3 79 INT16 limit_hi;
MasashiNomura 25:f3a6e7eec9c3 80 INT16 limit_low;
MasashiNomura 25:f3a6e7eec9c3 81 }typMotPara;
MasashiNomura 24:c5945aaae777 82
MasashiNomura 27:ff63c23bc689 83 enum DIR_TYPE {
MasashiNomura 27:ff63c23bc689 84 CW, // +
MasashiNomura 27:ff63c23bc689 85 CCW, // -
MasashiNomura 27:ff63c23bc689 86 UNK, // 不定
MasashiNomura 27:ff63c23bc689 87 };
MasashiNomura 27:ff63c23bc689 88 enum DIR_ATT_TYPE{
MasashiNomura 27:ff63c23bc689 89 CLOSING, // 近づく方向
MasashiNomura 27:ff63c23bc689 90 GO_AWAY, // 遠のく方向
MasashiNomura 27:ff63c23bc689 91 UNK_DIR, // 不定
MasashiNomura 27:ff63c23bc689 92 };
MasashiNomura 27:ff63c23bc689 93 typedef struct{
MasashiNomura 27:ff63c23bc689 94 float tarAng; //ターゲット角度
MasashiNomura 27:ff63c23bc689 95 float curAng; //現在の角度
MasashiNomura 27:ff63c23bc689 96 float curAngVelo; //角速度
MasashiNomura 27:ff63c23bc689 97 DIR_TYPE dir; //回転方向
MasashiNomura 27:ff63c23bc689 98 DIR_ATT_TYPE dir_att; //ターゲット角度に向かっているかどうかの方向
MasashiNomura 27:ff63c23bc689 99 }TypeAttData;
MasashiNomura 27:ff63c23bc689 100
MasashiNomura 25:f3a6e7eec9c3 101 typedef std::bitset<4> typFlg4Mot;
takeru0x1103 0:ecd925601fc6 102 /////////////////////////////////////////////////////////////////////
takeru0x1103 0:ecd925601fc6 103 #endif