Possible Duplicate:
How to obtain only linear acceleration from accelerometer using gyroscope?
I have checked similar questions on the topic, most deal with the static case, that is the accelerometer is in a still position but tilted. However, in my case, the device is under constant motion with varying acceleration up yo 2g. I have tried few algorithms which work fine whenever acceleration is small (i.e. walking). Yet when the acceleration increases, they all fail miserably (i.e. running). The gravity component is needed to be fused with the gyroscope to detect spatial orientation at every instant. What are the best algorithm there to deal with this issue under motion.