![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2017年度の製作を開始します
Fork of Control_Main_Full_20160608 by
InputHandler/InputHandler.h@54:65e6baedec04, 2017-06-16 (annotated)
- Committer:
- YusukeWakuta
- Date:
- Fri Jun 16 12:25:26 2017 +0000
- Branch:
- ?????
- Revision:
- 54:65e6baedec04
- Parent:
- 53:947eff37d01d
6/16TF?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YusukeWakuta | 49:87af91607b46 | 1 | #ifndef InputHandler |
YusukeWakuta | 49:87af91607b46 | 2 | #define InputHandler |
YusukeWakuta | 49:87af91607b46 | 3 | |
YusukeWakuta | 49:87af91607b46 | 4 | #include "mbed.h" |
YusukeWakuta | 49:87af91607b46 | 5 | |
YusukeWakuta | 53:947eff37d01d | 6 | #define NEUWIDTH 0.05 |
YusukeWakuta | 49:87af91607b46 | 7 | #define NORMMAX 1.0 |
YusukeWakuta | 49:87af91607b46 | 8 | #define NORMMIN -1.0 |
YusukeWakuta | 53:947eff37d01d | 9 | #define WIDENRATE (NORMMAX/(NORMMAX - NEUWIDTH)) |
YusukeWakuta | 49:87af91607b46 | 10 | #define NEUTRAL_SUM_NUM 10 |
YusukeWakuta | 49:87af91607b46 | 11 | |
YusukeWakuta | 49:87af91607b46 | 12 | class InputCalc |
YusukeWakuta | 49:87af91607b46 | 13 | { |
YusukeWakuta | 49:87af91607b46 | 14 | private: |
YusukeWakuta | 53:947eff37d01d | 15 | |
YusukeWakuta | 53:947eff37d01d | 16 | |
YusukeWakuta | 53:947eff37d01d | 17 | public: |
YusukeWakuta | 49:87af91607b46 | 18 | double rawNeu; |
YusukeWakuta | 49:87af91607b46 | 19 | double rawMax; |
YusukeWakuta | 49:87af91607b46 | 20 | double rawMin; |
YusukeWakuta | 49:87af91607b46 | 21 | double shiftedMax; |
YusukeWakuta | 49:87af91607b46 | 22 | double shiftedMin; |
YusukeWakuta | 49:87af91607b46 | 23 | double NeushiftWidth; |
YusukeWakuta | 49:87af91607b46 | 24 | double upperShiftRate; |
YusukeWakuta | 49:87af91607b46 | 25 | double lowerShiftRate; |
YusukeWakuta | 49:87af91607b46 | 26 | InputCalc(); |
YusukeWakuta | 49:87af91607b46 | 27 | void setNeutral(float input); |
YusukeWakuta | 49:87af91607b46 | 28 | void setMaxAndMin(double input); |
YusukeWakuta | 49:87af91607b46 | 29 | |
YusukeWakuta | 49:87af91607b46 | 30 | //入力値の中央値を0とし、その分最大値と最小値をシフトします |
YusukeWakuta | 49:87af91607b46 | 31 | void shift2ZeroNeu(); |
YusukeWakuta | 49:87af91607b46 | 32 | |
YusukeWakuta | 49:87af91607b46 | 33 | //シフトした後の値を-1.0~1.0へと正規化するための比率を取得します |
YusukeWakuta | 49:87af91607b46 | 34 | void GetNormRate(); |
YusukeWakuta | 52:a9d23be503c6 | 35 | |
YusukeWakuta | 49:87af91607b46 | 36 | //値を-1.0~1.0へと正規化します |
YusukeWakuta | 52:a9d23be503c6 | 37 | void NormValue(float *input); |
YusukeWakuta | 49:87af91607b46 | 38 | |
YusukeWakuta | 49:87af91607b46 | 39 | //初期値の分、入力値を0に寄せて、拡大します。 |
YusukeWakuta | 52:a9d23be503c6 | 40 | void WidenNeutral(float* input) ; |
YusukeWakuta | 49:87af91607b46 | 41 | |
YusukeWakuta | 54:65e6baedec04 | 42 | void CutInvalidInput(float* input); |
YusukeWakuta | 49:87af91607b46 | 43 | |
YusukeWakuta | 49:87af91607b46 | 44 | //上記のメソッドを使用したループ内処理 |
YusukeWakuta | 52:a9d23be503c6 | 45 | float Processing(float input); |
YusukeWakuta | 49:87af91607b46 | 46 | }; |
YusukeWakuta | 49:87af91607b46 | 47 | #endif |