# How to compute the observation matrix for a Kalman Filter?

If my state vector is just a representation of the error state of a quaternion represented as $[\delta \bf{q} ]$ which is a 3x1 vector and my external update is from an accelerometer, how would I compute the jacobian $\bf{H}$ matrix?

One implementation that I've found uses $$\bf{H} = [R^w_b g]_\times$$

where $\times$ represents the skew symmetric matrix and $\textbf{g} = [0, 0, 9.80665]^T$, $\textbf{R}^w_g$ the rotation matrix obtained from the true state quaternion.

How does $z = Hx$ make sense in this formulation? Thank you!

• Welcome to Robotics, Nopestradamus. Can you link to any of the original papers you're referencing? A quaternion should be a four-valued item, so I'm a bit confused as to how your quaternion error state only has three. As @VivekShankar mentioned below, it would appear that your predicted acceleration observation, $z$, is the result of taking the direction you expect gravity to be pointing, $R_b^w g$, and modifying that by your best guess for how your rotations have changed $\delta q$. – Chuck Dec 27 '17 at 14:14
• The result should be the "future measurement" of gravity, but again I can't reconcile a 4x1 quaternion with your 3x1 quaternion error state, and I'm not sure I know of a direct method for "applying" a quaternion increment to a rotation matrix. Again, if you could please link the paper(s) you're reading then we might be able to better help you. – Chuck Dec 27 '17 at 14:16