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.
typedef.h
- Committer:
- MasashiNomura
- Date:
- 2019-02-13
- Revision:
- 45:3b51dd26b579
- Parent:
- 39:1b76f7df8804
- Child:
- 46:5074781a28dd
File content as of revision 45:3b51dd26b579:
/**
* @file typedef.h
* @brief 共通で使用する型の定義
* @author Shirota, Nomura
* @date 2018/10/01 ?
*/
#ifndef _TYPEDEF_H_
#define _TYPEDEF_H_
/////////////////////////////////////////////////////////////////////
#include "debug.h"
#include <bitset>
/**
* @def G_CMD_BUF_SIZ
* @brief コマンド受け渡しバッファサイズ
* @details コマンド解析タスクで使用するコマンド受け渡しバッファサイズの定義
*/
/**
* @def BS
* @brief Asciiコード BackSpace
*/
#define BS 0x08
/**
* @def HT
* @brief Asciiコード BackSpace
*/
#define HT 0x09
#define TAB 0x09
#define LF 0x0A
#define CR 0x0D
#define SPC 0x20
#define ESC 0x1B
/*
* 共通で使用する型の定義
*
*/
typedef unsigned char UCHAR;
typedef unsigned short UINT16;
typedef short INT16;
typedef unsigned int UINT32;
//ユーザースイッチ(ハンドル)のレジスタ読み値のビットフィールド
typedef union{
UINT16 w;
struct{
UCHAR brk_l : 1; //ブレーキ左
UCHAR flt_off : 1; //エンジンスロットル閉鎖(アイドリング)
UCHAR r_eng_down: 1; //リアエンジンスロットルをわずかに閉じる
UCHAR r_eng_up : 1; //リアエンジンスロットルをわずかに開く
UCHAR rsv_1 : 1;
UCHAR brk_r : 1; //ブレーキ右
UCHAR flt_on : 1; //エンジンスロットル開放(全開 浮上)
UCHAR f_eng_down: 1; //フロントエンジンスロットルをわずかに閉じる
UCHAR f_eng_up : 1; //フロントエンジンスロットルをわずかに開く
UCHAR all_stop : 1; //すべてのモーターストップ&エンジンスロットル閉鎖(アイドリング)-->不使用
}bf;
}typUserSw;
//姿勢制御用PIDパラメータ構造体
typedef struct{
float PP;
float P;
float I;
float D;
float IMax;
float IMin;
float V;
}typPidPara;
//モーターのパラメータ構造体
typedef struct{
//UCHAR num;
//INT16 offset;
INT16 limit_hi;
INT16 limit_low;
}typMotPara;
enum DIR_TYPE {
CW, // +
CCW, // -
UNK, // 不定
};
enum DIR_ATT_TYPE{
CLOSING, // 近づく方向
GO_AWAY, // 遠のく方向
UNK_DIR, // 不定
};
typedef struct{
float tarAng; //ターゲット角度
float curAng; //現在の角度
float curAngVelo; //角速度
DIR_TYPE dir; //回転方向
DIR_ATT_TYPE dir_att; //ターゲット角度に向かっているかどうかの方向
}TypeAttData;
typedef std::bitset<4> typFlg4Mot;
/////////////////////////////////////////////////////////////////////
#endif