# Trajectory Design and Tracking Control for Nonlinear Underactuated Wheeled Inverted Pendulum

Authors: Shuli Gong; Ancai Zhang; Jinhua She; Xinghui Zhang; Yuanyuan Liu
Journal: Mathematical Problems in Engineering
 (2018)

---

## Abstract

An underactuated wheeled inverted pendulum (UWIP) is a nonlinear mechanical system that has two degrees of freedom and has only one control input. The motion planning problem for this nonlinear system is difficult to solve because of the existence of an uncontrollable manifold in the configuration space. In this paper, we present a method of designing motion trajectory for this underactuated system. The design of trajectory is based on the dynamic properties of the UWIP system. Furthermore, the tracking control of the UWIP for the constructed trajectory is also studied. A tracking control law is designed by using quadratic optimal control theory. Numerical simulation results verify the effectiveness of the presented theoretical results.


---

## Body

## 1. Introduction

There are many complex dynamic systems in nature. The nonlinear system is an important type of natural system. Since this kind of system can more accurately reflect the essential characteristics of natural systems, they have been attracting more and more attention in the past few decades. Researchers have carried out intensively study on the dynamic analysis and control problem for the nonlinear systems [1–8].Recently, the control of the nonlinear underactuated mechanical system (UMS) is a hot issue in the engineering area. A UMS has fewer actuators than degrees of freedom (DOF) [9]. There are many examples of the UMS in our daily life. Those include a surface vessel [10], a VTOL aircraft [11], a bridge crane [12], an underwater vehicle [13], and a helicopter [14]. The reduction of actuators makes the UMS have light weight, low energy consumption, flexible movement, and other features. It has wide application prospects in many fields.However, the control problems presented by the UMS are not easy to solve because of the following two reasons. First, the UMS usually has complex nonlinear dynamics and does not be strict feedback linearized [15]. Second, the UMS has nonholonomic constraints due to the reduction of actuators [16]. This means that the state variables of UMS are located in an uncontrollable manifold in the configuration space. The control of the UMS is a challenging problem in the nonlinear control area.In order to conveniently study the control theory of the UMS, some experimental models of the UMS have been built in a lab environment (e.g., Acrobot [17], Furuta pendulum [18], Beam-ball [19], and TORA [20]). Based on these models, many nonlinear control methods have been developed, for example, an equivalent input disturbance (EID) method in [21], an energy-based and nonsmooth Lyapunov function method in [22], a reduced-order control method in [23], and a PID passivity-based method in [24].An underactuated wheeled inverted pendulum (UWIP) is a recent presented lab model of the UMS [25]. This mechanical system has a wheel and an inverted pendulum (see Figure 1). An actuator drives the wheel to move in a horizontal plane. And the inverted pendulum can freely rotate in a vertical plane. The UWIP is a 2-DOF complex nonlinear system that is not strict feedback linearizable. It has a second-order nonholonomic constraint and has an uncontrollable passive DOF. All these make the motion control of the UWIP system be difficult to solve. So far, there are no research results about the motion planning of the system. This inspires the study in this paper. We solve this difficult problem in this study. First, the dynamic properties of the UWIP system are analyzed. Based on these properties, a method of constructing a motion trajectory for this mechanical system is developed. The trajectory starts from the straight-down equilibrium point and ends at the straight-up equilibrium point. After that, a tracking control law is designed to quickly track the constructed trajectory. This enables the stabilizing control of the UWIP between two equilibrium points to be achieved along a reference trajectory. Compared to a local stabilizing control method for the UWIP in [25], our presented strategy uses a single control law to achieve the stabilizing control of the UWIP in its whole motion space. Moreover, we can predict the movement process and transient characteristics of the UWIP in advance. It is very useful to guarantee the operation of the control system to be safe. The validity of the theoretical results is demonstrated by numerical simulation experiment.Figure 1
Underactuated wheeled inverted pendulum (UWIP).


## 2. Model of Underactuated Wheeled Inverted Pendulum

The model of the UWIP is shown in Figure1, where m1, J1, L1, and θ1(t) are the mass, the moment of inertia, the radius, and the rotational angle of the wheel, respectively; m2, J2, L2, and θ2(t) are the mass, the moment of inertia, the distance from the endpoint to the center of mass, and the rotational angle of the pendulum, respectively; F(t) is the input torque applied on the wheel; g=9.80665m/s2 is the gravitational acceleration.It follows from the derivations in [25] that the kinetic and potential energy of the UWIP system is(1)Kθ,θ˙=12θ˙t⊤Dθ2θ˙t,Pθ=α4cos⁡θ2t,where θ(t)=[θ1(t),θ2(t)]⊤, θ˙(t)=dθ(t)/dt,(2)Dθ2=α1α2cos⁡θ2tα2cos⁡θ2tα3,α1=m1+m2L12+J1,α2=m2L1L2,α3=m2L22+J2,α4=m2L2g.The Euler-Lagrange motion equations of the system are(3)ddt∂Lθ,θ˙∂θ˙1-∂Lθ,θ˙∂θ1=Ft,ddt∂Lθ,θ˙∂θ˙2-∂Lθ,θ˙∂θ2=0,where L(θ,θ˙)=K(θ,θ˙)-P(θ) is the Lagrangian of the system. Equation (3) is equivalent to(4)Dθ2θ¨1tθ¨2t+-α2θ˙22tsin⁡θ2t-α4sin⁡θ2t=Ft0.The state variables of (4) are selected to be(5)x1t=θ1t,x2t=θ2t,x3t=θ˙1t,x4t=θ˙2t.This gives the state-space form of (4) as(6)x˙1t=x3t,x˙2t=x4t,x˙3tx˙4t=D-1x2α2x42tsin⁡x2t+Ftα4sin⁡x2t.


## 3. Dynamic Properties of the UWIP System

The UWIP system (6) has the following dynamic properties.Theorem 1.
If the control law for (6) is designed to be(7)Ft=-μx3t,μ>0,then the closed-loop control system has two equilibrium points(8)xU∗=x1∗,0,0,0⊤,xD∗=x1∗,π,0,0⊤,where μ and x1∗ are constants. Moreover, xD∗ is a stable equilibrium point while xU∗ is not.Proof.
Substituting (7) into (6) yields the closed-loop control system(9)x˙1tx˙2tx˙3tx˙4t=x3tx4tD-1x2α2x42tsin⁡x2t-μx3tα4sin⁡x2tThe equilibrium points of the system (9) satisfy(10)x3t=0,x4t=0,α2x42tsin⁡x2t-μx3tα4sin⁡x2t=00.It follows from (5) and (10) that x3(t)=x4(t)=0, x1(t)=x1∗, and sin⁡x2(t)=0. By considering the fact that x2(t)=θ2(t) is a cyclic variable with a period 2π, it is easy to get x2(t)=0 or π from sin⁡x2(t)=0. So, the equilibrium points of the closed-loop control system are xU∗ and xD∗.
In order to determine the stability of the equilibrium pointsxU∗ and xD∗, we approximately linearize the nonlinear system (9) around them. It gives the following two approximate linearization matrices: (11)AU∗=001000010-α2α4α1α3-α22-μα3α1α3-α2200α1α4α1α3-α22μα2α1α3-α220,AD∗=001000010-α2α4α1α3-α22-μα3α1α3-α2200-α1α4α1α3-α22-μα2α1α3-α220.
BothAU∗ and AD∗ have the same form(12)A∗=001000010A32A3300A42A430,where Aij(i=3,4,j=2,3) are constants. The characteristic polynomial of the matrix A∗ is (13)sI4-A∗=ss3-A33s2-A42s+A42A33-A32A43,where s is a variable symbol and I4 is a 4×4 identity matrix. By using Routh-Hurwitz stability criterion [26], it is not difficult to obtain the stability conditions for A∗ as(14)A33<0,A32A43>0,A42A33-A32A43>0.Since αi>0(i=1,2,3,4) and α1α3-α22>0, a simple verification gives that AD∗ satisfies (14) and AU∗ does not. So, the equilibrium point xD∗ is stable and xU∗ is unstable. The proof is completed.Theorem 2.
The closed-loop control system (6) and (7) asymptotically converges to the equilibrium point xD∗ if the initial condition x0∗ is different from xU∗.Proof.
For the closed-loop control system (6) and (7), a Lyapunov function is designed to be(15)Vx=12x3,x4α1α2cos⁡x2α2cos⁡x2α3x3x4+α41+cos⁡x2.Then, we get(16)dVxdt=x3,x4α1α2cos⁡x2α2cos⁡x2α3x˙3x˙4+12x3,x40-α2x4sin⁡x2-α2x4sin⁡x20x3x4-α4x4sin⁡x2=x3,x4α2x42sin⁡x2-μx3α4sin⁡x2-α2x3x4+α4x4sin⁡x2=-μx32t≤0.
LettingV˙(x)=0 gives x3(t)=0. Combining x3(t)=0 and the third equation of (4) yields(17)α3x42t-α4cos⁡x2tsin⁡x2t=0.In addition, V˙(x)=0 means that V(x)=C is a constant. It follows from x3(t)=0 and V(x)=C that(18)α3x42t+α4cos⁡x2t=C-α4.Note that (17) means(19)α3x42t-α4cos⁡x2t=0or(20)sin⁡x2t=0.Combining (18) and (19) yields that x2(t) is a constant. The second equation of (6) gives x4(t)=0. From (19), we get cos⁡x2(t)=0. Furthermore, it follows from x3(t)=x4(t)=0 and (6) that sin⁡x2(t)=0. It is in conflict with cos⁡x2(t)=0. So, (19) does not hold.
The above analysis results tell us thatx3(t)=x4(t)=0 and sin⁡x2(t)=0 from V˙(x)=0. By using LaSalle’s theorem [15], we know that the closed-loop control system (6) and (7) asymptotically converges to the largest invariant set in(21)Ω=xt∣x3t=x4t=0,sin⁡x2t=0=xD∗,xU∗.Since xU∗ is an unstable equilibrium point of the closed-loop system (6) and (7), the system asymptotically converges to xD∗ when x0∗≠xU∗. The proof is completed.Remark 3.
The pointxU∗ means that the pendulum of the UWIP is stabilized at the straight-up position while the wheel does not spin. Similarly, the meaning of xD∗ is that the pendulum is stabilized at the straight-down position while the wheel does not spin. The physical models of xU∗ and xD∗ are shown in Figure 2. Note that x3(t)=θ˙1(t) is the velocity variable of the wheel. So, the control law F(t) designed in (7) can be considered as a virtual friction torque for the UWIP system. Under the operation of this torque, the UWIP asymptotically converges to xD∗ from any initial position x0∗≠xU∗. This property will be used to design a trajectory for the UWIP in its whole motion space below.Figure 2
Physical models ofxU∗ and xD∗.


## 4. Design of Motion Trajectory

In this section, a motion trajectory of the UWIP between the equilibrium pointsxD∗ and xU∗ is designed. The design process of the trajectory has the following three steps.Step 1.
The initial condition of the closed-loop system (6) and (7) is selected to be(22)x0∗=x1∗,0,ω,0⊤,where ω>0 is a very small constant. The physical meaning for (22) is that the UWIP starts to move from the position xU∗ with a small velocity in the wheel. Since x0∗≠xU∗, it follows from the Theorem 2 that the UWIP asymptotically converges to the equilibrium point xD∗. This motion trajectory and its accompanied control input are denoted to be(23)xDt=xD1t,xD2t,xD3t,xD4t⊤,FDt=-μxD3t,t∈0,T,where T is the stabilization time that is defined to be(24)xDt-xD∗2≤0.05,t≥T.Equation (24) means that xD(t)=xD∗ approximately holds when t≥T.Step 2.
Based onxD(t) and FD(t), we construct(25)xUt=xU1t,xU2t,xU3t,xU4t⊤,xU1t=xD1T-t,xU2t=xD2T-t,xU3t=-xD3T-t,xU4t=-xD4T-t,FUt=FDT-t,t∈0,T.Note that xD1(t) and xD2(t) are the position variables, and xD3(t) and xD4(t) are the velocity variables of the UWIP system. Thus, xU(t) is a reverse trajectory of xD(t) during t∈[0,T]. And the initial and final positions of xU(t) are(26)xU0=xD1T,xD2T,-xD3T,-xD4T⊤≈xD∗,xUT=xD10,xD20,-xD30,-xD40⊤=x1∗,0,-ω,0⊤≜x~0∗.Let v=T-t. Since xD(t) and FD(t) satisfy (6), we get(27)dxU1tdt=dxU1tdvdvdt=-dxD1vdv=-xD3v=xU3t,dxU2tdt=dxU2tdvdvdt=-dxD2vdv=-xD4v=xU4t,dxU3tdtdxU4tdt=dxU3tdvdvdtdxU4tdvdvdt=dxD3vdvdxD4vdv=D-1xD2vα2xD42vsin⁡xD2v+FDvα4sin⁡xD2v=D-1xU2tα2xU42tsin⁡xU2t+FUtα4sin⁡xU2t.This means that xU(t) and FU(t) satisfy (6).Step 3.
Since the constantω is very small, x~0∗ is very close to the equilibrium point xU∗. It enables us to introduce a time period ΔT and to define(28)xRt=xR1t,xR2t,xR3t,xR4t⊤,xRt=xUt,t∈0,T,xU∗,t∈T,T+ΔT,FRt=FUt,t∈0,T,0,t∈T,T+ΔT.The diagram of the trajectory xR(t) is shown in Figure 3. Note that xR(t) is a motion trajectory of the UWIP between the equilibrium points xD∗ and xU∗. By comparing xU(T) to xU∗, we find that the element xR3(t) in xR(t) suffers from a very small step change at t=T. Furthermore, it is not difficult to verify that xR(t) and FR(t) also satisfy (6) because xU(t) and FU(t) satisfy (6).Figure 3
The diagram of the trajectoryxR(t).


## 5. Design of Tracking Control Law

The design of tracking control law for the trajectoryxR(t) is concerned in this section. Denote the error variables to be(29)et=e1t,e2t,e3t,e4t⊤,e1t=x1t-xR1t,e2t=x2t-xR2t,e3t=x3t-xR3t,e4t=x4t-xR4t,τt=Ft-FRt.From (6), we get the nonlinear error dynamic equations as(30)e˙1te˙2te˙3te˙4t=e3te4tf1ef2e+00g1eg2eτt,where(31)f1ef2e=Φ-1e2ϕ1e2+ϕ2e,g1eg2e=Φ-1e210,ϕ1e2=-α2x˙R4cos⁡e2+xR2-cos⁡xR2-α2x˙R3cos⁡e2+xR2-cos⁡xR2,ϕ2e=α2e4+xR42sin⁡e2+xR2-xR42sin⁡xR2α4sin⁡e2+xR2-sin⁡xR2,Φe2=α1α2cos⁡e2+xR2α2cos⁡e2+xR2α3.In order to make the UWIP track the trajectory xR(t), we need to design a stabilizing control law τ(t) for (30) such that e(t) converges to the origin quickly.Note that (30) is a complex nonlinear control system for e(t). An approximate linearization method is used to design the stabilizing control law here. Linearizing (30) around e(t)=0 gives the following linear approximation model:(32)e˙t=Atet+Btτt,where(33)At=001000010Ψ1tΨ2t00Ψ3tΨ4t0,Bt=00Ψ5tΨ6t,Ψ1t=α2α3φ1t-α2cos⁡xR2tφ2tα1α3-α22cos2⁡xR2t,Ψ2t=2α2α3xR4tsin⁡xR2tα1α3-α22cos2⁡xR2t,Ψ3t=-α22cos⁡xR2tφ1t+α1φ2tα1α3-α22cos2⁡xR2t,Ψ4t=-2α22xR4tsin⁡xR2tcos⁡xR2tα1α3-α22cos2⁡xR2t,Ψ5t=α3α1α3-α22cos2⁡xR2t,Ψ6t=-α2cos⁡xR2tα1α3-α22cos2⁡xR2t,φ1t=x˙R4tsin⁡xR2t+xR42tcos⁡xR2t,φ2t=α2x˙R3tsin⁡xR2t+α4cos⁡xR2t.Assume that (A(t),B(t)) is controllable. So, the time-variant Ricatti matrix equation(34)P˙t+A⊤tPt+PtAt-PtBtR-1B⊤tPt+Q=0has a positive definite solution P(t), where Q∈R4×4 is a positive definite matrix and R is a positive constant. Based on the quadratic optimal control theory, the control law(35)τt=-R-1B⊤tPtstabilizes the error dynamic equation (32) at the origin quickly. As a result, the control law F(t)=τ(t)+FR(t) enables the UWIP quickly to track the trajectory xR(t). This guarantees the control objective of swing the UWIP up from xD∗ and stabilizing it at xU∗ to be achieved.


## 6. Numerical Example

This section presents a numerical example to verify the validity of the above theoretical analysis results.The physical parameters of the UWIP in [25] were chosen for simulations(36)m1=1kg,m2=2kg,L1=0.1m,L2=0.2m,J1=0.01kg·m2,J2=0.0267kg·m2.And the parameters in (7) and (22) were selected to be(37)μ=0.25,x1∗=0,ω=0.001.The sampling period for simulations was chosen to be 0.001 s. From the design process in Step 1 of Section 4, we got the trajectory xD(t) (see Figure 4). The simulation result shows that the UWIP starts to move from the position x0∗ in (22) and is stabilized at the position xD∗ in (8). The stabilizing motion process of the UWIP is smooth. And the stabilization time is T=10 s. This demonstrates the effectiveness of the Theorem 2.Figure 4
Simulation result of the trajectoryxD(t).The time periodΔT in (28) was taken to be 1 s. From the design process in Steps 2 and 3 of Section 4, the trajectory xR(t) was obtained in Figure 5 based on xD(t), (25), and (28). The simulation results in Figure 5 show that xR(t) is a motion trajectory of the UWIP from xD∗ to xU∗. To design a control law of tracking this trajectory, the parameters in (34) were chosen to be Q=0.5I4 and R=5. And the MATLAB function LQR was used to solve (34). The tracking control results for the desired trajectory xR(t) are shown in Figure 6. Note that the UWIP quickly and exactly tracks the xR(t) by the operation of our designed tracking control law. As a result, the stabilizing control of the UWIP from xD∗ to xU∗ is achieved along the trajectory xR(t).Figure 5
Time response of the trajectoryxR(t).Figure 6
Tracking control of the UWIP for the trajectoryxR(t).In order to show the applicability of the presented strategy under realistic conditions, its robustness needs to be verified. To do that, we took the parameterJ1 to be 5% smaller and J2 to be 5% larger than their nominal values, added white noise disturbances to the measured variable (peak value: ±0.1), and set the saturation range of input to be [-3.5, 3]. Simulation results show that our developed method is still effective in that case (see Figure 7).Figure 7
Simulation results of trackingxR(t) when considering parameter uncertainties, external disturbances, and input saturation.


## 7. Conclusion

This paper addressed the trajectory design and tracking control problems for an underactuated wheeled inverted pendulum (UWIP). A new motion planning strategy was developed for this underactuated system. First, the dynamic properties of the UWIP system were analyzed. And then, the analysis properties were used to construct a trajectory of the UWIP between two equilibrium points. After that, a control law was designed to make the UWIP track the constructed trajectory. This ensured the motion control of the UWIP between two equilibrium points to be achieved. Finally, numerical simulation results demonstrated the validity of our theoretical results. In the future, we will further explore how to extend the main idea of our presented method to the control of other nonlinear systems.



---

*Source: 6134764-2018-09-24.xml*