![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2017年度の製作を開始します
Fork of Control_Main_Full_20160608 by
InputHandler/InputHandler.h@52:a9d23be503c6, 2017-06-10 (annotated)
- Committer:
- YusukeWakuta
- Date:
- Sat Jun 10 07:43:58 2017 +0000
- Branch:
- ?????
- Revision:
- 52:a9d23be503c6
- Parent:
- 49:87af91607b46
- Child:
- 53:947eff37d01d
?????????
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 | 52:a9d23be503c6 | 6 | #define NEUWIDTH 0.22 |
YusukeWakuta | 49:87af91607b46 | 7 | #define NORMMAX 1.0 |
YusukeWakuta | 49:87af91607b46 | 8 | #define NORMMIN -1.0 |
YusukeWakuta | 49:87af91607b46 | 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 | 49:87af91607b46 | 15 | double rawNeu; |
YusukeWakuta | 49:87af91607b46 | 16 | double rawMax; |
YusukeWakuta | 49:87af91607b46 | 17 | double rawMin; |
YusukeWakuta | 49:87af91607b46 | 18 | double shiftedMax; |
YusukeWakuta | 49:87af91607b46 | 19 | double shiftedMin; |
YusukeWakuta | 49:87af91607b46 | 20 | double NeushiftWidth; |
YusukeWakuta | 49:87af91607b46 | 21 | double upperShiftRate; |
YusukeWakuta | 49:87af91607b46 | 22 | double lowerShiftRate; |
YusukeWakuta | 49:87af91607b46 | 23 | |
YusukeWakuta | 49:87af91607b46 | 24 | public: |
YusukeWakuta | 49:87af91607b46 | 25 | InputCalc(); |
YusukeWakuta | 49:87af91607b46 | 26 | void setNeutral(float input); |
YusukeWakuta | 49:87af91607b46 | 27 | void setMaxAndMin(double input); |
YusukeWakuta | 49:87af91607b46 | 28 | |
YusukeWakuta | 49:87af91607b46 | 29 | //入力値の中央値を0とし、その分最大値と最小値をシフトします |
YusukeWakuta | 49:87af91607b46 | 30 | void shift2ZeroNeu(); |
YusukeWakuta | 49:87af91607b46 | 31 | |
YusukeWakuta | 49:87af91607b46 | 32 | //シフトした後の値を-1.0~1.0へと正規化するための比率を取得します |
YusukeWakuta | 49:87af91607b46 | 33 | void GetNormRate(); |
YusukeWakuta | 52:a9d23be503c6 | 34 | |
YusukeWakuta | 52:a9d23be503c6 | 35 | //上下の幅を合わせます |
YusukeWakuta | 52:a9d23be503c6 | 36 | float GetUpperAndLowerRate(); |
YusukeWakuta | 49:87af91607b46 | 37 | |
YusukeWakuta | 49:87af91607b46 | 38 | //値を-1.0~1.0へと正規化します |
YusukeWakuta | 52:a9d23be503c6 | 39 | void NormValue(float *input); |
YusukeWakuta | 49:87af91607b46 | 40 | |
YusukeWakuta | 49:87af91607b46 | 41 | //初期値の分、入力値を0に寄せて、拡大します。 |
YusukeWakuta | 52:a9d23be503c6 | 42 | void WidenNeutral(float* input) ; |
YusukeWakuta | 49:87af91607b46 | 43 | |
YusukeWakuta | 52:a9d23be503c6 | 44 | float CutInvalidInput(float input); |
YusukeWakuta | 49:87af91607b46 | 45 | |
YusukeWakuta | 49:87af91607b46 | 46 | //上記のメソッドを使用したループ内処理 |
YusukeWakuta | 52:a9d23be503c6 | 47 | float Processing(float input); |
YusukeWakuta | 49:87af91607b46 | 48 | }; |
YusukeWakuta | 49:87af91607b46 | 49 | #endif |