Model Predictive Control

Inverted Pendulum

Nonlinear MPC applied to an Inverted Pendulum Apparatus

This video shows the pendulum swinging up and being controlled about the upright position. It uses a Nonlinear Model Predictive Control algorithm.


The apparatus shown below is a simple inverted pendulum characterised by:

  • A cart that is free to move along the rails and is driven by belt from a motor;
  • A pendulum that is situated on the cart and can swing freely about its axis;
  • Nonlinear and reasonably fast dynamic behaviour (unstable about the pendulum up position);
  • Single input (PWM signal to motor) multiple output (cart position and pendulum angle) system;
  • Constraints: the PWM signal must be between 0 and 100% duty cycle, and the cart cannot travel beyond the rails;

Our purpose here is to take the pendulum from the hanging down to the standing up position via NMPC. No switching is used, just the one controller for both swing up and control about the vertical position. Currently we are achieving the following results:

  • 40Hz sampling rate with prediction horizon of 60 samples (provides 1.5 seconds prediction horizon);
  • Handles both input and rail limit constraints;
  • Optimisation problem solved via full Sequential Quadratic Programming method;
  • Control algorithm running on a 2GHz laptop via ethernet as shown in the Block Diagram below;

Pendulum System Block Diagram

FPGA Block Diagram

Drilling down further into the design the custom VHDL code consists of 5 major modules seen below.

Maintained by Dr. Adrian Wills
University of Newcastle
22 Aug 2009, © Copyright