# Removing gravity from a non-orthogonal body

I am not sure where to post this question, if it is not appropriate here can you suggest where shallI post it to?

Question:

I have a Cube with dimension of x,y,z. I am trying to do some integration to the accelerometer value. The problem I have now is that I can't assume that I should remove the gravity of 9.81m/s^2 from say in my case, Y direction only, because when moving in a non orthogonal line, the gravity is activity not only on Y, but also in X and Z.  (TOP) How the perfect movement should have therefore gravity in only Y direction (BOTTOM) Real movement

I have an Euler angle to estimate the amount of rotation from each axis, but I am not sure on how to deduct the gravity accurately in this case.

• From a single 3D accelerometer you can either derive total acceleration (or a vector of acceleration) or angle, assuming that the body is at rest. You cannot achieve 6 degrees of freedom with 1 linear accelerometer. – A_A Oct 6 '16 at 16:58
• I've seen Madgwick's AHRS algorithm to rotate body to Earth frame. But I do not know how to use them, could you explain it to me in case you know? x-io.co.uk/open-source-ahrs-with-x-imu – Sharah Oct 9 '16 at 14:39
• I am sorry, I have not found some time to go through any other resources from the provided link, other than the video. The video demonstrates a 3 DOF system that only recognises rotation, NOT (rotation AND translation). This is trivial to do with a 3D linear accelerometer by detecting the gravity vector and possibly adding a Kalman filter. The resource seems to include code. How far have you got trying to create a proof of concept with your hardware? – A_A Oct 9 '16 at 17:14