A cart sensor reports position and a pole sensor reports angle. Neither directly tells you velocity. Differentiating noisy samples is tempting, but it can make a controller jump. A Kalman filter combines a model prediction with the new measurements; LQG feeds that estimate into an LQR gain. The distinction matters when the estimate is wrong.
Prediction is a claim; innovation is the correction
A state observer predicts the next position, speed, angle and angular speed using its model and previous input. It compares predicted position and angle with the sensor values. Their difference—the innovation—adjusts the hidden velocity estimates as well as the measured states. Process covariance Q and measurement covariance R encode uncertainty assumptions; changing them changes how the filter weighs model and sensors.
A smoother estimate is not automatically more accurate. If you tell the filter that a noisy sensor is much less reliable, it may smooth jitter yet react late to a real kick. Inspect the hidden pole-rate trace and the error against the simulation's true state, not just the appearance of the estimated angle.
First isolate estimation; then close the loop
The Kalman-only guided experiment deliberately controls with the simulator's true state while showing the observer. That is an educational reference, not a hardware-realistic controller. In the LQG experiment the very same type of LQR feedback gain acts on estimated state instead. Pin one run, keep the kick and Q/R fixed, switch between LQG and full-state LQR, and compare cart travel, angle and force.
Textbook LQG optimality is stated for a linear model, quadratic cost and Gaussian-noise assumptions. Here the controller acts on a nonlinear, force-limited cart-pole with bounded injected noise. That makes it useful for seeing assumption gaps, but it does not turn a good-looking trace into a stability or safety certificate.
Before trusting an observer on hardware
Check that the available sensors can reveal the states you need, that units and sample time match the model, and that sensor bias, delay or dropout have been considered. Change the assumed noise covariance separately from actual injected noise. Finally test the combined estimator and controller against actuator limits and model error—not just the filter in isolation.
A Kalman filter estimates; LQG controls from that estimate. Evaluate estimation error and closed-loop behavior separately before treating them as one successful design.