# Open-Closed-Loop PD Iterative Learning Control with a Variable Forgetting Factor for a Two-Wheeled Self-Balancing Mobile Robot

Authors: Jian Dong; Bin He; Chenghong Zhang; Gang Li
Journal: Complexity
 (2019)

---

## Abstract

A novel iterative learning control (ILC) algorithm for a two-wheeled self-balancing mobile robot with time-varying, nonlinear, and strong-coupling dynamics properties is presented to resolve the trajectory tracking problem in this research. A kinematics model and dynamic model of a two-wheeled self-balancing mobile robot are deduced in this paper, and the combination of an open-closed-loop PD-ILC law and a variable forgetting factor is presented. The open-closed-loop PD-ILC algorithm adopts current and past learning items to drive the state variables and input variables, and the output variables converge to the bounded scope of their desired values. In addition, introducing a variable forgetting factor can enhance the robustness and stability of ILC. Numerous simulation and experimental data demonstrate that the proposed control scheme has better feasibility and effectiveness than the traditional control algorithm.


---

## Body

## 1. Introduction

Two-wheeled self-balancing mobile robots [1–3] are naturally unstable systems with characteristics such as nonlinear, multivariable, time-varying, and incomplete under-actuativity, and these characteristics can be used to study variable control algorithms. As the abovementioned robots have advantages in terms of different aspects of strong environmental adaption, low cost, and stable operation, these robots have many applications in many areas. Kazuo Yamafuji first introduced the concept of a two-wheeled self-balancing robot in the nineteen eighties. Since then, scholars have investigated numerous kinematic models and control algorithms for two-wheeled self-balancing mobile robots. Grasser [4] developed the DSP-based wheeled balancing robot “Joe”, which achieved good mobility through decoupling motion and simplified control but poor interference resistance. Miasa [5] designed the self-balancing robot “Equibot”, but it was only good for moving on flat ground and could fall over on uneven ground and thus has high requirements for road conditions. Additionally, the adaptability of the controlled object is undesirable. Thao [6] used the PID inverse step method to control a robot; a reverse step controller maintained the balance of the system, and a PID controller controlled the motion direction. However, the algorithm is too complex to implement in practical applications. Wu [7] applied a state feedback controller and a fuzzy controller to a robot. Experiments showed that the combination of these two control algorithms could achieve a good control effect. Because of its small capacity, feasible rotation and strong ability to adapt to terrain changes, this combined algorithm is widely used in many fields[8–10], such as traffic, survey, rescue and entertainment. However, this method is cost prohibitive and time consuming because of its fuzzy rules.Determining how to maintain balance and realize perfect tracking under the correlated interference condition is absolutely critical to research about two-wheeled self-balancing mobile robots. However, conventional modern control methods, including sliding mode control and intelligent control, need accurate knowledge of the robot dynamics and physical parameters of the system to ensure consistency and convergence. Thus, we introduced a novel iterative learning control (ILC) algorithm. The basic idea behind ILC [11–13] is that the controller should learn from previous executions and perform better every cycle. The idea of ILC is that a skill can be improved and subsequently perfected through constant practice. An ILC algorithm has already been designed for mobile robots in [14–16], Kyung [14] used ILC path-tracking algorithm to control mobile robot under state disturbances and state errors, but its trajectory tracking accuracy is not very ideal. Chong [17] adopted ILC with predictive, current, and past learning items to achieve high precision trajectory tracking. However, the tracking performance of this algorithm is poor in the real experimental environment with interference. There are quite a few other learning control methods. Zhou [18] design a robust observer-based learning control method with a prescribed H∞ disturbance rejection for modified repetitive-control system to compensate the system delay. Zhou [19] presents an estimation and compensation learning control of state-dependent nonlinearity for EID-based modified repetitive-control system to improve the tracking performance.This algorithm is extended to include the open-closed-loop PD-ILC scheme [20–22] for two-wheeled self-balancing mobile robot systems to improve the performance of the algorithm. Open-closed-loop PD-ILC not only ensures system stability but also improves tracking performance and vibration control. To reduce buffeting caused by robot system uncertainty and disturbances, this control law has been improved by the introduction of a variable forgetting factor, which can dynamically and precisely compensate for system errors. This combination not only stabilizes the robot's balance but also maintains the motion of the robot to track the desired trajectory.The remainder of this paper is organized as follows. In Section2, a mathematical model of a two-wheeled self-balancing mobile robot is derived from Newton's laws and Lagrangian mechanics. Section 3 describes the design of the proposed ILC controller schemes. A robust convergence analysis is performed in Section 4. In Section 5, simulations are presented and discussed. Section 6 illustrates the experimental results for the control system. The paper is concluded in Section 7.


## 2. Two-Wheeled Self-Balancing Mobile Robot System Model

### 2.1. System Description of the Two-Wheeled Self-Balancing Mobile Robot System

As shown in Figure1, the mechanical part of the two-wheeled self-balancing mobile robot [23–25] basically consists of two wheels and a body. The parameters of the two wheels of the robot are the same in terms of mass, diameter and rotational inertia; additionally, these wheels are coaxially installed and independently driven. The body moves in an upright fashion and maintains balance through two rounds of rotation. The fundamental equation and derivation of the robotic mathematical model use Newton’s laws of motion and Lagrangian mechanics. Based on the model, an open-closed-loop controller, in combination with ILC, is deployed for equilibrium stability and drive control.Figure 1
Model of a two-wheeled self-balancing mobile robot system in motion.When the two wheels move at different speeds, the robot body can change its direction and rotate around its center by setting different rotation directions for the two wheels. The steering principle is exactly the same as the tank steering principle shown in Figure2.Figure 2
Steering diagram of the robot.


### 2.2. Dynamic Modeling of the Two-Wheeled Self-Balancing Mobile Robot System

According to Newton's second law of motion and the momentum balance, the following differential equation is obtained after force analysis of the robot body and two-wheeled bottom in the horizontal direction:(1)M+mx¨+bx˙+mlθ¨cos⁡θ-mlθ˙2sin⁡θ=uThe following differential equation is obtained by analyzing the force and momentum balance of the robot body in the vertical direction:(2)I+ml2θ¨+mglsin⁡θ=-mlx¨cos⁡θFormulas (1) and (2) are the mathematical model in the form of the system's nonlinear differential equations. Since keeping the robot in balance is the primary purpose of control under appropriate external conditions, the exact model is treated as follows: (3)cos⁡θ≈1,sin⁡θ≈-θ,dθdt2≈0The linearization of the equation of motion is as follows:(4)M+mx¨+bx˙-mlθ¨=u(5)I+ml2θ¨-mglθ=mlx¨After taking the Laplace transform [26, 27], the transfer function is as follows:(6)XsUs=I+ml2/qs2-mgl/qs4+bI+ml2/qs3-M+mmgl/qs2-bmgl/qs(7)θsUs=ml/qs2s4+bI+ml2/qs3-M+mmgl/qs2-bmgl/qswhere q=M+mI+ml2-m2l2.According to formulas (4) and (5), the equation of state in which the displacement x, velocity x˙, pitch angle θ, and angular velocity θ˙ of the robot are state variables is(8)x˙x¨θ˙θ¨=01000-I+ml2bIM+m+Mml2mgl2IM+m+Mml2000010-mlbIM+m+Mml2mglM+mIM+m+Mml20xx˙θθ˙+0I+ml2IM+m+Mml20mlIM+m+Mml2uThe output equation with the displacementx and pitch angle θ of the robot as the output variables is(9)y=xθ=10000010xx˙θθ˙+00uwhere x is the displacement of the robot, x˙ is the velocity of the robot, x¨ is the acceleration of the robot, θ is the angle between the robot body and the vertical upward direction, u is the input, M is the mass of the two-wheeled bottom part of the robot, m is the upper body mass of the robot, b is the coefficient of friction between the robot's bottom wheel and the ground, l is the linear distance between the axis of the robot's bottom wheel and the center of its body mass, and I is the upper body inertia of the robot.Formulas (8) and (9) can simplify the system state equation as follows:(10)x˙=Ax+Buy=Cx+Duwhere A is the state matrix, B is the input matrix, C is the output matrix, and D=0 is the feedforward matrix.


## 2.1. System Description of the Two-Wheeled Self-Balancing Mobile Robot System

As shown in Figure1, the mechanical part of the two-wheeled self-balancing mobile robot [23–25] basically consists of two wheels and a body. The parameters of the two wheels of the robot are the same in terms of mass, diameter and rotational inertia; additionally, these wheels are coaxially installed and independently driven. The body moves in an upright fashion and maintains balance through two rounds of rotation. The fundamental equation and derivation of the robotic mathematical model use Newton’s laws of motion and Lagrangian mechanics. Based on the model, an open-closed-loop controller, in combination with ILC, is deployed for equilibrium stability and drive control.Figure 1
Model of a two-wheeled self-balancing mobile robot system in motion.When the two wheels move at different speeds, the robot body can change its direction and rotate around its center by setting different rotation directions for the two wheels. The steering principle is exactly the same as the tank steering principle shown in Figure2.Figure 2
Steering diagram of the robot.


## 2.2. Dynamic Modeling of the Two-Wheeled Self-Balancing Mobile Robot System

According to Newton's second law of motion and the momentum balance, the following differential equation is obtained after force analysis of the robot body and two-wheeled bottom in the horizontal direction:(1)M+mx¨+bx˙+mlθ¨cos⁡θ-mlθ˙2sin⁡θ=uThe following differential equation is obtained by analyzing the force and momentum balance of the robot body in the vertical direction:(2)I+ml2θ¨+mglsin⁡θ=-mlx¨cos⁡θFormulas (1) and (2) are the mathematical model in the form of the system's nonlinear differential equations. Since keeping the robot in balance is the primary purpose of control under appropriate external conditions, the exact model is treated as follows: (3)cos⁡θ≈1,sin⁡θ≈-θ,dθdt2≈0The linearization of the equation of motion is as follows:(4)M+mx¨+bx˙-mlθ¨=u(5)I+ml2θ¨-mglθ=mlx¨After taking the Laplace transform [26, 27], the transfer function is as follows:(6)XsUs=I+ml2/qs2-mgl/qs4+bI+ml2/qs3-M+mmgl/qs2-bmgl/qs(7)θsUs=ml/qs2s4+bI+ml2/qs3-M+mmgl/qs2-bmgl/qswhere q=M+mI+ml2-m2l2.According to formulas (4) and (5), the equation of state in which the displacement x, velocity x˙, pitch angle θ, and angular velocity θ˙ of the robot are state variables is(8)x˙x¨θ˙θ¨=01000-I+ml2bIM+m+Mml2mgl2IM+m+Mml2000010-mlbIM+m+Mml2mglM+mIM+m+Mml20xx˙θθ˙+0I+ml2IM+m+Mml20mlIM+m+Mml2uThe output equation with the displacementx and pitch angle θ of the robot as the output variables is(9)y=xθ=10000010xx˙θθ˙+00uwhere x is the displacement of the robot, x˙ is the velocity of the robot, x¨ is the acceleration of the robot, θ is the angle between the robot body and the vertical upward direction, u is the input, M is the mass of the two-wheeled bottom part of the robot, m is the upper body mass of the robot, b is the coefficient of friction between the robot's bottom wheel and the ground, l is the linear distance between the axis of the robot's bottom wheel and the center of its body mass, and I is the upper body inertia of the robot.Formulas (8) and (9) can simplify the system state equation as follows:(10)x˙=Ax+Buy=Cx+Duwhere A is the state matrix, B is the input matrix, C is the output matrix, and D=0 is the feedforward matrix.


## 3. Designed Controller and Variable Forgetting Factor

The designed control algorithm, which includes the tracking error ofi previous iterations and i+1 current iterations, as shown in Figure 3, is(11)ui+1t=ai,tu0t+1-ai,tuit+φ1te˙it+φ2te˙i+1t+Ψ1teit+Ψ2tei+1twhere i indicates the iteration number; φ1t is the open-loop differential learning gain matrix; φ2t is the closed-loop differential learning gain matrix; Ψ1t is the open-loop proportional learning gain matrix; Ψ2t is the closed-loop proportional learning gain matrix; ui+1t and uit are the control variable; u0t is the initial value of the input; and eit=ydt-yit.Figure 3
Block diagram of the designed ILC law.Scholars generally use a fixed forgetting factor, buta cannot vary with changes in the system features. In this article, 0≤ai,t<1 is a multivariable forgetting factor that is introduced to the designed controller. This multivariable forgetting factor ai,t can vary automatically according to changing system deviation. The factor ai,t is used to balance perfect learning and robustness, which can increase the robustness of ILC against uncertainty, disturbance, initialization error, and fluctuation of system dynamics:(12)ai,t=1-δ55max⁡Λei2twhere Λ coordinates gain changes and Λ is used to control the rate at which δ approaches 1. The smaller the value of ai,t, the better the system tracking performance.


## 4. Convergence Analysis

Assumption 1.
Functionf is uniformly Lipschitz with respect to x  Ω∈Rm×Rm×1,T,(13)fxi+1,t-fxi,t≤kfxi+1-xiwhere kf is the Lipschitz constant and f∙ is a nonlinear function.Assumption 2.
The initial value of the system satisfies the following criterion:(14)xi0=xd0,∀iAssumption 3.
Forydt, unique udt and xdt exist that satisfy the following equations:(15)x˙dt=fxd,t+Btudtydt=Ctxdtwhere B∙ is a nonlinear function, udt is the desired control input, and xdt is the desired state.Assumption 4.
The uncertainty, disturbance and their derivatives are bounded.(16)bν≜maxsupt∈0,Tνit,supt∈0,Tνi+1tbdν≜maxsupt∈0,Tν˙it,supt∈0,Tν˙i+1tbω≜maxsupt∈0,Tωit,supt∈0,Tωi+1t
Let(17)△x˙i=x˙d-x˙i=fxd,t+Btudt-fxi,t-Btuit-ωit=△fit+Bt△uit-ωitwhere xd is the desired state of the system and ≜ indicates a formula that is defined as another formula.
Let us consider nonlinear multivariable systems [28, 29] with uncertainty and disturbances as follows:(18)x˙it=fxi,t+Btuit+ωityit=Ctxit+νitwhere i and t are the number of iterations and the running time, respectively. xit∈Rm is the state variable, uit∈Rm is the control variable, yit∈Rm is the system output, ωit and νit are the uncertainty item and interferential term, respectively, and w∙ is a nonlinear function.Theorem 5.
The sufficient convergence conditions of the ILC algorithm are(19)limi→∞△uitλ≤d<1
Then, we choose a sufficiently large constantλ to reach the conclusion of this theorem: the error eit approaches uniformly bounded with [0,T] by ILC.Proof.
From (11) and (18), we obtain(20)△ui+1=ud-ui+1=ud-au0-1-aui-φ1e˙i-φ2e˙i+1-Ψ1ei-Ψ2ei+1=a△u0+1-a△ui-φ1e˙i-φ2e˙i+1-Ψ1ei-Ψ2ei+1=a△u0+1-a△ui-φ1C˙t△xit+Ct△x˙it-ν˙it-φ2C˙t△xi+1t+Ct△x˙i+1t-ν˙i+1t-Ψ1Ct△xit-νit-Ψ2Ct△xi+1t-νi+1t(21)△x˙i=x˙d-x˙i=fxd,t+Btudt-fxi,t-Btuit-ωit=△fit+Bt△uit-ωit
Inserting (21) into (20) yields(22)△ui+1=a△u0+1-a△ui-φ1C˙t△xit+Ct△fit+Bt△uit-ωit-ν˙it-φ2C˙t△xi+1t+Ct△fi+1t+Bt△ui+1t-ωi+1t-ν˙i+1t-Ψ1Ct△xit-νit-Ψ2Ct△xi+1t-νi+1t
Using Assumption1 yields the following:(23)△ui+1=a△u0+1-a△ui-φ1C˙t△xit+φ1Ctkf1△xi+Bt△uit-ωit-φ1ν˙it-φ2C˙t△xi+1t-φ2Ctkf2△xi+1+Bt△ui+1t-ωi+1t-φ2ν˙i+1t-Ψ1Ct△xit+Ψ1νit-Ψ2Ct△xi+1t+Ψ2νi+1t(24)1+φ2CtBt△ui+1=1-a-φ1CtBt△ui-φ1C˙t+Ψ1Ct+φ1Ctkf1△xit-φ2C˙t+Ψ2Ct+φ2Ctkf2△xi+1t+φ1Ctωit-φ1ν˙it+φ2Ctωi+1t-φ2ν˙i+1t+Ψ1νit+Ψ2νi+1t+a△u0
Let us take the norm on both sides of (24), where λ-norm is defined to simplify the formula as follows:(25)γ1=sup1-aI-φ1CtBt,γ2=supI+φ2CtBt-1bφ1=supt∈0,Tφ1t,bΨ1=supt∈0,TΨ1t,bC=supt∈0,TCt,bdC=supt∈0,TC˙t,bφ2=supt∈0,Tφ2t,bΨ2=supt∈0,TΨ2t,bB=supt∈0,TBt,bkf1=supt∈0,Tkf1,bkf2=supt∈0,Tkf2,
Then, (24) implies the following.(26)△ui+1=γ1γ2△ui+γ2bφ1bdC+bΨ1bC+bφ1bkf1△xit+γ2bφ2bdC+bΨ2bC+bφ2bkf2△xi+1t+γ2bφ1bCbω+bφ2bCbω+bφ1bdv+bφ2bdv+bΨ1bν+bΨ2bv+γ2a△u0
Multiplying both sides of (13) by e-λt and taking the λ-norm yield(27)△ui+1λ≤γ1γ2△uiλ+γ2ξ1△xitλ+γ2ξ2△xi+1tλ+μ0where ξ1=bφ1bdC+bΨ1bC+bφ1bkf1, ξ2=bφ2bdC+bΨ2bC+bφ2bkf2, and μ0=γ2bφ1bCbω+bφ2bCbω+bφ1bdv+bφ2bdv+bΨ1bν+bΨ2bv+γ2a△u0λ.
From Assumption2, we obtain(28)△xit=∫0tfx,t△xiτ-ωiτdτ
Taking the norm yields(29)△xit=bωT+∫0t△xiτ+bB△uiτdτ
Using the Bellman-Gronwall Lemma condition gives(30)△xit=bωTet+∫0tet-τbB△uiτdτ
Multiplying both sides of (30) by e-λt to compute the λ-norm, we have(31)△xitλ≤bωT+bB1-e-λTλ△uiτλ
The same lesson applies as follows:(32)△xi+1tλ≤bωT+bB1-e-λTλ△ui+1τλ
Substituting (31) and (32) into (27) gives(33)△ui+1λ≤γ1γ2△uiλ+γ2ξ1bωT+bB1-e-λTλ△uiτλ+γ2ξ2bωT+bB1-e-λTλ△ui+1τλ+μ0
We have(34)1-γ2ξ2bB1-e-λTλ△ui+1λ≤γ1γ2+γ2ξ1bB1-e-λTλ△uiλ+γ2ξ1bωT+γ2ξ2bωT+μ0
This equation means that(35)b△ui+1λ≤a△uiλ+cwhere a=γ1γ2+γ2ξ1bB((1-e-λT)/λ),b=1-γ2ξ2bB((1-e-λT)/λ),c=γ2ξ1bωT+γ2ξ2bωT+μ0.
We choose a sufficiently large constantλ to satisfy b>0 and a/b<1, and we can reach the conclusion limi→∞⁡△uitλ≤c/(b-a). Thus, it is concluded that the error eit approaches uniformly bounded with [0,T] by ILC.


## 5. Simulation

In the simulation, open-closed-loop PD-ILC is used for comparison to verify the effectiveness of the proposed algorithm. The physical parameters of the two-wheeled self-balancing mobile robot are displayed in Table1. The desired trajectory is Pd=cosπtsinπtπt+π/2T. The interference terms areTable 1
Variables and parameters of the two-wheeled self-balancing mobile robot.
Symbol Parameter Value Unit M Mass of the wheel 1.12 kg m Mass of the self-balancing robot body 0.51 kg r Wheel diameter 0.042 m l Distance of barycenter to axle center 0.084 m I Rotational inertia 0.0032 kg.m 2 g Gravitational acceleration 9.87 m/s 2 b Friction coefficient of wheel and ground 0.1 N/m/secω i t = ν i t = 0.01 d i a g s i n 40 π t. The data used in the simulation are chosen as δ=0.85, Λ=6, and u0=0.10.1T.The simulation results are shown in Figures4–6. Substantial error reductions take place over 40 iterations. Figure 4 shows the trajectory tracking of the wheeled self-balancing mobile robot in the process of iterative operation, and this tracking can illustrate the effectiveness of ILC laws. The angle and position are converged after 30 iterations.Figure 4
Desired and actual position trajectories.
(a) (b)Figure 5
Max absolute values of the tracking error.
(a) (b)Figure 6
Response curves of the pitch angle.
(a) (b) (c) (d)The maximum tracking errors of the mobile robot are presented in Figure5. It is obvious that the errors greatly decrease with an increasing number of iterations. In addition, this figure shows that the proposed algorithm has very small and monotonically decreasing tracking errors, and the convergence rate of this algorithm is much greater than that of the traditional open-closed-loop PD-ILC controller. The dynamic performance of the system can be greatly improved.Figure6 shows the pitch angle of the mobile robot. These graphs show that the pitch angle decreases as the number of iterations increases. The controlled object is a two-wheeled self-balancing robot. To maintain the balance in the dynamic movement, pitch angle cannot be zero. Compared to traditional algorithms, the proposed algorithm has a smaller pitch angle. This contribution is due to the multivariable forgetting factor. Thus, the work developed and reported in this paper forms the basis of the design and development of open-closed-loop PD-ILC with variable forgetting factor algorithm schemes for output trajectory tracking and self-balancing control of robot systems and can be extended to and adopted in practical applications.


## 6. Experiment

The self-balancing robot is shown in Figure7. We choose STM32 MCU [30–32] as the main control unit. To verify the reliability and advantages of the proposed algorithm, two groups of experiments are conducted to compare the control performance of the two algorithms with the same conditions in a real two-wheeled self-balancing mobile robot.Figure 7
Two-wheeled self-balancing robot prototype.The motion trajectory of the robot is shown in Figures8 and 9 indicate the desired and actual position trajectories in the last iteration and the pitch angle is shown in Figure 10. The self-balancing mobile robot travels roughly along the black line of the road, especially while turning. The results of the experiment show that the proposed algorithm can effectively track the desired trajectory and yaw angle and stabilize the pitch angle.Figure 8
Process diagram of the two-wheeled self-balancing robot in motion.
(a) (b) (c) (d)Figure 9
Desired and actual position trajectories in the last iteration.Figure 10
Curve of the pitch angle of the robot attitude.The comparative results indicate that, with the same parameters, the performance of open-closed-loop PD-ILC with a variable forgetting factor is better than that of traditional open-closed-loop PD-ILC in terms of robot control. Figures9 and 10 indicate that the designed control algorithm for two-wheeled self-balancing mobile robot systems has better trajectory tracking control ability, faster convergence speed and maintains variation in the lower pitch angle despite a variety of disturbances. The proposed algorithm has potential value for practical applications.


## 7. Conclusions

After adopting an ILC strategy combining open-closed-loop PD and a variable forgetting factor, a new iterative approach that can effectively solve two-wheeled self-balancing mobile robot kinematics is constructed in this paper. The self-balancing robot is a complicated dynamic system that has highly nonlinear and coupled characteristics. Acceptable trajectory tracking control and self-balancing features have been achieved with both control strategies. Simulation and experimental results validate the effectiveness and feasibility of the designed algorithm. In the future, we will apply this algorithm in other control fields.



---

*Source: 5705126-2019-08-08.xml*