How can I smooth accelerometer signal?
Hi friends!
I'm programming the accelerometer, which values are between 2.3 and -2.3.
I transform these values between 0 and 480 and I place this value into Y position of a small texture on the screen. The problem is that my texture vibrates a lot. My question is, what kind of filter should I use to smooth the signal (and the texture position)?
There are a few examples with use a High pass filter, is that what I need?
There is an example called AccelerometerGraph that have a high pass filter, and when I activate it, I only the the signal value is displaced, but not smooth.
What do you think?
Thanks a lot for your suggestions.
I'm programming the accelerometer, which values are between 2.3 and -2.3.
I transform these values between 0 and 480 and I place this value into Y position of a small texture on the screen. The problem is that my texture vibrates a lot. My question is, what kind of filter should I use to smooth the signal (and the texture position)?
There are a few examples with use a High pass filter, is that what I need?
There is an example called AccelerometerGraph that have a high pass filter, and when I activate it, I only the the signal value is displaced, but not smooth.
What do you think?
Thanks a lot for your suggestions.
Sounds like you want a low-pass filter. The high-pass filter implemented in AccelerometerGraph cancels out the effect of gravity, but still picks up on high frequency movement. It sounds like you want to do the opposite; cancel out the high frequencies to stabilize your input. I don't know the implementation details off the top of my head, but I imagine googling for "low-pass filter" would give you some helpful results.
ThemsAllTook Wrote:Sounds like you want a low-pass filter. The high-pass filter implemented in AccelerometerGraph cancels out the effect of gravity, but still picks up on high frequency movement. It sounds like you want to do the opposite; cancel out the high frequencies to stabilize your input. I don't know the implementation details off the top of my head, but I imagine googling for "low-pass filter" would give you some helpful results.
It makes sense. I will use google, meanwhile, did anyone implement a low-pass filter?
Thanks!
EDIT: it seems here there is a low pass filter:
http://www.newtondynamics.com/forum/view...=14&t=4728
but it seems the same as a high pass filter, is that right?
A low pass filter is even simpler to implement.
Something like the following will do just fine:
It's just a linear interpolation. What it's doing when factor is near zero is only letting new_value affect the output by a little bit.
There is more complicated filtering you could do, but this will work fine 99% of the time.
Something like the following will do just fine:
Code:
factor = 0.1
new_value = get_new_value_for_something();
value = new_value*factor + old_value*(1 - factor)
old_value = valueIt's just a linear interpolation. What it's doing when factor is near zero is only letting new_value affect the output by a little bit.
There is more complicated filtering you could do, but this will work fine 99% of the time.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Skorche Wrote:A low pass filter is even simpler to implement.
Something like the following will do just fine:
Code:
factor = 0.1
new_value = get_new_value_for_something();
value = new_value*factor + old_value*(1 - factor)
old_value = value
It's just a linear interpolation. What it's doing when factor is near zero is only letting new_value affect the output by a little bit.
There is more complicated filtering you could do, but this will work fine 99% of the time.
Are you sure you are right? I mean,
old_value*(1 - factor)=old_value*(1 - 0.1)=old_value*0.9
Doesn't it mean the old value has a 90% of importance?
Am I right?
Thanks!
If you call it some 30 times per second it approaches new value pretty fast (assuming new value stays constant).
©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Najdorf Wrote:If you call it some 30 times per second it approaches new value pretty fast (assuming new value stays constant).
I did a test on my iphone and it goes really slowly.
But I changed 0.1 by 0.6 and it goes better, as without filter but a bit smoother.
I will some more test.
Thanks
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Game play with the accelerometer | Ropeburn | 3 | 2,334 |
Sep 26, 2010 06:17 PM Last Post: Ropeburn |
|
| Line Smooth Problem on iPhone Device | abelix | 1 | 3,485 |
Sep 22, 2010 06:28 AM Last Post: Skorche |
|
| Program received signal: “SIGKILLâ€. | Toontingy | 14 | 4,888 |
Jun 24, 2010 07:24 PM Last Post: Frogblast |
|
| accelerometer settings | baddapple | 0 | 2,968 |
Apr 24, 2010 05:39 PM Last Post: baddapple |
|
| About ParticleSystem and Accelerometer ! | Dorald | 13 | 4,774 |
Apr 2, 2010 10:17 PM Last Post: alerus |
|

