2017年度の製作を開始します

Dependencies:   mbed mbed-rtos

Fork of Control_Main_Full_20160608 by albatross

Branch:
?????
Revision:
52:a9d23be503c6
Parent:
51:8a579a19a4ff
Child:
53:947eff37d01d
--- a/InputHandler/InputHandler.cpp	Wed Jun 07 14:14:09 2017 +0000
+++ b/InputHandler/InputHandler.cpp	Sat Jun 10 07:43:58 2017 +0000
@@ -39,6 +39,11 @@
     shiftedMin = rawMin - rawNeu;
 }
 
+float InputCalc::GetUpperAndLowerRate()
+{
+    return shiftedMax / (-shiftedMin);
+}
+
 //シフトした後の値を-1.0~1.0へと正規化するための比率を取得します
 void InputCalc::GetNormRate()
 {
@@ -47,8 +52,10 @@
 }
 
 //値を-1.0~1.0へと正規化します
-void InputCalc::NormValue(double *input)
+void InputCalc::NormValue(float *input)
 {
+    if(*input< 0.0)
+        *input *= GetUpperAndLowerRate();
     *input -= rawNeu;
     if (*input > 0.0)
         *input *= upperShiftRate;
@@ -57,7 +64,7 @@
 }
 
 //初期値の分、入力値を0に寄せて、拡大します。
-void InputCalc::WidenNeutral(double *input)
+void InputCalc::WidenNeutral(float *input)
 {
     if (-NEUWIDTH < *input&& *input < NEUWIDTH)
         *input = 0;
@@ -71,15 +78,16 @@
 }
 
 //範囲外の値を下限値と上限値に置き換える
-double InputCalc::CutInvalidInput(double input)
+float InputCalc::CutInvalidInput(float input)
 {
     if(input > NORMMAX)
         input = NORMMAX;
     else if(input < NORMMIN)
         input = NORMMIN;
+    return input;
 }
 
-double InputCalc::Processing(double input)
+float InputCalc::Processing(float input)
 {
     setMaxAndMin(input);
     shift2ZeroNeu();