Both PID and Kalman filters are used extensively in Robotics. I gather, Kalman filters for sensing and PID for control. What is the mathematical, statistical or other relationship between them?


There isn't really a relationship between them, unless you're asking how the dynamics feed each other when combined into a system.

If that's the case, then I would suggest maybe starting with a review of the Luenberger observer. It's typically taught as the "dual" of the state feedback control problem - state feedback controls attempt to drive the system states to zero, and the observer design "rephrases" the problem to make feedback error the state and then attempts to drive the feedback error to zero with the same "pole placement" mechanic.

The filter has some error dynamics, and that dynamic error will get sent to the PID controller. The PID controller acts on the feedback + error dynamics and the resulting control signal gets sent to the plant.

I suggested starting with the Luenberger observer because IMO it's easier to look at with regards to error dynamics than the Kalman filter (try this, starting at equation 25). The process for evaluating the effect of the error is otherwise the same - filter generates feedback error until the filter states converge, and that error is fed to the controller.

This may be way off your intent with your question too, though. Please let me know if this is along the lines of what you're asking.

  • $\begingroup$ Thank you. I am just barely following the math behind the Kalman filter, although I think I follow the concept. And it just seemed like PID was doing something similar and I asked the question to further my understanding. $\endgroup$
    – pitosalas
    Sep 21 '18 at 13:30
  • $\begingroup$ @pitosalas - The Kalman filter is closely related to state feedback controls and the Luenberger observer. The PID controller is a "dumb" controller that only acts on error. The state space filters and controllers all have some underlying system model, but the PID controller doesn't. If your system/plant changes, you can just update the state matrix for the state space objects, but you'll need to (typically manually) re-tune your PID controller. $\endgroup$
    – Chuck
    Sep 21 '18 at 13:34
  • $\begingroup$ A good example here might be something like cargo weight or inclination angle. If those are parameters that are used in a state space model, then you can update the state matrix and the state feedback controller or Kalman filter updates itself (assuming you're approximately LTI). For the PID system, though, there's nothing you can do - you have to re-tune the controller for each scenario, and maybe your best case scenario there is some lookup table of control gains based on plant parameters. $\endgroup$
    – Chuck
    Sep 21 '18 at 13:37

The Kalman filter optimizes the estimate of the system state in the presence of measurement errors and model errors. PID tries to drive a particular model/measurement system to a chosen state.


Allow me to summarize and add to Chuck's great answer.
You use a filter to make sense out of your raw sensor readings. They mathematically reduce noise, or coalesce multiple data points into a single useful measurement.
The difference between the actual measurement and the desired value is called error. The job of a PID controller is to minimize the error, keeping your robot as close to the target as possible. For example, a line-following robot may filter multiple light sensor values to determine how far away is is from the line. It uses a PID to adjust steering to minimize its distance from the line.

  • 1
    $\begingroup$ Close, but not quite. There are two kinds of error I mentioned, a reference error, which is the input to the PID controller, and then also a measurement error, which is the difference your sensor reading and reality. The measurement error makes its way back to the PID controller because the reference error is generally $e_{ref} = u_{ref} - y_{fbk}$, but the feedback signal is "corrupted" with the measurement error $y_{fbk} = y_{reality} + e_{fbk}$. You wind up with $e_{ref} = (u_{ref} - u_{reality}) + e_{fbk}$, and then the PID controller acts on the combination of errors. $\endgroup$
    – Chuck
    Sep 21 '18 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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