I'm struggling with a seemingly simple problem in 2D motion. It has been many years since I looked at basic kinematics and my mind seems to be too slow and confused now. Imagine we want to build a computer mouse using a 2D accelerometer and a 1D gyroscope. An accelerometer measures linear acceleration along a single axis so our 2D accelerometer measures $a_x$ and $a_y$. The Gyroscope measures angular velocity ($\omega$).
Whenever there is a movement, a computer mouse reports $\Delta x$ and $\Delta y$ for a sampling period $\Delta t$. So the problem is simply formulating the $\Delta x$ and $\Delta y$ in terms of $a_x$, $a_y$, $\omega$ and $\Delta t$. Let's assume sensors are ideal and we are starting to move from position $(0,0)$.
If there was no rotation involved, the solution would be very easy as I guess I could simply integrate the acceleration for each axis separately:
$ (1) \quad \left[ {\begin{array}{c} v_x \\ v_y \end{array}} \right]_{t+1} \leftarrow \left[ {\begin{array}{c} v_x \\ v_y \end{array}} \right]_{t} +\Delta t \left[ {\begin{array}{c} a_x \\ a_y \end{array}} \right]_{t} $
$ (2) \quad \left[ {\begin{array}{c} x \\ y \end{array}} \right]_{t+1} \leftarrow \left[ {\begin{array}{c} x \\ y \end{array}} \right]_{t} + \Delta t \left[ {\begin{array}{c} v_x \\ v_y \end{array}} \right]_{t} + \Delta t^2 \left[ {\begin{array}{c} a_x \\ a_y \end{array}} \right]_{t} $
Now if we add rotations, in the global frame I also seem to know how to solve the problem: the orientation of the sensor at any time $t$ can be represented using a rotation matrix $R$ as:
$ R= \left[ {\begin{array}{cc} \cos \alpha & -\sin \alpha \\ \sin \alpha & \cos \alpha \end{array}} \right] $
We observe that differentiating $R$ in time gives us:
$ \dot{R}= \left[ {\begin{array}{cc} -\omega\sin \alpha & -\omega \cos \alpha \\ \omega\cos \alpha & -\omega\sin \alpha \end{array}} \right] = R \times \left[ {\begin{array}{cc} 0 & -\omega \\ \omega & 0 \end{array}} \right] $
So we can simply write:
$ (3) \quad R_{t+1} \leftarrow R_t + \Delta t \cdot R_t \times \left[ {\begin{array}{cc} 0 & -\omega_t \\ \omega_t & 0 \end{array}} \right] $
Now all we need to do is to correct the direction of the accelerations according to $R$ at each step:
$ (4) \quad \left[ {\begin{array}{c} A_x \\ A_y \end{array}} \right]_{t+1} \leftarrow R_t \cdot \left[ {\begin{array}{c} a_x \\ a_y \end{array}} \right]_{t} $
After this correction we can re-use equations (1) and (2).
However, the thing is a computer mouse should report position in it's local frame (I hope I'm stating the problem correctly) so in this figure,
in case (a) it should only show movements in the $x$ axis while in case (b) it should report movements in both $x$ and $y$. The above equations work on a global frame so for both cases we get the same results.
For some reason I cannot turn my head round the problem and fail to get the right equations for the movement in the local frame. I guess what I want to do is to to move my equations from an inertial frame of motion to a non-inertial frame and I don't know how to do that. Any hints or solutions to go forward?
