Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
utilities.h@0:dd126a1080d3, 2017-02-14 (annotated)
- Committer:
- Knillinux
- Date:
- Tue Feb 14 05:12:54 2017 +0000
- Revision:
- 0:dd126a1080d3
- Child:
- 1:40bdbe1a93b7
test
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Knillinux | 0:dd126a1080d3 | 1 | |
| Knillinux | 0:dd126a1080d3 | 2 | #ifndef UTILITIES_H_INCLUDED |
| Knillinux | 0:dd126a1080d3 | 3 | #define UTILITIES_H_INCLUDED |
| Knillinux | 0:dd126a1080d3 | 4 | |
| Knillinux | 0:dd126a1080d3 | 5 | #include "mbed.h" |
| Knillinux | 0:dd126a1080d3 | 6 | |
| Knillinux | 0:dd126a1080d3 | 7 | namespace utils { |
| Knillinux | 0:dd126a1080d3 | 8 | // From http://playground.arduino.cc/Main/Smooth |
| Knillinux | 0:dd126a1080d3 | 9 | /*Details: Smooth takes three parameters, the value to smoothed, the filter value (filterVal), and smoothedVal. |
| Knillinux | 0:dd126a1080d3 | 10 | |
| Knillinux | 0:dd126a1080d3 | 11 | float sensVal - the sensor variable - raw material to be smoothed |
| Knillinux | 0:dd126a1080d3 | 12 | |
| Knillinux | 0:dd126a1080d3 | 13 | 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. |
| Knillinux | 0:dd126a1080d3 | 14 | The actual performance of the filter is going to be dependent on fast you are sampling your sensor (the total loop time), so |
| Knillinux | 0:dd126a1080d3 | 15 | some trial and error will probably be necessary to get the desired response. |
| Knillinux | 0:dd126a1080d3 | 16 | |
| Knillinux | 0:dd126a1080d3 | 17 | smoothedVal - Use this for the output of the sensor and also feed it back into the loop. Each sensor needs its own value. |
| Knillinux | 0:dd126a1080d3 | 18 | Don't use this variable for any other purpose.*/ |
| Knillinux | 0:dd126a1080d3 | 19 | float smooth(float data, float filterVal, float smoothedVal); |
| Knillinux | 0:dd126a1080d3 | 20 | } // end utils namespace |
| Knillinux | 0:dd126a1080d3 | 21 | |
| Knillinux | 0:dd126a1080d3 | 22 | |
| Knillinux | 0:dd126a1080d3 | 23 | #endif // End include guard |