title: Remove gravity from IMU accelerometer
body: <p>I've found this <a href="http://www.varesano.net/blog/fabio/simple-gravity-compensation-9-dom-imus" rel="noreferrer">beautiful quick way</a> to remove gravity from accelerometer readings. However, I have a 6dof IMU (xyz gyro, xyz accel, no magnetometer) so I am not sure if I can use this code (I tried and it doesn't work correctly).</p>
  
  <p>How would someone remove the gravity component? It's a big obstacle because I can't proceed with my project.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>What I have:</p>
  
  <ul>
  <li>quaternion depicting the position of aircraft (got that using Extended Kalman Filter)</li>
  <li>acceleration sensor readings (unfiltered; axes aligned as the plane is aligned; gravity is also incorporated in these readings)</li>
  </ul>
  
  <p>What I want:</p>
  
  <ul>
  <li>remove the gravity</li>
  <li>correct (rotate) the accelerometer readings so it's axes will be aligned with earth's frame of reference's axes</li>
  <li>read the acceleration towards earth (now Z component of accelerometer)</li>
  </ul>
  
  <p><strong>Basically I want to read the acceleration towards earth no matter how the plane is oriented!</strong> But first step is to remove gravity I guess.</p>