Clara Keng / Mbed 2 deprecated FreeFlyerROS_clarakhl

Dependencies:   mbed ros_lib_kinetic

utilities.cpp

Committer:
Knillinux
Date:
2017-02-14
Revision:
0:dd126a1080d3
Child:
1:40bdbe1a93b7

File content as of revision 0:dd126a1080d3:


#include "utilities.h"
#include "mbed.h"

namespace utils {
    
    float smooth(float data, float filterVal, float smoothedVal) {
    
        if (filterVal > 1) {      // check to make sure param's are within range
            filterVal = .99;
        }  else if (filterVal <= 0) {
            filterVal = 0;
        }
        
        smoothedVal = (data * (1 - filterVal)) + (smoothedVal  *  filterVal);
        
        return (float)smoothedVal;
    }

} // end utils namespace