remove unused error averaging from Utilities
authordave russo <d-russo@ti.com>
Tue, 13 Oct 2015 18:27:26 +0000 (11:27 -0700)
committerdave russo <d-russo@ti.com>
Tue, 13 Oct 2015 18:27:26 +0000 (11:27 -0700)
src/Energia/libraries/ZumoCC3200/examples/AssistedDrive/MotorControlLoop.ino
src/Energia/libraries/ZumoCC3200/utility/DriveLineCommand.cpp
src/Energia/libraries/ZumoCC3200/utility/TurnAngleCommand.cpp
src/Energia/libraries/ZumoCC3200/utility/Utilities.cpp
src/Energia/libraries/ZumoCC3200/utility/Utilities.h

index f74c02e50d0adc556424a937681fe8eb26173baa..5ed7e44fc39cd24f343a0aef64dc1f25456c6a2b 100644 (file)
@@ -230,7 +230,6 @@ void turnAngle(float angle, float rate)
     float power;
 
     if (!targetAngleSet) {
-        Utilities::reInitErrorVals();
         float currHeading = IMUManager::getGyroYaw();
         targetAngle = Utilities::wrapAngle(currHeading + angle);
         targetAngleSet = true;
index 0b665bda02d84eb604d0dd473a95156261beee8b..d7714065d8c3060f2168c9e186d506832b4cb4ef 100644 (file)
@@ -89,7 +89,6 @@ void DriveLineCommand::initialize()
     initTime = millis();
     initialized = true;
     timedOut = false;
-    Utilities::reInitErrorVals();
 }
 
 void DriveLineCommand::end()
index 604b550315a332bdd7c4d3e76f50a8d8e11447b8..306ad1ab86527fed834ebfd950d6afa2dd8e40fe 100644 (file)
@@ -93,7 +93,6 @@ void TurnAngleCommand::run(Utilities::MotorInfo &info)
 
 void TurnAngleCommand::initialize()
 {
-    Utilities::reInitErrorVals();
     initTime = millis();
     initialized = true;
     timedOut = false;
index e839701094d98ea484ddef97cc95853f5049652c..077287045b8ce167b53be431c44ae40231f2aa05 100644 (file)
 
 #define NUM_ERRORVALS 10
 
-static float errorVals[NUM_ERRORVALS] = {0};
-
 Utilities::Utilities()
 {
-    reInitErrorVals();
 }
 
 float Utilities::wrapAngle(float angle)
@@ -77,20 +74,7 @@ float Utilities::saturate(float value, float min, float max)
 
 bool Utilities::inRange(float value, float lowerBound, float upperBound)
 {
-#if 0
-    float sum = 0;
-    for (int i = NUM_ERRORVALS - 1; i > 0; i--) {
-        errorVals[i] = errorVals[i - 1];
-        sum += errorVals[i];
-    }
-    sum += value;
-    errorVals[0] = value;
-    float avg = sum / NUM_ERRORVALS;
-    bool settled = (avg > lowerBound) && (avg < upperBound);
-    return (settled);
-#else
     return ((value > lowerBound) && (value < upperBound));
-#endif
 }
 
 int Utilities::clip(int a)
@@ -115,13 +99,6 @@ float Utilities::clip(float a)
     return a;
 }
 
-void Utilities::reInitErrorVals()
-{
-    for (int i = 0; i < (sizeof(errorVals) / sizeof(float)); i++) {
-        errorVals[i] = 0;
-    }
-}
-
 int Utilities::min(int a, int b)
 {
     if (a < b) {
index 0196aa83930798f9456e831bc41a30c9484da3d2..6073963dcbb7cbbf9dc52b8eac409911967e464b 100644 (file)
@@ -49,7 +49,6 @@ public:
     static bool inRange(float value, float lowerBound, float upperBound);
     static int clip(int input);
     static float clip(float input);
-    static void reInitErrorVals();
     static int min(int a, int b);
     static int max(int a, int b);
     static float toDegrees(float angle);