Clara Keng / Mbed 2 deprecated FreeFlyerROS_clarakhl

Dependencies:   mbed ros_lib_kinetic

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers utilities.h Source File

utilities.h

00001 
00002 #ifndef UTILITIES_H_INCLUDED
00003 #define UTILITIES_H_INCLUDED
00004 
00005 #include "mbed.h"
00006 
00007 namespace utils {
00008     // From http://playground.arduino.cc/Main/Smooth
00009     /*Details: Smooth takes three parameters, the value to smoothed, the filter value (filterVal), and smoothedVal.
00010     
00011      float  sensVal - the sensor variable - raw material to be smoothed
00012     
00013      float  filterVal - The filter value is a float and must be between 0 and .9999 say. 0 is off (no smoothing) and .9999 is maximum smoothing.
00014      The actual performance of the filter is going to be dependent on fast you are sampling your sensor (the total loop time), so 
00015      some trial and error will probably be necessary to get the desired response.
00016     
00017      smoothedVal    -  Use this for the output of the sensor and also feed it back into the loop. Each sensor needs its own value.
00018      Don't use this variable for any other purpose.*/
00019     float smooth(float data, float filterVal, float smoothedVal);
00020     
00021     float min(float a, float b);
00022     
00023     void printBits(char myByte, Serial &pc);
00024 } // end utils namespace
00025 
00026 
00027 #endif  // End include guard