I've also looked into the Kalman filter, but for now, maybe a simple Low pass filter is enough...
Why? Well, just look at these graphs:
Raw Data |
Low-Pass filter test 1 |
Low-Pass filter test 2 |
Isn't that lovely? I mean, it's pretty clear what is what. Obviously the data should be smoother, and is something I will experiment with some more. In a way though, it's good like that because if this can be handled, better data will obviously work as well! There will be a "calibration" mode where one will teach the device "walking" and "running", so what values that actually means, shouldn't matter as it will be based on the "calibration". In this test, one could say average of 500 is running, and average on 250 is walking, which is funny as 250 is half of 500... :)
So, I tweaked the low pass filter to put really low value on current raw data and I got this:
Low-Pass filter test 3 - 0.005 |
Low-Pass filter test 4 - 0.001 |
Look at that! I didn't even bother marking what is walking and running here as I suppose that is quite obvious! The main problem here though is that it will not reach 0 if you stop too soon... I guess that can be solved by just implementing some kind of "idle" timer of some sort... Again, it's only a problem when there is no data coming from the sensor, aka, no movement. So, I suppose a simple idle timer could just send 0 after a short while and that should solve that issue.
You find that sufficiently flat? I think I'll have to get some better "flattness". Can't wait to see if you get better results with the rest of the filters I proposed, hop you try Kalman (or Loess) at least.
ReplyDeleteWell, I'm just glad I'm making progress here. This is way better than it's ever been, and just by a simple filter. Now, Kalman is more complicated, so I need to dive more into how that works, but I'm pretty sure that will make it even better and "flat".
ReplyDelete