# Design and Implementation of Model Predictive Control for a Gyroscopic Inverted Pendulum
## 1 Introduction
The validity of the pendulum model combined with a single-wheel pendulum robot was verified by experimental data. Similarly, [PERSON] et al. [23] used an inverted pendulum to evaluate the efficiency of a stabilizing device before applying it to a bicycle. In studies to enhance human balance using gyroscopic effect, [PERSON] et al. [4; 5] conducted experiments on an inverted pendulum test bench instead of using an actual human. Balancing an inverted pendulum also is an attractive topic in the field of control engineering. Numerous control algorithms have been proposed to address this problem. Using a classical control approach, [PERSON] et al. [24] used multiple loops of PD controllers, while [PERSON] and [PERSON] [25] used a proportional-integral-derivative (PID) controller for the inner loops and a linear controller for the outer loop. In another approach, [PERSON] and [PERSON] [26] proposed an evolutionary neural fuzzy controller that controls an inverted pendulum system. [PERSON] et al. [27] applied sliding mode control theory and [PERSON] et al. [28] proposed model predictive controllers to stabilize a critical damped inverted pendulum. Compared with other control algorithms, the model predictive controller (MPC) offers an optimal control solution that minimizes output errors and control efforts. MPC predicts future outputs over a horizon using a state-space model of the system and incorporates the predicted output errors in a quadratic cost function. The cost function is minimized and subjected to the system's hard constraints during control process by using the quadratic programing method. Hence, MPC can effectively deal with constraints of the system and it is very important for a controller to deal with these constraints since they are present in many real-life system, such as the system's natural and physical limitations. As discussed in the literature on applying gyroscopic effects to actively stabilize single-track vehicles, most of these studies focused on using gyroscopic torque of the spinning flywheels to maintain a bicycle upright under impact disturbances. Using a gyroscopic stabilizer provides the bicycle with the advantage of strong stability at low speeds, especially when it is difficult for the steering control to maintain bicycle balance [29]. However, a single-track vehicle requires a roll angle to be stable under the centrifugal forces of turning, and controlling a single-track vehicle so that it is upright at all times significantly reduces its mobility in turning. Even when some advanced algorithmswere used to control the gyroscope systems [18; 19; 20], they still could not stabilize a bicycle when the centrifugal forces appeared. In this study, the gyroscopic effect is applied to design an assistant system for single-track vehicles that can actively help stabilize the vehicle in cases with and without centrifugal forces. To control the stabilizing system, which is a multiple input, multiple output control problem under the hard constraints of physical limitations, this study proposes the use of model predictive controllers. The MPC design is based on an inverted pendulum-like model of a bicycle. Then, a gyroscopic inverted pendulum is used to evaluate the performance of the control strategies in cases of with and without centrifugal forces. The feasibility and real-time performance of the MPC are evaluated by embedding the algorithm for real-time microprocessor boards. This paper is organized as follows, Section 1 gives a literature review of related research and specifies motivation for this study. In Section 2, the dynamics of a gyroscopic inverted pendulum is described, and Lagrangian equations are used to obtain the governing equations for the system. The equations of motion for the system are then verified by comparing the response with that provided by the commercial software ADAMS model (MSC Software Corporation, Newport Beach, CA, USA). Section 3 describes the design of model predictive controllers and control strategies to stabilize the system.