I am exploring the option of using a EKF with my differential drive robot. I do not have any prior experience with kalman filters.
The robot that is under consideration has two wheel encoders for odometry input using which can be used to calculate the displacement and heading change in the odom frame. It also has two magnetic sensors placed under either ends of the robot which will provide offset distance while traveling on top of a magnetic line.
Using the odometry model I can calculate the x, y and yaw of the bot over a period of time. And the magnetic measurement provides the y and yaw in world frame. Using this paper as my reference, my state transition matrix is jacobian of the odometry model as included below.
$$A = \begin{bmatrix}1 & 0 & -\Delta \sin(\theta_k + \omega/2)\\0 & 1 & \Delta \cos(\theta_k + \omega/2)\\0 & 0 & 1 \end{bmatrix}$$
So, the system model is
$$X_k = A * X_{k-1}$$
For initial values of $(0,0,0)$, when the robot is aligned with the world frame,
$$ \begin{bmatrix} x_k \\ y_k \\\theta_k \end{bmatrix} = \begin{bmatrix}1 & 0 & -\Delta \sin(\theta_k + \omega/2)\\0 & 1 & \Delta \cos(\theta_k + \omega/2)\\0 & 0 & 1 \end{bmatrix} * \begin{bmatrix} 0 \\ 0 \\0 \end{bmatrix}$$$$ \begin{bmatrix} x_{k+1} \\ y_{k+1} \\\theta_{k+1} \end{bmatrix} = \begin{bmatrix}1 & 0 & -\Delta \sin(\theta_k + \omega/2)\\0 & 1 & \Delta \cos(\theta_k + \omega/2)\\0 & 0 & 1 \end{bmatrix} * \begin{bmatrix} 0 \\ 0 \\0 \end{bmatrix}$$
My measurement model will provide only y and yaw values. Hence, my H matrix and the z are as below
$$ H = \begin{bmatrix}0 & 1 & 0 \\ 0 & 0 & 1\\\end{bmatrix}$$ $$ z_k = \begin{bmatrix}y_k \\ \theta_k\end{bmatrix}$$
Going by the above model, if the robot is moving on top of the magnetic sensor in a straight line, my measured y and yaw will always be 0 and hence based on the equations outlined in the paper (also included above) my X value will never increment.
Any inputs to help me understand what I am missing here are highly appreciated.
[Edited]
The heading of the bot is along the x axis. So as it travels forward with 0 yaw the X will increase.