Control Demo

2D version of a rotary inverted pendulum with swing-up and balance controllers

Here is my first JavaScript demo. It runs a simulation model of a rotary inverted pendulum (RIP) system, where a freely rotating pole is attached to a horizontally rotating arm driven by a gearbox connected to a motor underneath. It is portrayed as a linear cart-pole system here, since simple 2D graphics could be used to display it.

This is a detailed non-linear model of an actual RIP system from the Department of Electronics at York. Most notably, it includes the effects of gearbox backlash. It uses a full state feedback controller for balancing and an energy-based controller for the swing-up stage. The user interface below allows you to change the coefficients of the control laws (gains), where α is the angular position of the pendulum and θm is the angular position of the motor's rotor which drives the arm (if not for gearbox backlash, it would be directly proportional to the linear position of the pendulum's pivot point). The system input is the voltage applied to the motor (Vm). You can also choose to include or exclude the effects of gearbox backlash in the simulation.

Balance controller: Vm = θm + θ'm - α - α'

Swing-up controller: Vm = α'cos(α)

Here is a short video of the real system performing the same task: