Abstract
Inverted pendulum has been a benchmark system in dynamics and control theory. This system has an inherit feature of being nonlinear, unstable and underactuated. Due to which, it is widely known as a test bench to evaluate the capability and performance of emerging control algorithms. Furthermore, the inverted pendulum system is also known to resemble many real-world problems including Segway’s, humanoid robots, to name a few. The literature on inverted pendulum system reveals a wide range of controllers. The linear quadratic regulator (LQR) is one of the well-known optimal controllers; however, it lags in robustness. The sliding mode controller is known for its robustness characteristics; however, it has a problem of non-robust reachability phase. To solve the problems in both the controllers while retrieving their advantages, this paper presents the design of a hybrid controller which is a combination of LQR and sliding mode controller for the robust control of rotary inverted pendulum. This controller uses LQR as a baseline controller for optimal performance and a sliding mode controller to robustly control the system against matched uncertainties. The robustness of the proposed controller is validated on a real-time rotary inverted pendulum subjected to an input disturbance. The obtained simulation as well as experimental results show that the proposed controller performed satisfactorily with robustness to matched uncertainties. Furthermore, the problem of chattering in the controller is dealt by smoothening the control input with insignificant loss in robustness.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
In the field of dynamics and control theory, inverted pendulum is one of the challenging problems because of its distinct characteristics of being nonlinear, unstable and underactuated. Therefore, the inverted pendulum system is used as a test bed to validate the performance of emerging control strategies [1]. Apart from that, the dynamics of inverted pendulum is analogous to many real-time applications including underactuated robotic systems [2], humanoid robots [3], Segway [4], buildings [5], and vertical take-off and land aircrafts [6], etc. Based upon the motion constraints of the base of the inverted pendulum systems, they can be categorized into two classes, i.e., the rotary inverted pendulum (RIP) system [7] and the linear inverted pendulum system [8]. In rotary inverted pendulum, the pendulum is hinged to a rotary arm which is actuated in order to control the motion of both rotary arm and pendulum, whereas in linear inverted pendulum, the pendulum is hinged to a cart which is actuated linearly in order to control the motion. This paper focuses on rotary inverted pendulum.
The literature on the control of inverted pendulum system can be broadly classified into three categories, i.e., swing-up control problem [9], stabilization control problem [10] and tracking control problem [11]. Stabilization and tracking control problems have diverse applications due to which they are exhaustively studied in the literature. Significant control algorithms including PID controller [2], pole placement controller [12], LQR controller [13, 14], sliding mode controller [15,16,17], linear quadratic Gaussian controller [17, 18], state-dependent Riccati equation-based controller [19], perceptual controller [20], model estimation-based controller [21, 22], fuzzy controller [7, 10, 23] and neural network-based controller [24, 25] have been proposed in the literature for the stabilization as well as tracking control problem of the inverted pendulum. The linear quadratic regulator (LQR) controller is one of the well-known optimal controllers; however, it is not robust to uncertainties in the system. The sliding mode controller is known for its robustness characteristics; however, it has a problem of non-robust reachability phase where the controller becomes sensitive to uncertainties.
Therefore, the objective of this work is to design a hybrid controller for rotary inverted pendulum which takes advantage of the optimality in LQR controller and robustness in sliding mode controller while eliminating the non-robust reachability phase in the sliding mode controller. This controller has a characteristic feature of avoiding non-robust reachability phase present in conventional sliding mode controllers while achieving robustness to matched uncertainties. The approach to design LQR-based sliding mode controller along with the stability analysis is presented, and the simulation as well as experimental investigation on the real-time stabilization control of rotary inverted pendulum is conducted. The robustness of the proposed controller to matched uncertainties is validated by adding a disturbance in the input of the controller. Furthermore, the problem of chattering in the controller is dealt by smoothening the control input with an insignificant loss in robustness.
The paper is structured as follows: Sect. 2 illustrates the dynamic modeling of rotary inverted pendulum, while Sect. 3 discusses the design of LQR-based sliding mode controller. In Sect. 4, implementation of LQR-based sliding mode controller on rotary inverted pendulum and its simulation and experimental results are presented, and finally the conclusions are drawn in Sect. 5.
2 Dynamic Modeling of Rotary Inverted Pendulum
Consider a RIP system consisting of the pendulum of length Lp connected/hinged to the end of a rotary arm of length Lr as shown in Fig. 1. The rotary arm is directly actuated by the direct-drive rotary servomotor of input voltage Vm, while the pendulum is underactuated and is indirectly controlled by the rotary arm. Let Jp and Jr correspond to the mass moment of inertia of pendulum and rotary arm about their center of mass, respectively. Here, \(\theta\) symbolizes the rotary arm angle and \(\alpha\) represents the pendulum angle such that pendulum angle zero corresponds to the vertically upright position of the pendulum. The experimentation is done on the QUBE-Servo platform, as shown in Fig. 2, and the parameters of system are described in Table 1.
Considering the viscous friction of the pendulum and rotary arm with the addition of motor dynamics, the dynamics of the RIP can be given by the following nonlinear equations [7, 26]:
Thus, the dynamics of the rotary inverted pendulum is represented by (1) and (2). These nonlinear equations can be linearized around the stabilization point, i.e., \(\alpha = 0\), with an assumption that the controller bounds the pendulum angle near the stabilization point with small velocities. Considering the state vector \({\mathbf{x}} = \left[ {\theta \alpha \dot{\theta }\dot{\alpha }} \right]^{T}\), the system can be depicted in the state-space form by:
where \(J_{t} = J_{p} m_{p} L_{r}^{2} + J_{r} J_{p} + \frac{1}{4}J_{r} m_{p} L_{p}^{2}\). After incorporating the parameter values, the state-space equation can be rewritten as:
3 LQR-based Sliding Mode Control
The basic idea behind the proposed LQR-based sliding mode controller is to obtain an optimal control of the system while avoiding the non-robust reachability phase present in conventional sliding mode controllerFootnote 1. This is done by enforcing a sliding mode from the initial value of the system response; thus, the controller will be robust to matched uncertainties during the entire system response. While designing the proposed controller, it is considered that there exists a nominal LQR controller which has already been properly designed for nominal plant to ensure asymptotic stability as well as predefined performance of the system. To maintain the nominal performance along with insensitivity to external disturbances and matched uncertainties, a discontinuous sliding mode controller is combined to the nominal LQR controller.
To design the proposed LQR-based sliding mode controller, firstly a nominal LQR controller is designed assuming the nominal plant as given in (5). The state-space representation of the nominal plant system is given as follows:
where \({\mathbf{x}}\left( t \right)\) represents a state vector, \(u_{n} \left( t \right)\) represents an input vector, and A and B are the state matrices. The LQR controller works with an objective of minimizing the cost function, given in (6). The cost function for LQR controller is given by:
where \({\mathbf{e}}\left( t \right) = {\mathbf{x}}_{{\varvec{des}}} \left( t \right) - {\mathbf{x}}\left( t \right)\) denotes the error between the desired state vector \({\mathbf{x}}_{{\varvec{des}}} \left( t \right)\) and measured state vector \({\mathbf{x}}\left( t \right)\). The state weighing matrix Q and control cost matrix R are defined by user and play a significant role in the performance of the controller. The output of the controller can be expressed as:
where K denotes the state feedback matrix which can be represented as:
where P is obtained by solving algebraic Riccati equation given as:
Thus, the state feedback matrix K is dependent on A, B, Q and R matrix, where, the matrices A and B are dependent on the system under consideration, while the matrices Q and R are selected by user based on desired performance. The MATLAB command lqr can also be used to evaluate the state feedback matrix K as:
Furthermore, after designing an LQR controller, a discontinuous sliding mode controller is integrated with LQR controller to compensate the effect of parametric uncertainties and input disturbance. The plant dynamics with parametric uncertainties and input disturbance is represented as follows:
The additional \({\mathbf{d}}\left( {{\mathbf{x}},t} \right)\) term in (11) accounts for unmolded plant dynamics and input disturbance which satisfies the matching condition given by:
where \(d_{m}\) denotes a bounded disturbance in input with some known maximum value. The control input for the system in (11) is given as
where \(u_{n}\) represents the nominal control input given by LQR controller and \(u_{d}\) represents the discontinuous control input given by sliding mode controller. On substituting the value of \(u\) in (13) into (11), the plant dynamics can be represented as:
The sliding surface for sliding mode controller is taken as
where G is a user-defined matrix. During sliding, \(s\left( t \right) = \dot{s}\left( t \right) = 0\) and therefore
Substituting the value of \({\dot{\mathbf{x}}}\left( t \right)\) from (14) in (16), we obtain:
During sliding, it is expected that \(u_{{d{\text{eq}}}} \left( t \right) = - \varvec{ }d_{m}\), i.e., it should compensate for the uncertainty; then, selecting
ensures
and so, during sliding \(u_{{d{\text{eq}}}} \left( t \right) = - \varvec{ }d_{m}\). Substituting the value of \(u_{{d{\text{eq}}}} \left( t \right)\) in (14), the system is governed by the same state-space representation of (5). Thus, it can be said that the effect of matched uncertainty has been completely rejected and the system is governed by (5) for which nominal control input \(u_{n} \left( t \right)\varvec{ }\) is given by LQR controller. Furthermore, using (15) and (18), the hybrid sliding surface which eliminates the reachability phase is given as
Note that the term \(- {\mathbf{x}}\left( 0 \right)\) in (20) ensures that \(s\left( 0 \right) = 0,\) so the reachability phase is eliminated. Thus, the sliding mode will exist from the very beginning (\(t = 0\)) and the system robustness against matched uncertainties is ensured throughout the entire closed-loop system response. The matrix G is chosen as \({\mathbf{G}} = {\mathbf{B}}^{ + }\) so as to ameliorate the effect of unmatched disturbance. Here, \({\mathbf{B}}^{ + }\) denotes left inverse of B and is given by
3.1 Stability Analysis
The discontinuous control input for sliding mode control is computed using Lyapunov stability theorem. The Lyapunov function considered is given as
\(\dot{V}\left( t \right)\) can be given as:
Furthermore, substituting \(\dot{s}\left( t \right)\) from (19), \(\dot{V}\left( t \right)\) can be formulated as:
Now, the discontinuous control input which satisfies Lyapunov stability condition \(\dot{V} < 0\) is chosen as
Substituting the value of \(u_{d}\) from (25) in (24) yields:
Since \(\varvec{G} = \varvec{B}^{ + }\) implies \(\varvec{GB} = 1\), (26) can be further written as
So, for the system to be stable (\(\dot{V} < 0\)), the value of the modulation gain M should be chosen as
Hence, the above condition will enforce the sliding mode and therefore ensure the stability of the system.
4 Results and Discussion
In this section, the proposed controller is implemented on rotary inverted pendulum system and the simulation as well as experimental results are presented. The objective of the controller is to track the desired trajectory for the rotary arm while stabilizing the pendulum at the vertically upright position, i.e., the unstable point. The robustness of the proposed controller against matched uncertainties is investigated by adding the disturbance at the input of the rotary inverted pendulum system. A square wave of magnitude 1 V and frequency f = 1 Hz (as shown in Fig. 3) is added as an input disturbance to the input of rotary inverted pendulum. The results of the proposed controller are compared with the results of the conventional LQR controller, to observe the improvement in the robustness.
The tuning parameters for LQR controller are chosen as Q = diag[5, 1, 1, 20] and R = 1 based on trial-and-error method. Using the chosen tuning parameters, the LQR gain K is calculated as
Thus, the nominal LQR control input \(u_{n}\) can be obtained from (7). To compensate the effect of input disturbance of magnitude \(d_{m} = 1\), M is chosen in accordance with (29) as 1.1. The design matrix G using (21) is computed as \({\mathbf{G}} = [\begin{array}{*{20}c} {\begin{array}{*{20}c} { - 2.2361} & {53.8740} \\ \end{array} } & {\begin{array}{*{20}c} { - 1.7400} & {6.5269} \\ \end{array} ]} \\ \end{array}\). Thus, the discontinuous control input \(u_{d}\) is given as:
Incorporating (30) and (31) in (13) yields
The MATLAB Simulink environment is used in order to obtain simulation as well as experimental results. The block diagram for the experimentation is shown in Fig. 4. The comparison of simulation and experimentation response for LQR and LQR-SMC controller on rotary inverted pendulum is shown in Figs. 5 and 6, respectively.
From Figs. 5 and 6, a close agreement between the simulation and experimental results is observed. The range of magnitude of the results appears to be the same; however, a shift in phase is observed between the experimental results and simulation results in Fig. 5. This could be because of unmodeled dynamics or time delay in the simulation results. A similar pattern in phase shift is observed in Fig. 6. However, the magnitude of error is observed to be larger in simulation results compared to experimental results. This could be because of the finite sampling rate of the sensors.
The comparison of experimental response of LQR and proposed LQR-SMC controller is shown in Fig. 7. From the results, a large oscillation of magnitude 8 degree and 2 degree around the desired rotary arm position and pendulum angle, respectively, is observed using conventional LQR controller. However, using the proposed LQR-SMC controller a small oscillation of magnitude 3 degree and 1 degree is observed around the desired rotary arm position and pendulum angle, respectively. Thus, a reduction in error is detected using the proposed LQR-SMC controller, thus validating the improved robustness to input disturbance.
Also, it can be noted that the discontinuous control input \(u_{d}\) contains a signum function, which leads to abrupt switching in control input and thus might be harmful for practical situations. Thus, to prevent it, the discontinuous control input is smoothened by replacing signum function with a smooth function given as
Here, \(\delta\) controls the smoothness of the function, i.e., increasing the value of δ causes an increase in the smoothness of the function. However, choosing a large value of δ causes a degradation in the robustness and performance of the controller. Figure 8 shows the response of the system using the smooth function [given in (33)] for \(\delta = 0.001\). The results show that with the use of smooth function for \(\delta = 0.001\), the control input is reduced and smoothened with a minor loss in performance of the controller.
5 Conclusions
In this work, an LQR-based sliding mode controller for stabilization problem of the rotary inverted pendulum is proposed. The primary objective of this work is to achieve better robust performance than conventional controllers, which is done using the proposed LQR-based sliding mode controller. The proposed controller is robust to matched uncertainties along with having an advantage of avoiding non-robust reachability phase over conventional sliding mode controller. The simulation and experimental results are obtained for the proposed controller, which are furthermore compared to the results of conventional LQR controller to validate the robustness of the proposed controller. The comparative results have shown that the proposed controller has outperformed the conventional LQR controller in achieving better robust performance to matched uncertainties. Furthermore, a smooth LQR-based sliding mode controller is proposed to deal with the problem of chattering in control input of which the comparative results have shown a reduced and smoothened control input with minor loss in robust performance.
Notes
The proposed LQR based sliding mode controller is a special case of integral sliding mode controller [27] where an LQR controller acts as a nominal controller to achieve optimal control.
References
Davison, E.J.: Benchmark problems for control system design. Maturitas (1990)
Wang, J.J.: Simulation studies of inverted pendulum based on PID controllers. Simul. Model. Pract. Theory 19(1), 440–449 (2011)
Elhasairi, A.; Pechev, A.: Humanoid robot balance control using the spherical inverted pendulum mode. Front. Robot. AI 2(1), 1–13 (2015)
Younis W.; Abdelati, M.: Design and implementation of an experimental segway model. In: AIP Conference Proceedings, pp. 350–354 (2009)
Housner, G.W.: The behavior of inverted pendulum structures during earthquakes. Bull. Seismol. Soc. Am. 53(2), 403–417 (1963)
Martin, P.; Devasia, S.; Paden, B.: A different look at output tracking: control of a VTOL aircraft. Automatica 32(1), 101–107 (1996)
Chawla, I.; Singla, A.: Real-time control of a rotary inverted pendulum using robust LQR-based ANFIS controller. Int. J. Nonlinear Sci. Numer. Simul. 19(3–4), 379–389 (2018)
Chawla, I.; Singla, A.: System identification of an inverted pendulum using adaptive neural fuzzy inference system. In: Yadav, N., Yadav, A., Bansal, J., Deep, K., Kim, J. (eds.) Harmony Search and Nature Inspired Optimization Algorithms. Advances in Intelligent Systems and Computing, vol. 741, pp. 809–817. Springer, Singapore (2019)
Muškinja, N.; Tovornik, B.: Swinging up and stabilization of a real inverted pendulum. IEEE Trans. Ind. Electron. 53(2), 631–639 (2006)
Chawla, I.; Chopra, V.; Singla, A.: Robust LQR based ANFIS control of x-z inverted pendulum. In: Amity International Conference on Artificial Intelligence, pp. 818–823 (2019)
Patra, A.K.: Adaptive Kalman filtering model predictive controller design for stabilizing and trajectory tracking of inverted pendulum. J. Inst. Eng. Ser. B. 101(6), 677–688 (2020)
Singla, A.; Singh, G.: Real-time swing-up and stabilization control of a cart-pendulum system with constrained cart movement. Int. J. Nonlinear Sci. Numer. Simul. 18(6), 525–539 (2017)
Kathpal, A.; Singla, A.: SimMechanics™ based modeling, simulation and real-time control of rotary inverted pendulum. In: International Conference on Intelligent Systems and Control, pp. 166–172 (2017)
Waszak, M.; Łangowski, R.: An automatic self-tuning control system design for an inverted pendulum. IEEE Access 8, 26726–26738 (2020)
Park, M.S.; Chwa, D.: Swing-up and stabilization control of inverted-pendulum systems via coupled sliding-mode control method. IEEE Trans. Ind. Electron. 56(9), 3541–3555 (2009)
Huang, J.; Zhang, M.; Ri, S.; Xiong, C.; Li, Z.; Kang, Y.: High-order disturbance-observer-based sliding mode control for mobile wheeled inverted pendulum systems. IEEE Trans. Ind. Electron. 67(3), 2030–2041 (2020)
Bayram, A.; Kara, F.: Design and control of spatial inverted pendulum with two degrees of freedom. J. Braz. Soc. Mech. Sci. Eng. 3(10), 1–14 (2020)
Eide, R.; Egelid, P.M.; Stamsø, A.; Karimi, H.R.: LQG control design for balancing an inverted pendulum mobile robot. Intell. Control Autom. 2(2), 160–166 (2011)
Huifeng, C.; Hongxing, L.; Peipei, Y.: Swinging-up and stabilization of the inverted pendulum by energy well and SDRE control. In: Chinese Control and Decision Conference, pp. 2222–2226 (2009)
Johnson, T.; Zhou, S.; Cheah, W.; Mansell, W.; Young, R.; Watson, S.: Implementation of a perceptual controller for an inverted pendulum robot. J. Intell. Robot. Syst. 99, 683–692 (2020)
Sun, J.: Control of rotary inverted pendulum using model-free backstepping technique. IEEE Access 7, 96965–96973 (2019)
Barkat, A.; Hamayun, M.T.; Ijaz, S.; Akhtar, S.; Ansari, E.A.; Ghous, I.: Model identification and real-time implementation of a linear parameter–varying control scheme on lab-based inverted pendulum system. Proc. Inst. Mech. Eng. Part I J. Syst. Control Eng. 235(1), 30–38 (2021)
Susanto, E.; Wibowo, A.S.; Rachman, E.G.: Fuzzy swing up control and optimal state feedback stabilization for self-erecting inverted pendulum. IEEE Access 8, 6496–6504 (2020)
Ping, Z.; Hu, H.; Huang, Y.; Ge, S.; Lu, J.: Discrete-time neural network approach for tracking control of spherical inverted pendulum. IEEE Trans. Syst. Man Cybern. Syst. 50(8), 2989–2995 (2018)
Hassan, S.; Arkady, Z.; Yushchenko, S.; Navvabi, H.: Robust control based on adaptive neural network for rotary inverted pendulum with oscillation compensation. Neural Comput. Appl. 32(18), 14667–14679 (2020)
Chawla, I.; Singla, A.: ANFIS based system identification of underactuated systems. Int. J. Nonlinear Sci. Numer. Simul. 21(7–8), 649–660 (2020)
Utkin, V.; Shi, J.: Integral sliding mode in systems operating under uncertainty conditions. In: Proceedings of the IEEE conference on decision and control, pp. 4591–4596 (1996)
Acknowledgements
This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors declare that they have no conflict of interest.
Rights and permissions
About this article
Cite this article
Chawla, I., Singla, A. Real-Time Stabilization Control of a Rotary Inverted Pendulum Using LQR-Based Sliding Mode Controller. Arab J Sci Eng 46, 2589–2596 (2021). https://doi.org/10.1007/s13369-020-05161-7
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s13369-020-05161-7