From acceleration to displacement Hi I am a major in Computer science and this question should be really easy for all the physics geniuses here: 
I have a set of data points from an accelerometer on a moving object that basically follows the form. 
X acceleration including gravity
Y acceleration including gravity 
Z acceleration including gravity
Rotation about x axis
Rotation about y axis
Rotation about z axis
I want to plot the object in 3-D space, and, after some searching, I was told to double integrate to get displacement. 
Is that the best way? It doesn't have to be computationally efficient as long as it's easy to understand. 
 A: In principle you could get the displacement from accelerometer measurements, if you also had an estimate of the orientation of the phone at all times.
You would need to use the phone orientation to convert each instantaneous acceleration measurement into the same coordinate frame, and then subtract off a constant component representing gravity, then double-integrate.
To be explicit, let's take some frame where gravity pulls along the $-\hat{z}$ direction, $\hat{x}$ is east, $\hat{y}$ is north.
The phone can be pointing any which way, so it also defines it's own time-dependent coordinate frame, eg. $\hat{x}'(t)$ points to the right of screen, $\hat{y}'(t)$ points to the top of screen, and $\hat{z}'(t)$ points out of the screen.  This is the frame in which you get your accelerometer data $\vec{a}'_m(t)$.
Let's say there's a perfect gyroscope in the phone so you know how to describe the orientation of the phone in space.  ie you can write $\hat{x}'(t), \hat{y}'(t), \hat{z}'(t)$ in terms of $\hat{x}, \hat{y}, \hat{z}$ and $t$.  Then you can compute a rotation matrix $R(t)$ that converts between frames.
$\vec{a}_m(t)=R(t)\vec{a}'_m(t)$
And then subtract off gravity:
$\vec{a}=\vec{a}_m-g\hat{z}$
Then, assuming the phone starts at rest at the origin:
$\vec{r}=\int dt\int dt \vec{a}$.
Voila!
But, this method is very error-prone.  For instance, if your orientation estimate is off by even a tiny bit, then the subtraction of gravity won't work well, and the algorithm will think your phone is accelerating even when still.  A one-degree error could easily lead to being off by kilometers on the order of minutes, particularly since any acceleration mistake get's double-integrated!
See here for a good discussion!
