Usefulness of Model Predictive Control for FRC

Hi! :upside_down_face:

After competition season ended, I have personally been looking into the field of control systems beyond the scope of PID control, Motion Profiles, and Feedforward (all of which my team already implement to varying degrees of success). I have been most drawn to the sub-category of optimizers and while I can’t say I fully understand some of the high level math they depend on, they still strike me as intriguing. One such optimizer I looked at is the Linear Quadratic Regulator which struck me as interesting and is something I am currently implementing as a proof of concept on swerve drive base azimuths. During my research for this project I also came across Model Predictive Control, and Iterative LQR (Which to my understanding performs similarly to MPC).

One application that immediately came to mind when I first learned of it would be to follow a generated spline (or path) similar to what Path Planner does but with PID, which I believe would take advantage of the fact MPC can make better predictions because it knows the future of it’s reference while other methods of control don’t.

So this leaves me just two big questions:

  1. Can MPC (and iLQR) be implemented without significant performance decline on a RoboRIO, would it be too extensive to implement?

  2. If this is a realistic example, what others exist for FIRST robotics?

2 Likes

MPC is the same problem as LQR, but with input constraints. There’s finite horizon and infinite horizon versions of LQR. It just so happens that with infinite horizon LQR, the cost-to-go reaches steady-state and results in the control law u = -Kx with a constant feedback gain K.

MPC can be done on the roboRIO if your problem is low-dimensional enough. Flywheel MPC is just bang-bang control and a feedforward. :grin:

Solving it more generally in an efficient way requires fancy math.

971’s catapult in 2022 used MPC.

Here’s the compiled version:
mpc.pdf (107.1 KB)

2 Likes