c++accelerometerkinectopenframeworksofxkinect

Working with kinect (libfreenect) accelerometer data


I'm accessing the Kinect Accelerometer in c++ via openFrameworks and ofxKinect and am having some issues with certain angles. If I pitch the kinect 90 degrees downwards I get nan values. I had a look at the getAccelPitch() method and this kind of makes sense since asin will return 0 when there will be values greater than 9.80665 divided by 10.1/9.80665.

The main problem though is after I pitch the device 90 degrees, the roll doesn't seem reliable(doesn't seem change much). In my setup I will need to have the device pitched 90 degrees but also know it's new roll.

Any hints,tips on how I may do that ? Is there an easy way to get the data to draw the kinect's orientation with 3 lines(axes).

I'm trying to detect orientations like these: k1

k2

k3

k4


Solution

  • The problem is that you are using Euler angles (roll, pitch and yaw).

    Euler angles can screw up the stability of your app, see for example

    They are not useful for interpolation either.

    A solution is to use rotation matrices instead. A tutorial on rotation matrices is given in the

    Direction Cosine Matrix IMU: Theory

    manuscript. However, there is an issue: If you only have accelerometers then you can get the tilt angles but not the rotation matrix. There is no way to detect rotation around the vertical axis with the accelerometers only, it is invisible to them.