Can a 3-axis magnetometer be tilt compensated when moving/accelerating?

I have a magnetometer, accelerometer and gyro which all go swimming (attached to a person.) Data is logged and I now have a sample of that data.

I want to calculate the magnetic heading the user was travelling in. However, all the documents I can find on tilt compensated compasses (they're mostly applicable to phones) do not mention anything about accelerating at the same time, which happens in my application. It seems to me like this would make tilt compensation very difficult; it would only be possible when stationary.

Does anyone know if it's possible?

• You should be able to calculate immediate vectors then average those vectors over 10 to 20 seconds or so for reasonable results... ? Low pass filtering should be even better. I'm not making an answer because this is somewhat speculative. Nov 25, 2013 at 21:56
• Even if it's stationary, you are accelerating at the same time. Your accelerometer will be measuring the acceleration due to gravity. What are you actually asking? Nov 26, 2013 at 1:45
• @Samuel Yes, I know I will have the 1g acceleration in the Z-axis. I thought this is what the tilt compensation looks for. So I don't know how well it works if there is additional acceleration on top of gravity. Nov 26, 2013 at 9:05
• @ThomasO 1g acceleration in the Z-axis is the trivial case, the device is not tilted, you're done. Any tilt compensation worth anything will be dealing with every other case. It seems what you actually want to do is separate the gravity vector from the other accelerations, or, to make the device an AHRS. Correct? Can you use the kinematics of the human attachment point to aid your calculations? Nov 26, 2013 at 18:24
• @Samuel - ah yes, I see what you mean. In my case, I cannot rely on the accelerometer to figure out the orientation, so can I still tilt compensate? Nov 26, 2013 at 20:04