How to calculate mouse movements using a 3-axis accelerometer

I have a 3-axis accelerometer (any mobile phone), but I can not find any good formulas for interpreting the data that comes from it. No matter what I do, the movements are jerky / insensitive. I read that I also need an Euler angle or a rotation matrix?

I would appreciate any good reading material ...

+4
source share
2 answers

For what it's worth, some samples of Apple’s accelerometer:

  • AccelerometerGraph Sample application displays the movement of a device. It demonstrates how to use the UIAccelerometer class and how to use Quartz2D and Core Animation to provide high-performance graphical representation. It also shows a low-pass filter that can be used to isolate the effects of gravity, and a high-pass filter that can be used to remove the effects of gravity.
  • The GLGravity sample application demonstrates how to use the UIAccelerometer class in conjunction with OpenGL rendering. It shows how to extract the gravity vector from the values ​​of the accelerometer using a basic low-pass filter, and how to build an OpenGL transformation matrix from it.

And if you're looking for something like Wolfenstein 3D tilt control, you can read the source code for this ... :-)

+4
source

Are you trying to create a 3D program for the iPhone? (There are already several.) Can you accurately describe what kind of user movement you want to correspond to which action?

The easiest way to do this is to get the device step by taking the arc cosine of the point product of the acceleration vector with (0, 0, 1000).

If you are trying to implement a device in which a sliding iPhone moves the cursor back and forth across the screen in space, it will be difficult, because it will require relatively violent hand movements to create large accelerations to gravitational acceleration. MEMS accelerometers, such as those on the iPhone, look great at measuring gravity, but are pretty bad at measuring the actual accelerations of the device itself.

If you describe your application a bit, I can give you more specific pointers.

There are many different ways to represent spatial rotations, but quaternions are very popular in the gaming programming community. A google search gives you some links to some primers. GamaSutra is a good place to start.

http://www.gamasutra.com/features/19980703/quaternions_01.htm http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation http://www.flipcode.com/documents/matrfaq.html 
+3
source

All Articles