1
\$\begingroup\$

What I've done will now:

I'm using an IMU (MPU6000) to calculate the Euler angles of an object and for this, I'm using Madgwick AHRS algorithm. The MPU gives acceleration due to gravity (a) about the axis and angular velocity (g) about the axis and I feed these values to calculate the quaternions which are converted to Euler angles using this function found on Wikipedia.

So what's going wrong:

  1. I'm getting the Euler angles to be yaw-pitch-roll: 0.001518, 0.001626, 0.003990. This isn't in degrees or radiance. Whats the dimension here?
    I'm feeding in, the accelerometer reading about each axis (so its m/s^2) and after calculating the angle of rotation from the gyro, the theta value (in degrees) about each axis.

    MadgwickAHRSupdateIMU((float)tx, (float)ty, (float)tz,(float)ax, (float)ay, (float)az);
    

    where tx,ty,tz are the angle and ax,ay,az are in G.
    tx = gx * timestep; where gx is the raw gyroscope reading. And timestep is the time between gyro readings.

\$\endgroup\$
  • \$\begingroup\$ Are you integrating the angular rate from the IMU? Otherwise, you should expect the angle output to be the instantaneous rate of rotation. \$\endgroup\$ – tomnexus Jun 18 '18 at 5:22
  • \$\begingroup\$ No, I wasn't. Now I'm multiplying the angular velocity with the time elapsed between adjacent readings. Thank you. I've updated the question with my current challenge. \$\endgroup\$ – clmno Jun 18 '18 at 9:01
  • \$\begingroup\$ The gyro outputs are in deg/s, so you need to integrate. Something like this, each time you get a reading: Angle = Angle + Gx * timestep. Your next challenge is that this will run away in a short time; you'll need to zero Angle and rate, with the device stationary, before you start. Corrected_rate = Rate - Rate_when_still. \$\endgroup\$ – tomnexus Jun 19 '18 at 4:56
  • \$\begingroup\$ Thank you this has been solved. The Madwick's AHRS algorithm needed the gyro values to be in rad/s and acc to be in any dimension. \$\endgroup\$ – clmno Jun 20 '18 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.