Journal of Fuzzy Systems and Control, Vol. 3, No 2, 2025

A Study of Adaptive Model Predictive Control for Rotary Inverted Pendulum

Phuc-Hoang Huynh 1, Khac-Chan-Nguyen Le 2, Truong-Phuc Nguyen 3, Hoang-Dang-Khoa Tran 4, Su-Truong Dang 5, Thanh-Quyen Nguyen 6, Thang-Phong Le 7, Huu-Hanh Nguyen 8, Pham-Hong-Linh Tran 9, Hau-Phuong Nguyen 10,

Hoang-Son Nguyen 11, Tai-Truong Nguyen 12, Hai-Thanh Nguyen 13,*

1, 3, 4, 5, 7, 8, 11 Faculty of Electrical and Electronics Engineering (FEEE), Ho Chi Minh City University of Technology and Education (HCMUTE), Ho Chi Minh City (HCMC), Vietnam

2, 8, 9, 12 Faculty of Mechanical Engineering, Ho Chi Minh City University of Technology and Education (HCMUTE),

Ho Chi Minh City (HCMC), Vietnam

6, 10 Faculty of Vehicle and Energy Engineering, Ho Chi Minh City University of Technology and Education (HCMUTE),

Ho Chi Minh City (HCMC), Vietnam

13 Nguyen Huu Canh Technical and Economics Intermediate School,500-502, Huynh Tan Phat St., Binh Thuan ward,

District 7, Ho Chi Minh City, Vietnam

Email: 1 21151503@student.hcmute.edu.vn, 2 21146129@student.hcmute.edu.vn, 3 21142576@student.hcmute.edu.vn,

4 21142548@student.hcmute.edu.vn, 5 18142232@student.hcmute.edu.vn, 6 20145594@student.hcmute.edu.vn,

7 21142147@student.hcmute.edu.vn, 8 21142093@student.hcmute.edu.vn, 9 21146121@student.hcmute.edu.vn,

10 21142154@student.hcmute.edu.vn, 11 20142402@student.hcmute.edu.vn, 12 20142438@student.hcmute.edu.vn,

13 nguyenhaithanh@nhct.edu.vn  

*Corresponding Author

Abstract—This paper proposes an Adaptive Model Predictive Control (MPC) approach for the rotary inverted pendulum (RIP). The method combines Linear Time-Varying (LTV) models at each sampling instant with a Linear Time-Varying Kalman Filter (LTVKF) for state estimation. By predicting and adapting to dynamic system changes, the controller achieves trajectory tracking performance comparable to non-adaptive MPC. However, the Adaptive MPC extends the arm’s operating range by up to 1.5 times, making it a promising solution for strongly nonlinear or time-varying systems like the RIP.

Keywords—Rotary Inverted Pendulum; Adaptive Control; Model Predictive Control; Kalman Filter; Linear Time-varying

  1. Introduction

RIP is a representative model in control theory, widely studied due to its strong nonlinearity [1], inherent instability, and practical applications in robotics [2][3]. Controlling this system requires advanced control methods capable of handling rapid dynamic changes and maintaining stability under various operating conditions.

Optimal control methods have always been a focus of researchers and have high applicability, such as Linear Quadratic Regulator (LQR) control [4], Linear Quadratic Gaussian (LQG) control [5] and the classical Euler-Lagrange variable method [6]. Among them, MPC is regarded as one of the optimal control methods due to its ability to control nonlinear systems in real-time and handle control constraints configured by the designer [7]. As a result, MPC has been widely applied in practice, such as in aircraft control [8], control of longitudinal flight dynamics of a fixed-wing UAV[9], oxygen stoichiometry control [10]. However, traditional MPC methods often rely on a linearized model at a fixed operating point, which limits the system's adaptability, especially when the pendulum arm follows reference signals with large amplitudes and rapid variations [11]. This is because, for strongly nonlinear systems, the system dynamics may no longer match the linearized dynamics at the original operating point when the working conditions deviate significantly. This limitation can lead to degraded performance when the system operates outside the valid range of the linearized model.

In practice, several studies have been conducted to address this issue, such as using Nonlinear MPC for swing-up and control of RIP [12], The advantage of this control method is that it can handle the system from any initial position. However, it requires high-performance hardware and involves complex algorithms to solve the non-convex optimization problem. Another approach is Gain-Scheduled MPC [13], which allows the design of multiple MPC controllers with different configurations, such as sampling time, prediction horizon, control horizon, and control weighting factors. While this method provides flexibility, its main drawback is that the number of controllers is finite, and careful selection is required for each operating condition.

Therefore, to effectively overcome nonlinear systems' control challenges, this paper proposes an adaptive MPC for RIP. Continuously updating the predictive model at each sampling instant enhances control performance and extends the operating range of the RIP system. The advantage of this controller is that it requires designing only a single controller offline, involves less run-time computational effort, has a smaller memory footprint, and is more robust to real-life changes in system conditions [14].

In [11], the authors provided a detailed explanation of the system variables, modeled the RIP system, and designed the non-adaptive MPC controller. In [15], they further discussed the parameter selection method for the Kalman filter used in the non-adaptive MPC controller and applied the same filter to the LQG controller to compare the control performance of non-adaptive MPC, LQG, and LQR. However, in both studies, the controllers were designed to perform well only around the operating point, as they were based on a linearized model at that point.

In this paper, the proposed approach builds upon the previously designed MPC controller by incorporating the LTV plants method and designing the LTVKF state estimator. The implementation results are simulated using MATLAB/Simulink.

  1. Modelling

RIP consists of an arm and a pendulum, with a DC motor mounted at the end of the arm. The pendulum is always stable in the downward position but unstable in the upright position. Therefore, the objective is to design a controller to keep the pendulum upright and move the arm along a predefined trajectory. The model structure is shown in Fig. 1, For details, a reader can be referred to [11].

  1. RIP Structure
  1. Design of Adaptive MPC Controller

The structure of the adaptive MPC controller applied to RIP is illustrated in Fig. 2.

  1. Structure of Adaptive MPC Controller

To design an Adaptive MPC controller, the steps are listed from part A to part C

  1. LTV Plant Configuration

By applying the Euler-Lagrange dynamic equations to describe the dynamics of the RIP and considering that a DC motor is used to generate the control force for the arm, it is necessary to combine two mathematical models: the DC motor and the RIP system. In [11], the authors modeled RIP under consideration.

To obtain the state-space equations at each operating point, state matrices A and B must be determined at each operating point and each sampling instant. The linearized system results are presented in (1).

(1)

where: : Arm angle (rad); : Pendulum angle (rad); : Control voltage (v); ; Matrices A and B are listed in (2)

(2)

State-space equation (1) It is in the continuous domain. To convert it into the discrete domain, the matrix exponential discretization method will be applied from equation (3) to equation (8) [16]:

        The general solution of the differential equation (1) can be expressed as:

(3)

Based on the general solution (3) of the continuous-time system, we obtain (4) and (5).

(4)

(5)

In (6), we rewrite the exponential function of the extended matrix

(6)

From (6), discrete-time matrices are obtained:

(7)

(8)

Where:

From this, the authors can summarize that to obtain Linear Time-Varying (LTV) models at each sampling instant, the system must be linearized at each sampling time using the equation (2), and then converted from the continuous domain to the discrete domain using equation (6) to equation (8).

  1. Design of MPC control

To design an Adaptive MPC controller, an MPC controller must first be designed at the initial operating point [17], at . This design was previously conducted in [11],[15]. Here, the author revisits the controller parameters as

  1. Design of the LTVKF State Estimator

Adaptive MPC utilizes a Kalman state estimator and adjusts the gain matrices  and  at each sampling instant to maintain consistency with the updated system model. The computed results are presented in equation (9) to equation (11) [17]:

(9)

(10)

(11)

Where:

  1. Results and Discussion

To evaluate the control performance of the Adaptive MPC controller, the author will simulate two controllers: a non-adaptive MPC designed in the previous study [15] and  Adaptive MPC. A simulation diagram of two controllers is illustrated in Fig. 3.

  1. Simulation Diagram of MPC and Adaptive MPC Controllers

Simulation results of MPC (orange line) and Adaptive MPC controllers (blue line) with measurement noise in the arm angle and pendulum angle, where the noise power is [0.00000001] and the arm angle follows a reference signal with f = 6 (rad), are presented in Fig. 4. 

A diagram of an electrical diagram

AI-generated content may be incorrect.

  1. System response when tracking a step signal

The control performance is evaluated using the Root Mean Square Error (RMSE) index, as presented in Table 1:

  1. System performance when tracking a step signal

Adaptive MPC

MPC

1.62

1.559

0.038

0.054

3.289

2.604

From the simulation results in Fig. 4 and the control performance in Table 1, we obtain

To further demonstrate that adaptive MPC can adapt to highly nonlinear systems when operating conditions change, the author will set the arm angle to track a reference signal with f=8 (rad). The results are shown in Fig. 5 and Fig. 6.

From Fig. 5, adaptive MPC controller is still able to track the reference signal, whereas the standard MPC fails to do so. Furthermore, the arm angle response remains smooth, and the overshoot in the pendulum angle is limited to 0.2 rad. This demonstrates that Adaptive MPC has excellent adaptability to sudden changes in operating conditions.

A diagram of an electrical diagram

AI-generated content may be incorrect.

  1. System response when tracking a step signal

To verify the trajectory tracking performance of both controllers when the reference signal is continuously varying, the author will set the arm to follow a sinusoidal signal with  (rad). Results are shown in Fig. 6.

A diagram of an electrical diagram

AI-generated content may be incorrect.

  1. System response when tracking a sinusoidal signal

Control performance is evaluated using the RMSE index, as presented in Table 2.

  1. System performance when tracking a sinusoidal signal

Adaptive MPC

MPC

1.232

1.293

0.019

0.018

2.399

0.891

From the results in Fig. 6 and the control performance in Table 2, the response performance of both controllers at alpha and beta is nearly equivalent. However, the average control voltage in Adaptive MPC is 2.5 times higher than in MPC. From this, adaptive MPC should only be used when the system dynamics change significantly due to varying operating conditions. This can be determined either through the system’s dynamic equations or through experimental testing.

  1. Conclusions

                By linearizing the system at every operating point and applying the matrix exponential discretization method to update the predictive model for the MPC controller, we obtain the Adaptive MPC controller. Since the model is updated at each sampling time, the conventional Kalman filter is no longer suitable. Therefore, the author has designed the LTVKF state estimator, which can estimate states based on the updated model.

Through simulations under various conditions, it is observed that Adaptive MPC delivers good control performance and is well-suited for highly nonlinear systems whose dynamics change significantly with operating conditions. However, it is also evident that standard MPC provides comparable control performance to Adaptive MPC when operating around the pre-linearized working point while significantly optimizing control energy compared to Adaptive MPC.

The comparison between the Adaptive MPC and non-adaptive MPC controllers also demonstrates that practical implementation is entirely feasible, as the simulation conditions leading to real-world experiments for the non-adaptive MPC controller were successfully conducted by the author in [15]. This controller presents a promising control method for systems with changing dynamics under varying operating conditions, such as autonomous vehicles, where the dynamics vary with steering angle and speed.

Acknowledgement

This paper belongs to project SV2025-56 of Ho Chi Minh City University of Technology and Education (HCMUTE). It is funded by HCMUTE. We also want to give thanks to the PhD. Van-Dong-Hai Nguyen (FEEE-HCMUTE) for his ideas in this contribution.

References

  1. S. N. Vassilyev, A. Y. Kelina, Y. I. Kudinov, and F. F.  Pashchenko, “Intelligent control systems,” Procedia Computer Science, vol. 103, pp. 623-628, 2017, https://doi.org/10.1016/j.procs.2017.01.088.
  2. H. F. Murcia and A. E. González, "Performance comparison between PID and LQR control on a 2-wheel inverted pendulum robot," 2016 IEEE Colombian Conference on Robotics and Automation (CCRA), Bogota, Colombia, 2016, pp. 1-6, 2016, https://doi.org/10.1109/CCRA.2016.7811420.  
  3. T.-D. Chu and C.-K. Chen, "Design and Implementation of Model Predictive Control for a Gyroscopic Inverted Pendulum," Applied Sciences, vol. 7, no. 12, 2017. https://doi.org/10.3390/app7121272.
  4. E. Kreindler, “Contributions to the theory of time-optimal control,” Journal of the Franklin Institute, vol. 275, no. 4, pp. 314-344, 1963, https://doi.org/10.1016/0016-0032(63)90689-6.  
  5. R. E. Kalman, "A new approach to linear filtering and prediction problems," J. Fluids Eng., vol. 82, no. 1, pp. 35-45, 1960, https://doi.org/10.1115/1.3662552.
  1. R. Ortega et alEuler-Lagrange systems (pp. 15-37). Springer London. 1998. https://doi.org/10.1007/978-1-4471-3603-3_2.
  2. S. J. Qin and T. A. Badgwell, "A survey of industrial model predictive control technology," Control Engineering Practice, vol. 11, no. 7, pp. 733-764, 2003, https://doi.org/10.1016/S0967-0661(02)00186-7.
  3. L. Chrif and Z. M. Kadda, "Aircraft control system using LQG and LQR controller with optimal estimation-Kalman filter design," Procedia Engineering, vol. 80, pp. 245-257, 2014, https://doi.org/10.1016/j.proeng.2014.09.084.
  4. A. Ingabire and A. A. Sklyarov, "Control of longitudinal flight dynamics of a fixedwing UAV using LQR, LQG and nonlinear control," in E3S Web of Conferences, vol. 104, p. 02001, 2019, https://doi.org/10.1051/e3sconf/201910402001.
  5. A. Niknezhadi et al., "Design and implementation of LQR/LQG strategies for oxygen stoichiometry control in PEM fuel cells based systems," Journal of Power Sources, vol. 196, no. 9, pp. 4277-4282, 2011, https://doi.org/10.1016/j.jpowsour.2010.11.059.
  1. H. H. Phuc et al., "Model Predictive Control for Rotary Inverted Pendulum: Simulation and Experiment," Journal of Fuzzy Systems and Control, vol. 2, no. 3, pp. 215-222, 2024, https://doi.org/10.59247/jfsc.v2i3.263.
  2. S. Jung and J. T. Wen, "Nonlinear model predictive control for the swing-up of a rotary inverted pendulum," J. Dyn. Sys., Meas., Control, vol. 126, no. 3, pp. 666-673, 2004, https://doi.org/10.1115/1.1789541.
  3. J. He, Y. Li, Z. Wei, and Z. Huang, "Gain-Scheduled Model Predictive Control for Cart–Inverted-Pendulum with Friction and Disturbances," Appl. Sci., vol. 13, no. 24, p. 13080, 2023, https://doi.org/10.3390/app132413080.
  4. J. -S. Kim, "Recent advances in adaptive MPC," ICCAS 2010, pp. 218-222, 2010, https://doi.org/10.1109/ICCAS.2010.5669892.
  5. P. H. Huynh, et al., “A Survey Of Lqg Over Mpc And Lqr Control For Rotary Inverted Pendulum,” Robotica & Management, vol. 29, no. 2, 2024, https://doi.org/10.24193/rm.2024.2.2.
  1. L. S. Shieh et al., "Discrete-continuous model conversion," Applied Mathematical Modelling, vol. 4, no. 6, pp. 449-455, 1980, https://doi.org/10.1016/0307-904X(80)90177-8.
  2. M. Bujarbaruah, X. Zhang, U. Rosolia and F. Borrelli, "Adaptive MPC for Iterative Tasks," 2018 IEEE Conference on Decision and Control (CDC), 2018, https://doi.org/10.1109/CDC.2018.8618694.

Phuc-Hoang Huynh, A Study of Adaptive Model Predictive Control for Rotary Inverted Pendulum