I am implementing a simple Kalman Filter that estimates the heading direction of a robot. The robot is equipped with a compass and a gyroscope.

Say at time $t-dt$, the compass reports a reading $\theta_{t-dt}$, and the gyroscope reports a reading $\omega_{t-dt}$. Then I assume from time $t-dt$ to $t$, the rotation rate can be regarded as a constant. Thus, my current heading direction is $$\theta_{t}=\theta_{t-dt}+\omega_{t-dt}\cdot dt$$ As can be seen, the $\theta$ can be easily time-updated.

But what about my $\omega$? The robot is not at my control. So its rotation rate at next moment is unpredictable.

How should I do the time update in this case?


1 Answer 1


For both states, you are using sensors to give you the required information.

One way to make this work properly: Use the gyroscope reading for your ω and your previous state estimate for your θ (or initial state estimate if its the first iteration). This is the predict step of the filter.

Then for the update step you can use your compass measurement (this will correct the gyro drift).

For both states, you are relying on sensors to provide information about heading, not the control inputs of the robot itself.

This method is common in attitude heading and reference systems.

For your application a complementary filter may be better suited since its easily implemented and is easy to tune and can have comparable performance to a Kalman filter in many situations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.