Actually, i think that the little rotation reported is a little amount of linear acceleration transposed to rotation.

I will add very soon a new post about the tuning of proportional and Integral Coeffs (Kp and Ki).

In this code, i will keep Kp and Ki = 0 when a linear accel is detected (that is not the case currently). i.e. something like that:

if norm(accel)<252 and norm(accel)>260 // (256 = 1g; the accel is detecting just the gravity and no linear accel)

Kp=0.0;

Ki=0.0;

else

Kp=3.0 // I found that 3.0 is a good coeff for my board

Ki=0.01 // TBC

Endif

It means that when a linear acceleration is detected, the filter is updated only with the gyros values.

Have a good day a thank you again

VGR

• I'd guess that rotation to be compass error from the metal laptop maybe?  I initially thought it might be that the accelerometer contribution was too high, but I'd expect that to pull pitch or roll, but not yaw.

• I dunno Benjamin.  It looks like an error to me?

Pretty good work none-the-less.  The gimbal-lock problem with DCM can be a pain for us and has led to a number of creative work-arounds that would be nice to avoid.

• MR60

Thx for the info and links. Will dive back in my 20 yr old maths...

• At 0:26, it's unlikely the author could have made the lateral movement while maintaining exactly the same orientation -- I'd guess the rotation shown during that lateral movement is probably accurate.

• How come at 0:26, when you do the lateral movements, the IMU reports a rotation?

• For a crash course, download FreeIMU and load it onto an ArduIMU.   I don't have an advanced math background, but even I was able to make use of FreeIMU and the formulas on this link.   This website has a bunch of useful formulas.

Maths - Conversion Quaternion to Euler - Martin Baker
• Quaternions contain the same 3 degrees of rotational freedom information as a more traditional rotation matrix, but they use 4 numbers to store that information rather than 9 numbers (3x3 matrix).  A rotation matrix is basically a set of 3 rotations -- rotate around axis 1, then rotate around axis 2, then rotate around axis 3.  This can cause numerical instability (mathematical equivalent of gimbal lock) when the target vector is close to one of the rotation axes.  A quaternion is a single rotation about an arbitrary axis (yet this still allows them to describe any possible 3D rotation) and therefore doesn't have the (mathematical) gimbal lock problem.  Also, since an orientation represented by a quaternion is simply a single rotation about an arbitrary axis, it is trivial to smoothly and accurately interpolate between two orientations.  Comparative computational performance depends on exactly what you're doing, but either option could potentially be better than the other.  Starting with section 3, Wikipedia is an excellent resource: en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

• MR60

Hi, i'd like to have a tutorial about quaternions. Can you give a crash course?