Hello,
I am trying to use the accelerometer's z axis as a substitute for velocity when hitting a pad.
I first remove the force of gravitation by substracting the average over last 50 values. Then anytime the pad is triggered I run a loop with 50 or 100 cycles and calculate the RMS value.
However the values are not always evolving linearly. Sometimes a big hit returns a smaller value than a softer hit.
I am wondering if it's because the accelerometer reacts faster than the touch detection and might lead to miss the biggest variations from the accelerometer. Maybe I should have a kind of running RMS and take that value when hitting the pad rather than calculating it after the hit ?
Has anyone successfully tried to use the accelerometer in such a way yet ?
Using accelerometer's z axis as substitute for velocity ?
Re: Using accelerometer's z axis as substitute for velocity
Not sure what you are trying to accomplish here....The z of accelerometer returns close to -1 when the iPad is placed on a surface with the device lied down, goes close to 0 when the device is then tilted towards you....It will go close to 1 if the device is lied down, with the screen facing downwards....
It would also have a z of 0 if the device was falling with the screen facing upwards....So in other words the gravitational effect on the z axis is -1 - that is, IF the iPad is placed totally in parallel to the ground.
How can you combine all that to get a measurement meaningful and useful to "interpret" to velocity, I really dont know. Supposedly if you "hit" the device strong enough while it is placed on a surface that allows it to have "some" vibration in the Z axis, you would I guess get slight fluxuations from the close to -1 value towards 0 but I believe these value changes are too small and too fast to be detected and be used as velocity values.
Also there are slight practical problems such as, hitting the device in such a way that it would not cause ANY alterations on the device's parallel placement to the ground - i.e. you need to make sure, each hit on the device results ONLY in an absolute vertical (relative to the screen) vibration. Essentially the real probelm is that z not only changes when the screen - parallel to the ground - changes speed in relation to the ground but also changes when the device changes orientation in relation to the ground.
It would also have a z of 0 if the device was falling with the screen facing upwards....So in other words the gravitational effect on the z axis is -1 - that is, IF the iPad is placed totally in parallel to the ground.
How can you combine all that to get a measurement meaningful and useful to "interpret" to velocity, I really dont know. Supposedly if you "hit" the device strong enough while it is placed on a surface that allows it to have "some" vibration in the Z axis, you would I guess get slight fluxuations from the close to -1 value towards 0 but I believe these value changes are too small and too fast to be detected and be used as velocity values.
Also there are slight practical problems such as, hitting the device in such a way that it would not cause ANY alterations on the device's parallel placement to the ground - i.e. you need to make sure, each hit on the device results ONLY in an absolute vertical (relative to the screen) vibration. Essentially the real probelm is that z not only changes when the screen - parallel to the ground - changes speed in relation to the ground but also changes when the device changes orientation in relation to the ground.
Re: Using accelerometer's z axis as substitute for velocity
When hitting the iPad there is obviously an increased acceleration on the z axis. The changes are not so thin. I have values changing from -1.02 down to -1.76. Also the orientation is not really an issue when the iPad lays on a table (anyway I measure the value at rest so the difference with true parallelism is really small and can be cancelled using a threshold). It is true that there are oscillations but that's why I take an RMS value.
If there's a problem I think it rather comes either from the general refreshing rate (it is not clear what depends exactly on the 60 refresh rate in Lemur and what doesn't) or from the sync between the accelerometer and the touch sensing.
If there's a problem I think it rather comes either from the general refreshing rate (it is not clear what depends exactly on the 60 refresh rate in Lemur and what doesn't) or from the sync between the accelerometer and the touch sensing.
Re: Using accelerometer's z axis as substitute for velocity
Hmmmm if thats the case it sounds promising...Cant really say much as I had never thought of trying it...The changes are not so thin. I have values changing from -1.02 down to -1.76.