This webinar begins with a quick and painless introduction to basic concepts of optimal control and model predictive control (MPC). We will derive Pontryagin’s maximum principle. The only prerequisite is familiarity with Lagrange multipliers. To solve optimality conditions in real time, the continuation GMRES method for nonlinear MPC will be introduced. This method has been implemented in a Maple application by Cybernet, Japan, available in the Application Center. We will review this worksheet, which includes automatic code generation for NMPC controllers. The example problem in this worksheet is to control the position and orientation of a hovercraft. You can easily change the definition of the system in the worksheet and generate a MPC controller for your application.