# Stabilizing a Rotary Inverted Pendulum Based on Logarithmic Lyapunov Function

Authors: Jie Wen; Yuanhao Shi; Xiaonong Lu
Journal: Journal of Control Science and Engineering
 (2017)

---

## Abstract

The stabilization of a Rotary Inverted Pendulum based on Lyapunov stability theorem is investigated in this paper. The key of designing control laws by Lyapunov control method is the construction of Lyapunov function. A logarithmic function is constructed as the Lyapunov function and is compared with the usual quadratic function theoretically. The comparative results show that the constructed logarithmic function has higher numerical accuracy and faster convergence speed than the usual quadratic function. On this basis, the control law of stabilizing Rotary Inverted Pendulum is designed based on the constructed logarithmic function by Lyapunov control method. The effectiveness of the designed control law is verified by experiments and is compared with LQR controller and the control law designed based on the quadratic function. Moreover, the system robustness is analyzed when the system parameters contain uncertainties under the designed control law.


---

## Body

## 1. Introduction

The Rotary Inverted Pendulum, which was proposed by Furuta et al. [1], is a well-known test platform to verify the control theories due to its static instability. Rotary Inverted Pendulum has also significant real-life applications, for example, aerospace vehicles control [2, 3] and robotics [4–6]. Considering the mentioned facts, Rotary Inverted Pendulum is selected as the controlled system and lots of control problems are concerned by researchers, such as stabilizing the pendulum around the unstable vertical position [7–9], swinging the pendulum from its hanging position to its upright vertical position [10–13], and creating oscillations around its unstable vertical position [14, 15].For the swing-up and stabilizing control of Rotary Inverted Pendulum, a variety of control methods had been applied. Jose et al. [16] and Akhtaruzzaman and Shafie [17] all used proportional-integral-derivative (PID) and linear quadratic regulator (LQR) to balance the pendulum in its upright position, while PD cascade scheme was applied to the switching-up control of the pendulum and fuzzy-PD regulator to the stabilizing control of the pendulum by Oltean [18]. Besides, Hassanzadeh and Mobayen used particle swarm optimization (PSO) method to search and tune the controller parameters of PID in the control of balancing the pendulum in an inverted position [19].Except these classical control techniques, several advanced control methods are also used to design controllers to stabilize the pendulum in upright vertical position. For example, Chen and Huang proposed an adaptive controller to bring the pendulum close to the upright position regardless of the various uncertainties and disturbances [20]. Hassanzadeh and Mobayen applied evolutionary approaches which include genetic algorithms (GA), PSO, and ant colony optimization (ACO) methods to balance the pendulum in inverted position [21]. Hassanzadeh et al. also proposed an optimum Input-Output Feedback Linearization (IOFL) cascade controller utilized GA to balance the pendulum in an inverted position, in which GA method was used to search and tune the controller parameters [22]. Furthermore, the fuzzy logic control [23], H-∞ control [24], and sliding mode control [25] are all used to achieve the same control objective.On the other hand, the inverted system can be underactuated and nonholonomic systems. Yue et al. used indirect adaptive fuzzy and sliding mode control approaches to achieve simultaneous velocity tracking and tilt angle stabilization for a nonholonomic and underactuated wheeled inverted pendulum vehicle [26]. Different from [26], some researchers focus on the study of the general classes of underactuated and nonholonomic systems. For example, Mobayen proposed a new recursive terminal sliding mode strategy for tracking control of disturbed chained-form nonholonomic systems whose reference targets are allowed to converge to zero in finite time with an exponential rate [27]. Mobayen also proposed a recursive singularity-free, fast terminal sliding mode control method, which is able to avoid the possible singularity during the control phase, which is applied for a finite-time tracking control of a class of nonholonomic systems [28].Among various control methods, Lyapunov control method is a simple method of designing control laws and can be applied to linear systems and nonlinear systems. Particularly, the analytic expression of designed control laws can be obtained, which help to analyze the control performances and system characteristics. Thus we use Lyapunov control method to achieve stabilizing control of Rotary Invert Pendulum in this paper. The key point of Lyapunov control method is the construction of the Lyapunov function. Aguilar-Ibanez et al. [8] and Türker et al. [9] all selected energy function as Lyapunov function from the quadratic function and used Lyapunov’s direct method to stabilize Rotary Inverted Pendulum. Energy function considered the physical system and was constructed from physical standpoint, which leads to the application of constructed energy function confined to the considered physical system. For different physical systems, the energy functions are different and need to be constructed respectively. Instead of energy function, we construct the Lyapunov function from mathematical standpoint. Based on the quadratic function and Taylor series, a logarithmic function is constructed and as Lyapunov function, which is applicable to not only Rotary Inverted Pendulum but also the physical systems with the linear or nonlinear models. Based on the logarithmic Lyapunov function, the control laws of stabilizing Rotary Inverted Pendulum are designed by Lyapunov method in this paper, that is, balancing the pendulum in its upright position. In order to describe the properties of the constructed logarithmic function, the relationships between the usual quadratic function and the constructed logarithmic function are compared in numerical value and convergence speed. The comparative results show that the logarithmic function has higher numerical accuracy and faster convergence speed, which will be also verified in experiments. Furthermore, the experiment results also show that the designed control law by Lyapunov method in this paper can also achieve swing-up control of Rotary Inverted Pendulum. Based on these results, the system robustness is analyzed when the system parameters contain uncertainties under the designed control law. Thus, the main construction of this paper is to construct a logarithmic function as Lyapunov function and prove that the logarithmic function has higher numerical accuracy and faster convergence speed.The remaining of this paper is organized as follows. Section2 introduces the mathematical model of Rotary Inverted Pendulum and describes the control objective. The construction and analysis of logarithmic Lyapunov function as well as the design of control laws and robustness analyses are shown in Section 3. The experiments in Section 4 are used to verify the effectiveness of the designed control laws and the analyzed conclusions of logarithmic Lyapunov function as well as the system robustness. Lastly, Section 5 concludes the paper.


## 2. Mathematical Model of Rotary Inverted Pendulum

Rotary Inverted Pendulum is composed of a rotating arm which is driven by a motor and a pendulum mounted on arm’s rim, whose structure is shown in Figure1. The pendulum moves as an inverted pendulum in a plane perpendicular to the rotating arm. α and θ are employed as the generalized coordinates to describe the inverted pendulum system. The pendulum moves a given α while the arm rotates with an angle of θ.Figure 1
Schematic diagram of Rotary Inverted Pendulum.By applying Newton method or Lagrange method [29], one can get the nonlinear mathematical model of Rotary Inverted Pendulum [24, 30]:(1)Jeq+mr2θ¨+mlrsin⁡αα˙2-mlrcos⁡αα¨=T-Bqθ˙43ml2α¨-mlrcos⁡αθ¨-mglsin⁡α=0,where V is voltage and T is torque and given as(2)T=ηmηgKtKgV-KgKmθ˙Rm.The parameters in (1) and (2) are described in Table 1, which is the same as [24].Table 1
Descriptions of physical parameters.
Parameter Description J e q Moment of inertia at the load m Mass of pendulum arm r Rotating arm length l Length to pendulums center of mass g Gravitational constant B q Viscous damping coefficient K t Motor torque constant K g System gear ratio K m Back-EMF constant R m Armature resistance η m Motor efficiency η g Gear efficiencyThis paper considers the problem of stabilizing Rotary Inverted Pendulum; thusθ and α are all relatively small in most of the control time. For small θ and α, cos⁡α≈1 and sin⁡α≈α. Placing the approximate expressions into (1) and solving (1), the state space model of Rotary Inverted Pendulum can be written as(3)x˙=Ax+Buy=Cx+Du,where x=θαθ˙α˙T and u is input voltage V, while(4)
A
=
0
0
1
0
0
0
0
1
0
b
d
E
-
c
G
E
0
0
a
d
E
-
b
G
E
0
,
B
=
0
0
c
η
m
η
g
K
t
K
g
R
m
E
b
η
m
η
g
K
t
K
g
R
m
E
C
=
diag
⁡
1,1
,
1,1
,
D
=
0
0
0
0
T with(5)a=Jeq+mr2,b=mlr,c=43ml2,d=mglE=ac-b2,G=ηmηgKtKmKg2+BRmRm.Obviously, vertically upward position (α=0) and vertically downward position (α=π) of pendulum are all equilibrium position for an arbitrary fixed θ; that is, system (3) has more than one equilibrium state. In order to solve this problem, the states feedback technique, whose block diagram is shown in Figure 2, is used to make system (3) only have one equilibrium state (α=0,θ=0). If the feedback control is noted as r, then (3) becomes(6)x˙=A-BKx+Br=A~x+Bry=C-DKx+Dr=C~x+Dr,where K is the gain vector of state feedback and r=u+Kx=V+Kx.Figure 2
Block diagram of states feedback.In the rest of this paper, we focus on the system model (6) instead of (3). The aim of this paper is to design feedback control r by Lyapunov control method so that Rotary Inverted Pendulum can be stabilized at the equilibrium position α=0 and  θ=0 from arbitrary position. The control law u or input voltage V can be calculated from r easily based on r=u+Kx and u=V.


## 3. Design of Control Laws

For linear control systems, lots of methods can be used to design control laws. In this paper, the control laws of stabilizing Rotary Inverted Pendulum are designed by Lyapunov control method, whose motivations are as follows: (i) the procedure of designing control laws is simple; (ii) the analytic expression of control laws can be obtained; (iii) the control laws designed by Lyapunov method can guarantee the system stability. Based on Lyapunov stability theorem, the control laws can be designed as follows:(1)
Construct a functionVx,t which satisfies the conditions of Lyapunov function; that is, Vx,t is once continuously differentiable for x, Vx,t≥0 and “=” holds if and only if x=xe which xe is the equilibrium state.(2)
Calculate the first time derivative ofVx,t, that is, V˙x,t.(3)
Design control laws to makeV˙x,t≤0 and “=” holds if and only if x=xe.


### 3.1. Construction of Logarithmic Lyapunov Function

In classical literatures [31–33], the quadratic function Vq is usually selected as Lyapunov function; that is,(7)Vqx,t=xTPx,where P is a nonnegative matrix.In order to obtain higher numerical accuracy and faster convergence speed, a logarithmic functionVl from quadratic function Vq and Taylor series is constructed as Lyapunov function; that is,(8)Vlx,t=ln⁡1+xTPx.To illustrate Vl is better than Vq, the relationships of numerical value and convergence speed between Vl and Vq are shown as follows:(i)
Numerical value: the Taylor series of Vlx,t is (9)Vlx,t=ln⁡1+xTPx=∑n=1∞-1n+1nxTPxn=xTPx-12xTPx2+13xTPx3-⋯from which one can see thatVqx,t is the first item of the Taylor series of Vlx,t, while Vlx,t contains the quadratic term, cubic term, and higher order terms of xTPx relative to Vqx,t. Thus, Vlx,t has a higher numerical accuracy than Vqx,t.(ii)
Convergence speed: let X=xTPx≥0; then (10)VqVl=Xln⁡1+X,V˙qV˙l=1+X.Construct a functionf1X as(11)f1X=VqV˙q-VlV˙l=X1+XV˙l-ln⁡1+XV˙l=1V˙lf~1X,wheref~1X=X/(1+X)-ln⁡1+X.Iff2Γ=f~1X=Γ-1/Γ-ln⁡Γ with Γ=1+X≥1, then (12)f˙2Γ=-Γ-1Γ2<0which meansf2Γ is a monotone decreasing function, and (13)max⁡f2Γ=f21=0=max⁡f~10;thereby,(14)f~1X≤max⁡f~1X=f~10=0.Vl is the constructed logarithmic Lyapunov function, so V˙lx,t≤0 for x≠0 through designing control laws. Taking into account (11), one can get that (15)f1X>0forX≠0which meansVq/V˙q>Vl/V˙l for x≠0; namely Vl has faster convergence speed than Vq.According to the above analysis,Vl has higher numerical accuracy and faster convergence speed than Vq, so the control laws of stabilizing Rotary Inverted Pendulum are designed based on Vl by Lyapunov control method in this paper.Moreover, the constructedVl can be used in nonlinear system due to the applicability of Lyapunov control method and can be as performance function in optimal control to obtain better control effect due to the higher numerical accuracy and faster convergence speed. Therefore Vl has a greater range of applications, not limited to Rotary Inverted Pendulum and linear systems.


### 3.2. Design of Control Laws via Lyapunov Method

In order to design the control laws under the condition ofV˙lx,t≤0 at any time, we need to calculate the first-order time derivative of Vlx,t(16)V˙lx,t=11+xTPxx˙TPx+xTPx˙=11+xTPxxTA~TP+PA~x+BTPx+xTPBr=11+xTPxxTA~TP+PA~x+2xTPBr=ξM+ξNr,where M=xTA~TP+PA~x and N=2xTPB, ξ=1/(1+xTPx).To ensureV˙lx,t≤0, the feedback control is designed as(17)r=rl=-MN-k·ξ·N,k>0.Placing (17) into (16), it is easily got that (18)V˙lx,t=-kξN2<0forx≠0.Similarly, the first-order time derivative ofVqx,t is(19)V˙qx,t=x˙TPx+xTPx˙=M+Nuand the control law is designed as(20)r=rq=-MN-kN,k>0so that V˙qx,t=-kN2<0 for x≠0.Comparing (17) and (20), the first items of rl and rq are the same while the second item of rl contains parameter ξ and rq does not contain ξ. In Section 4, whether the control law rl can stabilize Rotary Inverted Pendulum will be verified by experiments, based on which the control performances of rl, rq, and a LQR controller will be compared.


### 3.3. Robustness Analyses

The actual system is usually affected by the perturbations from environment or other sources, so that the system parameters contain uncertainties. It is reasonable to request that the designed control laws can resist the variation of parameters and the effect of perturbations to the greatest extent, so the controlled systems need stronger robustness under the control laws. In this subsection, we will investigate the system robustness under the designed control lawrl. We focus on the effects of A and B caused by the perturbations.If the perturbations makeA become A+ΔA, that is, A~+ΔA~, which lead to that M becomes M+ΔM, according to (17), the designed control law rl becomes(21)r~l=M+ΔMN+kN=MN+kN+ΔMN=rl+ΔMNwhich means the difference between the real control law r~l and the theoretic control law rl is ΔM/N when the perturbations affect A.If the perturbations makeB become B+ΔB, which lead to that N becomes N+ΔN, according to (17), the designed control law rl becomes(22)r^l=MN+ΔN+kN+ΔN=NN+ΔN·MN+kN+kΔN=MN+kN+kΔN1-MkNN+ΔNwhich means the difference between the real control law r^l and the theoretic control law rl is kΔN1-M/kNN+ΔN when the perturbations affect B.From (21) and (22), the two items of rl are all affected when the perturbations affect B, while only one item of rl is affected when the perturbations affect A, which means the system robustness is better in the most cases when A contains uncertainties. However, it should be noted that the real control law is the same as the theoretic control law when M=kNN+ΔN, and the system robustness is best in this case.


## 3.1. Construction of Logarithmic Lyapunov Function

In classical literatures [31–33], the quadratic function Vq is usually selected as Lyapunov function; that is,(7)Vqx,t=xTPx,where P is a nonnegative matrix.In order to obtain higher numerical accuracy and faster convergence speed, a logarithmic functionVl from quadratic function Vq and Taylor series is constructed as Lyapunov function; that is,(8)Vlx,t=ln⁡1+xTPx.To illustrate Vl is better than Vq, the relationships of numerical value and convergence speed between Vl and Vq are shown as follows:(i)
Numerical value: the Taylor series of Vlx,t is (9)Vlx,t=ln⁡1+xTPx=∑n=1∞-1n+1nxTPxn=xTPx-12xTPx2+13xTPx3-⋯from which one can see thatVqx,t is the first item of the Taylor series of Vlx,t, while Vlx,t contains the quadratic term, cubic term, and higher order terms of xTPx relative to Vqx,t. Thus, Vlx,t has a higher numerical accuracy than Vqx,t.(ii)
Convergence speed: let X=xTPx≥0; then (10)VqVl=Xln⁡1+X,V˙qV˙l=1+X.Construct a functionf1X as(11)f1X=VqV˙q-VlV˙l=X1+XV˙l-ln⁡1+XV˙l=1V˙lf~1X,wheref~1X=X/(1+X)-ln⁡1+X.Iff2Γ=f~1X=Γ-1/Γ-ln⁡Γ with Γ=1+X≥1, then (12)f˙2Γ=-Γ-1Γ2<0which meansf2Γ is a monotone decreasing function, and (13)max⁡f2Γ=f21=0=max⁡f~10;thereby,(14)f~1X≤max⁡f~1X=f~10=0.Vl is the constructed logarithmic Lyapunov function, so V˙lx,t≤0 for x≠0 through designing control laws. Taking into account (11), one can get that (15)f1X>0forX≠0which meansVq/V˙q>Vl/V˙l for x≠0; namely Vl has faster convergence speed than Vq.According to the above analysis,Vl has higher numerical accuracy and faster convergence speed than Vq, so the control laws of stabilizing Rotary Inverted Pendulum are designed based on Vl by Lyapunov control method in this paper.Moreover, the constructedVl can be used in nonlinear system due to the applicability of Lyapunov control method and can be as performance function in optimal control to obtain better control effect due to the higher numerical accuracy and faster convergence speed. Therefore Vl has a greater range of applications, not limited to Rotary Inverted Pendulum and linear systems.


## 3.2. Design of Control Laws via Lyapunov Method

In order to design the control laws under the condition ofV˙lx,t≤0 at any time, we need to calculate the first-order time derivative of Vlx,t(16)V˙lx,t=11+xTPxx˙TPx+xTPx˙=11+xTPxxTA~TP+PA~x+BTPx+xTPBr=11+xTPxxTA~TP+PA~x+2xTPBr=ξM+ξNr,where M=xTA~TP+PA~x and N=2xTPB, ξ=1/(1+xTPx).To ensureV˙lx,t≤0, the feedback control is designed as(17)r=rl=-MN-k·ξ·N,k>0.Placing (17) into (16), it is easily got that (18)V˙lx,t=-kξN2<0forx≠0.Similarly, the first-order time derivative ofVqx,t is(19)V˙qx,t=x˙TPx+xTPx˙=M+Nuand the control law is designed as(20)r=rq=-MN-kN,k>0so that V˙qx,t=-kN2<0 for x≠0.Comparing (17) and (20), the first items of rl and rq are the same while the second item of rl contains parameter ξ and rq does not contain ξ. In Section 4, whether the control law rl can stabilize Rotary Inverted Pendulum will be verified by experiments, based on which the control performances of rl, rq, and a LQR controller will be compared.


## 3.3. Robustness Analyses

The actual system is usually affected by the perturbations from environment or other sources, so that the system parameters contain uncertainties. It is reasonable to request that the designed control laws can resist the variation of parameters and the effect of perturbations to the greatest extent, so the controlled systems need stronger robustness under the control laws. In this subsection, we will investigate the system robustness under the designed control lawrl. We focus on the effects of A and B caused by the perturbations.If the perturbations makeA become A+ΔA, that is, A~+ΔA~, which lead to that M becomes M+ΔM, according to (17), the designed control law rl becomes(21)r~l=M+ΔMN+kN=MN+kN+ΔMN=rl+ΔMNwhich means the difference between the real control law r~l and the theoretic control law rl is ΔM/N when the perturbations affect A.If the perturbations makeB become B+ΔB, which lead to that N becomes N+ΔN, according to (17), the designed control law rl becomes(22)r^l=MN+ΔN+kN+ΔN=NN+ΔN·MN+kN+kΔN=MN+kN+kΔN1-MkNN+ΔNwhich means the difference between the real control law r^l and the theoretic control law rl is kΔN1-M/kNN+ΔN when the perturbations affect B.From (21) and (22), the two items of rl are all affected when the perturbations affect B, while only one item of rl is affected when the perturbations affect A, which means the system robustness is better in the most cases when A contains uncertainties. However, it should be noted that the real control law is the same as the theoretic control law when M=kNN+ΔN, and the system robustness is best in this case.


## 4. Experiments

In this section, the values of parameters will be given and the characteristics of Rotary Inverted Pendulum will be analyzed. Then, three experiments are used to investigate the control lawrl:(i)
The initial position of Rotary Inverted Pendulum is set tox0=1π10T, which verifies that rl can make the pendulum from vertically downward position to vertically upward position.(ii)
The initial position of Rotary Inverted Pendulum is set tox0=1110T,  rl, rq, and LQR controller ulqr are used to stabilize Rotary Inverted Pendulum, respectively, and then the control performances of rl, rq, and ulqr are compared.(iii)
In order to investigate the system robustness under the designed control law, let the system parameters contain uncertainties; that is, the elementsaij in A or bk in B become a~ij=(1+ε)aij and b~k=(1+ε)bk where ε represents the uncertainties. Then, the control performances with uncertainties are compared with the case without uncertainties.


### 4.1. System Parameter Settings

The values of the parameters in Table1 are given in Table 2, which is the same as in [24]. Substituting the values into A and B in (3), then the eigenvalues of A are 0,-17.8671,7.5266,-4.9783, which means A is singular and system (3) is unstable with more than one equilibrium state due to zero eigenvalue and positive eigenvalues. The rank of the controllability matrix Uc=BABA2BA3B is 4, that is, full rank, which means the system is controllable. By applying state feedback technique, system (3) becomes system (6), which is controllable and stable and has only one equilibrium state.Table 2
Values of physical parameters.
J e q 0.0033 l 0.1675 K t 0.0077 R m 2.6 m 0.125 g 9.81 K g 70 η m 0.69 r 0.215 B q 0.0040 K m 0.0077 η g 0.90The key of state feedback is to calculate the gain vectorK. In this section, the desired closed-loop poles are set to -1,-2,-3+3i,-3-3i; then the closed-loop characteristic equation is (23)fs=s+1s+2s+3-3is+3+3i=s4+9s3+38s2+66s+36 so (24)fA=A4+9A3+38A2+66A+36I. Then, the gain vector K can be calculated as [34](25)K=0001Uc-1fA=-0.03074.7360-0.62640.4086.


### 4.2. Stability Control for Vertically Downward Initial Position

The initial state of Rotary Inverted Pendulum is set tox0=1π10T, and the final state is xf=0000T; that is, the initial position of pendulum is vertically downward and the final position is vertically upward position. The control law rl in (17) is used to make the pendulum from vertically downward position to vertically upward position and holds steady in vertically upward position. The parameters of rl are(26)k=0.1,P=1.6090-8.58780.7694-1.4376-8.5878147.8866-11.318625.14130.7694-11.31860.9806-1.9023-1.437625.1413-1.90234.4263,where P is calculated by solving the Lyapunov equation ATP+PA=-I. The experiment results are shown in Figure 3, in which Figures 3(a)–3(d) are the curves of control law u, feedback control r, function Vq=xTPx, and system state x, respectively.Figure 3
Results of stability control for vertically downward initial state.
(a)
Control lawu=rl-Kx (b)
Feedback controlrl (c)
V q = x T P x (d)
System statexThe results in Figures3(a) and 3(b) show that u and r all tend to zero, while the Lyapunov function Vq in Figure 3(c) is less than 10-3 which is close to zero. One can see from Figure 3(d) that the system state converges to zero under the designed control, that is, achieving the control task. Integrating all results, the position of pendulum is from vertically downward position to vertically upward position under the control law, which realizes not only stability control but also swing-up control.


### 4.3. Comparison ofrl, rq, and ulqr in Stability Control

The initial state of Rotary Inverted Pendulum is set tox0=1110T, while the final state is vertically upward position; that is, xf=0000T. In this subsection, the parameters k in control laws rl and rq are 0.1 and 0.0009, respectively, and the parameters P in rl and rq are all identical with P in (26). The LQR controller ulqr is designed based on the cost functional [24, 35](27)J=∫0∞xf-xtTQxf-xt+utTRutdt=∫0∞xtTQxt+utTRutdt,where xf=0000T.The control lawsrl, rq, and ulqr are all used to stabilize Rotary Inverted Pendulum, and the results are shown in Figure 4, in which Figure 4(a) is the curves of system states under rl; Figure 4(b) is the curves of system states under rq and ulqr; Figures 4(c) and 4(d) are the curves of control laws u and energies ∫0tf‍u2dt, respectively, while the curves of Vq=xTPx under the three control laws are given in Figure 4(e).Figure 4
Results of comparative experiments.
(a)
System statex under rl (b)
System statex under rq and ulqr (c)
Control laws (d)
Energies of control laws (e)
V q = x T P xFrom Figures4(a) and 4(b), one can see that rl, rq, and ulqr can all stabilize Rotary Inverted Pendulum, but the convergence time of system states under rl is less than that under rq and ulqr. The comparison result of rl and rq is consistent with the theoretical analysis in Section 3.1. The results in Figures 4(c) and 4(d) show that the control amplitude and energy consumption of ulqr are the maximum in the three control laws. The control amplitudes of rl and rq are close while the energy consumption of rl is even less, which mean rl can stabilize Rotary Inverted Pendulum faster with less energy. It should be noted that if Q and R in (27) are set as other values, the energy consumption of ulqr may be less than that of rl, but the control amplitude of ulqr is more than that of rl. Considering the control amplitude and energy consumption comprehensively, rl is the more recommended control law to stabilize Rotary Inverted Pendulum. In other words, the control law rl has the same and even better control effect than LQR controller. According to the results in [24], the control performance of LQR controller is similar to PID controller and better than H infinity controller in the stability control of Rotary Inverted Pendulum. The designed control law rl has the same comparative result as LQR controller based on the above analyses. In addition, Rojas-Moreno et al. used a FO (Fractional Order) based-LQR controller to stabilize Rotary Inverted Pendulum in [35], from which the FO LQR-based controller has the similar control time and control accuracy to LQR controller but more ability to reject disturbances, which is the advantage of the FO LQR-based controller. Instead of better robustness, the designed control law rl in this paper can ensure the system stability, which is the property of Lyapunov control method.In Figure4(e), the function Vq under rl converges faster and has higher accuracy than that under rq, which are also consistent with the results in Figures 4(a) and 4(b) and the analysis in Section 3.1. When the time is less than 5, the convergence speed of Vq under ulqr is faster than that under rl, while the convergence speed of Vq under rl is faster when the time is more than 5. The accuracy comparison results have the same conclusion. Comparing Figure 4(c) with Figure 3(a), the control amplitude in Figure 3(a) is more than that in Figure 4(c) and the control time in Figure 3(a) is more than that in Figure 4(c), which means swing-up control requests more control amplitude. Simultaneously, comparing Figure 4(a) with Figure 3(d), the curves of system state in Figure 4(a) converge to zero before time 10 while that in Figure 3(d) converges to zero after time 25, which mean the control process containing swing-up control takes more time. In particular, the curve of parameter ξ which is the difference between rl and rq is shown in Figure 5, from which one can see that ξ is time-dependent and from 0 to 1 in control process. If ξ=1, rl=rq, which means control law rl has more flexibility than control law rq.Figure 5
Curve ofξ in control law rl.


### 4.4. Robustness Experiments

Ifε represents the uncertainties, let a~ij=(1+ε)aij and b~k=(1+ε)bk with i,k=3,4 and j=2,3, where aij and bk represent the elements A(i,j) and B(k) in matrices A and B without uncertainties, respectively, while a~ij and b~k represent the corresponding elements in A and B with uncertainties, respectively. Under the setting, the control law rl is applied to Rotary Inverted Pendulum, and the curves of Vq in different cases are shown in Figure 6, in which Figures 6(a)–6(e) show the curves of Vq in the cases of a~32=(1+ε)a32, a~33=(1+ε)a33, a~43=(1+ε)a43, b~3=(1+ε)b3, and b~4=(1+ε)b4 with ε∈{0,±0.02,±0.04,±0.06,±0.08,±0.1}, respectively. The curves of Vq=xTPx in the case of a~42=(1+ε)a42 are similar to that in the case of a~32=(1+ε)a32 and do not show in Figure 6.Figure 6
Curves ofVq in different cases.
(a)
a ~ 32  =  1  +  ε a 32 (b)
a ~ 33  =  1  +  ε a 33 (c)
a ~ 43  =  1  +  ε a 43 (d)
b ~ 3  =  1  +  ε b 3 (e)
b ~ 4  =  1  +  ε b 4From Figure6, the analyses are drawn as follows:(1)
Control performances are better in the cases ofa32, a33, a42, and a43 with uncertainties than those b3 and b4 with uncertainties, which is consistent with the robustness analyses in Section 3.3.(2)
For the case ofa33, when ε>0, the control performances are worse than that when ε=0, while the convergence speed is faster at first and slower than that when ε=0; when ε<0, the control performances are better than that when ε=0, while Vq is not monotone convergence.(3)
For the case ofa43, the control performances of rl and the convergence performances of Vq when ε>0 and ε<0 are the opposite of that in the case of a33.(4)
For the case ofb3, when ε>0, the control performances are better than that when ε=0, while the convergence speed is lower at first and then faster than that when ε=0; when ε<0, the control performances of rl are worse than that when ε=0, while Vq is not monotone convergence.(5)
For the case ofb4, the control performances of ul and the convergence performances of Vq when ε>0 and ε<0 are the opposite of that in the case of b3Therefore, when the different system parameters contain uncertainties, the system robustness is also different under the control laws designed by Lyapunov control method. The better system robustness is in the following two cases:(1)
The actualθ¨ is more than the theoretical θ¨; that is, the cases of a33 and b3 contain uncertainties with ε>0.(2)
The actualα¨ is less than the theoretical α¨; that is, the cases of a43 and b4 contain uncertainties with ε<0.These are consistent with intuition and experience. If the analytical results can be considered in designing control laws, the designed control laws are expected to have better control performance.


## 4.1. System Parameter Settings

The values of the parameters in Table1 are given in Table 2, which is the same as in [24]. Substituting the values into A and B in (3), then the eigenvalues of A are 0,-17.8671,7.5266,-4.9783, which means A is singular and system (3) is unstable with more than one equilibrium state due to zero eigenvalue and positive eigenvalues. The rank of the controllability matrix Uc=BABA2BA3B is 4, that is, full rank, which means the system is controllable. By applying state feedback technique, system (3) becomes system (6), which is controllable and stable and has only one equilibrium state.Table 2
Values of physical parameters.
J e q 0.0033 l 0.1675 K t 0.0077 R m 2.6 m 0.125 g 9.81 K g 70 η m 0.69 r 0.215 B q 0.0040 K m 0.0077 η g 0.90The key of state feedback is to calculate the gain vectorK. In this section, the desired closed-loop poles are set to -1,-2,-3+3i,-3-3i; then the closed-loop characteristic equation is (23)fs=s+1s+2s+3-3is+3+3i=s4+9s3+38s2+66s+36 so (24)fA=A4+9A3+38A2+66A+36I. Then, the gain vector K can be calculated as [34](25)K=0001Uc-1fA=-0.03074.7360-0.62640.4086.


## 4.2. Stability Control for Vertically Downward Initial Position

The initial state of Rotary Inverted Pendulum is set tox0=1π10T, and the final state is xf=0000T; that is, the initial position of pendulum is vertically downward and the final position is vertically upward position. The control law rl in (17) is used to make the pendulum from vertically downward position to vertically upward position and holds steady in vertically upward position. The parameters of rl are(26)k=0.1,P=1.6090-8.58780.7694-1.4376-8.5878147.8866-11.318625.14130.7694-11.31860.9806-1.9023-1.437625.1413-1.90234.4263,where P is calculated by solving the Lyapunov equation ATP+PA=-I. The experiment results are shown in Figure 3, in which Figures 3(a)–3(d) are the curves of control law u, feedback control r, function Vq=xTPx, and system state x, respectively.Figure 3
Results of stability control for vertically downward initial state.
(a)
Control lawu=rl-Kx (b)
Feedback controlrl (c)
V q = x T P x (d)
System statexThe results in Figures3(a) and 3(b) show that u and r all tend to zero, while the Lyapunov function Vq in Figure 3(c) is less than 10-3 which is close to zero. One can see from Figure 3(d) that the system state converges to zero under the designed control, that is, achieving the control task. Integrating all results, the position of pendulum is from vertically downward position to vertically upward position under the control law, which realizes not only stability control but also swing-up control.


## 4.3. Comparison ofrl, rq, and ulqr in Stability Control

The initial state of Rotary Inverted Pendulum is set tox0=1110T, while the final state is vertically upward position; that is, xf=0000T. In this subsection, the parameters k in control laws rl and rq are 0.1 and 0.0009, respectively, and the parameters P in rl and rq are all identical with P in (26). The LQR controller ulqr is designed based on the cost functional [24, 35](27)J=∫0∞xf-xtTQxf-xt+utTRutdt=∫0∞xtTQxt+utTRutdt,where xf=0000T.The control lawsrl, rq, and ulqr are all used to stabilize Rotary Inverted Pendulum, and the results are shown in Figure 4, in which Figure 4(a) is the curves of system states under rl; Figure 4(b) is the curves of system states under rq and ulqr; Figures 4(c) and 4(d) are the curves of control laws u and energies ∫0tf‍u2dt, respectively, while the curves of Vq=xTPx under the three control laws are given in Figure 4(e).Figure 4
Results of comparative experiments.
(a)
System statex under rl (b)
System statex under rq and ulqr (c)
Control laws (d)
Energies of control laws (e)
V q = x T P xFrom Figures4(a) and 4(b), one can see that rl, rq, and ulqr can all stabilize Rotary Inverted Pendulum, but the convergence time of system states under rl is less than that under rq and ulqr. The comparison result of rl and rq is consistent with the theoretical analysis in Section 3.1. The results in Figures 4(c) and 4(d) show that the control amplitude and energy consumption of ulqr are the maximum in the three control laws. The control amplitudes of rl and rq are close while the energy consumption of rl is even less, which mean rl can stabilize Rotary Inverted Pendulum faster with less energy. It should be noted that if Q and R in (27) are set as other values, the energy consumption of ulqr may be less than that of rl, but the control amplitude of ulqr is more than that of rl. Considering the control amplitude and energy consumption comprehensively, rl is the more recommended control law to stabilize Rotary Inverted Pendulum. In other words, the control law rl has the same and even better control effect than LQR controller. According to the results in [24], the control performance of LQR controller is similar to PID controller and better than H infinity controller in the stability control of Rotary Inverted Pendulum. The designed control law rl has the same comparative result as LQR controller based on the above analyses. In addition, Rojas-Moreno et al. used a FO (Fractional Order) based-LQR controller to stabilize Rotary Inverted Pendulum in [35], from which the FO LQR-based controller has the similar control time and control accuracy to LQR controller but more ability to reject disturbances, which is the advantage of the FO LQR-based controller. Instead of better robustness, the designed control law rl in this paper can ensure the system stability, which is the property of Lyapunov control method.In Figure4(e), the function Vq under rl converges faster and has higher accuracy than that under rq, which are also consistent with the results in Figures 4(a) and 4(b) and the analysis in Section 3.1. When the time is less than 5, the convergence speed of Vq under ulqr is faster than that under rl, while the convergence speed of Vq under rl is faster when the time is more than 5. The accuracy comparison results have the same conclusion. Comparing Figure 4(c) with Figure 3(a), the control amplitude in Figure 3(a) is more than that in Figure 4(c) and the control time in Figure 3(a) is more than that in Figure 4(c), which means swing-up control requests more control amplitude. Simultaneously, comparing Figure 4(a) with Figure 3(d), the curves of system state in Figure 4(a) converge to zero before time 10 while that in Figure 3(d) converges to zero after time 25, which mean the control process containing swing-up control takes more time. In particular, the curve of parameter ξ which is the difference between rl and rq is shown in Figure 5, from which one can see that ξ is time-dependent and from 0 to 1 in control process. If ξ=1, rl=rq, which means control law rl has more flexibility than control law rq.Figure 5
Curve ofξ in control law rl.


## 4.4. Robustness Experiments

Ifε represents the uncertainties, let a~ij=(1+ε)aij and b~k=(1+ε)bk with i,k=3,4 and j=2,3, where aij and bk represent the elements A(i,j) and B(k) in matrices A and B without uncertainties, respectively, while a~ij and b~k represent the corresponding elements in A and B with uncertainties, respectively. Under the setting, the control law rl is applied to Rotary Inverted Pendulum, and the curves of Vq in different cases are shown in Figure 6, in which Figures 6(a)–6(e) show the curves of Vq in the cases of a~32=(1+ε)a32, a~33=(1+ε)a33, a~43=(1+ε)a43, b~3=(1+ε)b3, and b~4=(1+ε)b4 with ε∈{0,±0.02,±0.04,±0.06,±0.08,±0.1}, respectively. The curves of Vq=xTPx in the case of a~42=(1+ε)a42 are similar to that in the case of a~32=(1+ε)a32 and do not show in Figure 6.Figure 6
Curves ofVq in different cases.
(a)
a ~ 32  =  1  +  ε a 32 (b)
a ~ 33  =  1  +  ε a 33 (c)
a ~ 43  =  1  +  ε a 43 (d)
b ~ 3  =  1  +  ε b 3 (e)
b ~ 4  =  1  +  ε b 4From Figure6, the analyses are drawn as follows:(1)
Control performances are better in the cases ofa32, a33, a42, and a43 with uncertainties than those b3 and b4 with uncertainties, which is consistent with the robustness analyses in Section 3.3.(2)
For the case ofa33, when ε>0, the control performances are worse than that when ε=0, while the convergence speed is faster at first and slower than that when ε=0; when ε<0, the control performances are better than that when ε=0, while Vq is not monotone convergence.(3)
For the case ofa43, the control performances of rl and the convergence performances of Vq when ε>0 and ε<0 are the opposite of that in the case of a33.(4)
For the case ofb3, when ε>0, the control performances are better than that when ε=0, while the convergence speed is lower at first and then faster than that when ε=0; when ε<0, the control performances of rl are worse than that when ε=0, while Vq is not monotone convergence.(5)
For the case ofb4, the control performances of ul and the convergence performances of Vq when ε>0 and ε<0 are the opposite of that in the case of b3Therefore, when the different system parameters contain uncertainties, the system robustness is also different under the control laws designed by Lyapunov control method. The better system robustness is in the following two cases:(1)
The actualθ¨ is more than the theoretical θ¨; that is, the cases of a33 and b3 contain uncertainties with ε>0.(2)
The actualα¨ is less than the theoretical α¨; that is, the cases of a43 and b4 contain uncertainties with ε<0.These are consistent with intuition and experience. If the analytical results can be considered in designing control laws, the designed control laws are expected to have better control performance.


## 5. Conclusions

The control law of stabilizing Rotary Inverted Pendulum is designed based on Lyapunov stability theorem. A logarithmic function is constructed as the Lyapunov function, based on which the control law is designed by Lyapunov control method. In particular, the relationships between the constructed logarithmic function and the usual quadratic function in numerical value and convergence speed are analyzed in theory. The results show that the logarithmic function has higher numerical accuracy and faster convergence speed than the quadratic function, which is also verified in experiments. Moreover, the control law designed can also achieve the swing-up control of Rotary Inverted Pendulum. On this basis, the system robustness when different system parameters contain uncertainties is investigated. The further works can be considered as follows: (1) Lyapunov control method is applicable to nonlinear system, so the nonlinear mathematical model of Rotary Inverted Pendulum, which is more accurate to describe system characteristics than linear model, can be considered as the controlled system, and the stabilizing control laws can be designed by Lyapunov method; (2) the constructed logarithmic function in this paper can be used in other control methods, such as the logarithmic function which was selected as the performance function in optimal control; (3) the research results for the general classes of the underactuated and nonholonomic systems, such as [27, 28], are applied to Rotary Inverted Pendulum systems.



---

*Source: 4091302-2017-02-27.xml*