1
votes

I have been using a 6dof LSM6DS0 IMU unit (with accelerometer and gyroscope). And I am trying to calculate the angle of rotation around all the three axes. I have tried may methods but not getting the results as expected.

Methods tried:

(i) Complementatry filter approach - I am able to get the angles using the formula provided in the link Angle comutation method.

But the problem is that angles are not at all consistent and drifts a lot. Moreover when the IMU is rotated around one axis, angles calculated over other axis are wobbling too much.

(ii) Quaternion based angle calculation : There were plenty of resources claiming the angles are calcluated very well using quaternion approach but none had a clear explanation. I have used this method in order to update the quaternion for every values taken from the IMU unit. But the link dint explain how to calculate the angles from quaternion.

I have used glm math library inorder to convert the quaternion to euler angles and also have tried the formula specified in wiki link. With this method since in pitch calculation asin returns only -90 to +90 degrees I am not able to rotate the object in 3D as the one they have been doing in the mentioned link.

Does anyone have tried the quaternion to angle conversion before?? I need to calculate the angles around all the three axis in the range 0 to 360 degrees or -180 to +180 degrees.

Any help could be really appreciated. Thanks in advance.

1
Guess to use existing solutions for sensor fusion. like x-io.co.uk/open-source-imu-and-ahrs-algorithmsminorlogic
Yes this is the same link I have posted too in Quaternion based angle calculation. The thing is they dint expose how they are calculating the angles from quaternion.Karthik
If you need to convert quaternion to euler angels , than use this library en.wikipedia.org/wiki/… And code from article "Euler angle conversion" by Ken Shoemake in "graphic gems 4" realtimerendering.com/resources/GraphicsGemsminorlogic

1 Answers

0
votes

http://davidegironi.blogspot.com.ar/2013/02/avr-atmega-mpu6050-gyroscope-and.html#.VzjDKfnhCUk

  Sq = [q0, q1, q2, q3]
  //sensor quaternion can be translated to aerospace sequence of yaw/pitch/roll angles
  yaw = atan2(2*q1*q2 - 2*q0*q3, 2*(q0^2) + 2*(q1^2) - 1)
  pitch = -asin(2*q1*q3 + 2*q0*q2)
  roll = atan2(2*q2*q3 - 2*q0*q1, 2*(q0^2) + 2*(q3^2) - 1)