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
Diff: utilities.cpp
- Revision:
- 0:dd126a1080d3
- Child:
- 1:40bdbe1a93b7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities.cpp Tue Feb 14 05:12:54 2017 +0000
@@ -0,0 +1,20 @@
+
+#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
\ No newline at end of file