Skip to content

Inverted Pendulum

Control Theory Demonstration with SIMulation Workbench

The inverted pendulum problem is one of the most well-known exercises in control theory.The premise is simple:

  • A pendulum, when placed upside-down, becomes an unstable equilibrium. Keeping it upright requires effort, as minute, natural disturbances can cause the pendulum to quickly topple over.
  • By applying a well-calculated force to the base of the pendulum, one can counteract any torque an unbalanced pendulum experiences from gravity, allowing it to remain upright.
  • Keeping an inverted pendulum upright requires constant execution of precise adjustments. These adjustments must be performed in real-time, as latency can easily disrupt the system, allowing the pendulum to tip over. High-speed signal processing and calculations are thus required.

To demonstrate the capabilities of SIMulation Workbench and Concurrent Real-Time’s Programmable FPGA card, Concurrent Real-Time has designed and built a working model of an inverted pendulum system. Using advanced features of SIMulation Workbench such as the the Real-Time Database (RTDB), Human Interface builder (HMI), and FPGA IP Core Modules, Concurrent Real-Time is able to balance this inverted pendulum system.

Balance is achieved through a user program written in C. The program updates every 250 microseconds, meaning that the control loop operates at 4000Hz. At the beginning of each 250µs frame, the user program reads the current angle of the pendulum, provided by an Angular Decoder IP Core. The program then uses proportional-integral-derivative (PID) control to calculate an appropriate response. The output is then sent to a PWM Output IP Core, which controls the motor controller onboard the pendulum cart.

Additionally, an ultrasonic sensor is used to measure the position of the cart along the track. This is achieved using both a PWM Output and PWM Input IP Core. By sending a fixed duty cycle signal to the ultrasonic sensor and observing the received duty cycle from the sensor, the user program can determine where the cart is on the track. The user program can then correct the cart if it strays too close to the edge of the track.

During operation, various aspects of the control program can be observed through the HMI display. The HMI is a GUI that features real-time graphs showcasing the angle of the pendulum, the throttle and acceleration of the cart, as well sliders that allow the operator to tune the PID controller on-the-fly.

The inverted pendulum problem possesses many real-world applications. Some examples include self-balancing robots, rocket thrust control systems, and personal mobility devices such as segways and “hoverboards.” By showcasing Simulation Workbench’s ability to solve the inverted pendulum problem with ease, Concurrent Real-Time hopes to clearly illustrate the potential for Simulation Workbench to be effectively utilized in similar, yet more complex applications.

Back to top