Let's recall that graph in that old Londroid presentation.
The graph shows the absolute value of the acceleration vector while the phone's body was tapped twice. The base rate is the gravity acceleration (about 10 m/sec^2) and the acceleration caused by the taps was added (in the actual configuration, subtracted) from the gravity acceleration, resulting two characteristic spikes.
But where was the phone's body tapped? By looking solely on the accelerometer's data, I don't think there is a way to find it out. But fortunately we have other sensors and the gyroscope is particularly relevant. Here is the well-known image of the sensor axes in Android.
In case of the gyroscope, the sensor measures rotation around the axes. If you tap the device in the right lower corner, we can expect a short rotation around the x and y axes if the phone supported by a reasonably flexible base (e.g. a human hand and not a block of granite).
But can this be really detected? I made a series of measurements to prove it. Note here that I was just interested in the theoretical possibility and did not want to do a product-grade implementation. So I tested only on my Galaxy Nexus.
First here is the absolute acceleration value for 3 consecutive taps.
X axis, just for two taps:
Y axis, just for two taps:
As you can see, the taps are detected by the gyroscope too as short rotations. In case of both axes, there was a spike of positive rotation velocity first.
Now let's see what happens, if we tap the lower left corner.
X axis, just for two taps:
Y axis, just for two taps:
As you see, the X graph has the same character but the form of the Y graph has changed. Instead of a marked positive spike, there is a small negative spike, followed by a positive spike.
Let's see if the experience is repeated in the upper left corner.
X axis, just one tap:
Y axis, just one tap:
Now the character of the spikes on both axes changed. A small positive spike is followed by a large negative spike.
This is not a kind of movement the gyroscope was designed for so it is premature to state that this waveform pattern will be exactly the same for all the Android devices sporting gyroscope out there. But I found these measurements convincing enough to support the statement that it is possible to implement rudimentary tap location using only the accelerometer and the gyroscope in the device.
4 comments:
Very great tutorials...i hav one doubt..i hav been struggling with problem..i hav two views one is listview(it will have 10 buttons) when user clicks on one button it should navigate to expandable list view..tricky part is for each button the expandable list varies...for one button click i m able to do..but each different button i dont know how to call..i stuck here for the past one week...plz help me
Thank you for writing such a good blog , I am very interested.
Thank you for a great tutorial. I have been stuck to write such kind of functionality. Could you please reveal some code. It would be great for people struggling out there.
This particular example did not require Android code. What I did is that I just sampled the gyroscope and then visualized those samples. I use Sage for sample processing, prototyping and visualizations.
Post a Comment