# Balancing Control of Two-Wheel Bicycle Problems

Authors: Ngoc Kien Vu; Hong Quang Nguyen
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

In recent years, more and more scientists have been interested in research on driving two-wheel bicycles. The problems in two-wheel bicycle control problem are self-balancing, uncertain models, and the impact of noise. In the paper, to solve the self-balancing problem, we use the flywheel method according to the inverted pendulum principle. To overcome the effects of the uncertain model, the impact of noise, we designed the vehicle balance controller according to the robust control algorithm. However, robust controllers often have a high order, which affects the quality during real control. To simplify the robust controller, we propose the use of a model order reduction algorithm. The simulation and experimental results have proved the correctness of the solutions given in the paper.


---

## Body

## 1. Introduction

Although two-wheel bicycles have been invented for a long time, the dynamics and the way to control the balance of two-wheel bikes are still exciting and mysterious topics for researchers. In particular, a difficult problem is controlling the balance of a two-wheel bicycle. To solve the problem of balancing the two-wheel bike, there are three typical methods as follows:(i)
Controlling balance by controlling the steering angle or using centrifugal force as in the research of Tanaka and Murakami [1], Chen and Dao [2–4], Huang et al. [5], Vatanashevanopakorn Parnichkun [6], and Wang et al. [7](ii)
Controlling balance by changing the center of mass such as Lee and Ham [8], Keo et al. [9], and Yamakita et al. [10](iii)
Controlling balance by flywheel as in the studies of Suebsomran [11], Sikander and Prasad [12], Beznos et al. [13], Hwang et al. [14], Karnopp [15], Gallaspy [16], Xu et al. [17], Lam [18, 19], Lot and Fleming [20], Park and Yi [21], Stephen and Girard [22], Lee et al. [23], Suprapto [24], and Kim et al. [25]The control method using centrifugal force has the disadvantage of not being able to control bicycle balance when the bicycle is stationary. The control method by changing the center of mass requires more weight, increasing the bicycle weight, while the response time of the system is slow. The control method using the flywheel has the advantage of being fast responsive and balanced even when the bicycle is not moving. Two-wheeled bicycle models using flywheels are based on the principle of gyroscope [11–16, 18–22, 24] to create a balanced moment for the bicycle; the flywheel usually has to rotate at high speed, so the flywheel dissipates a large amount of energy. The typical work of this group is the research of Lam [18, 19]; the author has built a self-balancing two-wheel bicycle based on a small bicycle model using flywheels operating under gyroscope principle. Simulation and experimental results prove that the vehicle can maintain balance when moving and is affected by external forces.In contrast, two-wheel bicycle models use flywheels based on the principle of inverted pendulum [17, 23, 25]; to create a balanced torque for the bicycle, the flywheel usually rotates only with low speed, so the flywheel will dissipate a small amount of energy. This group’s typical work is research [25]; the author has built a self-balancing two-wheeled model based on the bike’s chassis. The flywheel operates on the principle of inverted pendulum providing the ability to control the vehicle balance vertically when the vehicle is stationary as well as when the vehicle is moving. The vehicle model’s experimental results show the vehicle’s ability to balance when it moves in a curve. Two-wheel bicycle models are usually powered by a battery with limited capacity, so the two-wheel bicycle model using flywheels based on the principle of the inverted pendulum will save energy than the two-wheel bicycle model using the flywheel based on the principle of a gyroscope. Therefore, in this paper, we choose to build a self-balancing two-wheel bicycle model using flywheel based on the principle of an inverted pendulum.There are many proposed balance control algorithms for two-wheel bicycle, such as nonlinear control of Lee and Ham [8], Beznos [13], compensator design using root locus approach of Gallaspy [16], PD control of Surpato [19, 24], PID control of Lee et al. [23], and fuzzy control of Chen and Dao [2–4]. However, these control algorithms are not robust; the two-wheel bicycle model cannot carry loads with varied weights and cannot work in disturbance environments. Therefore, a robust control algorithm, as in [12, 26], is suitable for the two-wheel bicycle model’s real applications. However, the controller is designed according to RH∞ robust control algorithm [27–38] which usually has high order (order of controller is defined as the order of the sample polynomial). The high-order controller has many disadvantages when we take control of the two-wheel bicycle model because the program code of complexity and calculation in a long time leads to a long system’s response. Therefore, the reduced order of the controller, while ensuring quality, is a practical significance.To obtain a low-order controller, we have two different methods. (i) Select a fixed structure of a low-order controller and then apply the optimal algorithm to find the low-order controller parameters so that the low-order controller still maintains robust control standards. (ii) Designing a robust controller for an uncertain object will obtain a high-order controller and then apply order reduction algorithms to reduce the order of a high-order controller to obtain a low-order controller. In our opinion, due to having to solve two optimization problems at the same time (robust control problem and the problem of finding parameters of the low-order controller), the first method [12, 26] has high complexity. If the choice of the low-order controller’s structure is not appropriate, it may not be possible to determine the low-order controller (the optimal problem without solutions). With the second method, the order reduction problem is independent, and there will always be solutions like in [39], so to always find low-order controllers in all cases, the second method has the advantage of the first method.In this paper, we focus our research on designing a low-order robust controller for the control problems of self-balancing two-wheel vehicles in two steps:(i)
Step 1: Design aRH∞ robust controller to control the balance of two-wheel bicycle; the finder controller is called a full-order controller.(ii)
Step 2: Propose order reduction algorithm, using the proposed algorithm to reduce the order of theRH∞ full-order controller to obtain a low-order controller while ensuring quality. The meaning of this order reduction is the reduced response time of the system.The rest of this paper is organized as follows. The system composition of the two-wheel bicycle is described in Section2.1, Part 2. Modeling two-wheel bike is presented in Section 2.2, Part 2. The balanced controller design is introduced in Section 2.3, Part 2. In Part 3, the model order reduction algorithm is presented. In Part 4, the model order reduction algorithm is applied to reduce the order of the controller, which is designed in Section 2.3, Part 2. Experimental results of two-wheel bicycle control are presented in Part 5. Then, the conclusion of this research is described in Part 6.


## 2. Balance Control Two-Wheel Bicycle Problem

### 2.1. Dynamic Model for Two-Wheel Bicycle

The two-wheel bicycle model is based on the principle of balance using flywheel under the inverted pendulum principle. Briefly, the balance principle is described as follows: without external torque effects on an object or system (or total torque impact to an object is zero), the total angular momentum of that object will be preserved. A bicycle is moved by two wheels. When deflected from the equilibrium position (corresponding to a vertical angle), the gravity of the bike will create a torque leading it to pour down. To maintain equilibrium in general, we put on the bike a flywheel operating based on the principle of “inverted pendulum.” This flywheel will revolve around the axis (with the angular acceleration being a) and generate a torque that is balanced with the torque caused by the gravity the bicycle created. To control the flywheel’s acceleration, we use a DC motor with the voltageU applied to the motor, and then the balance control problem will be put on the angle control problem (output) by controlling the voltage U (input) applied to the DC motor. The mission is set to design a controller to keep the bicycle balanced, that is, keeping the angle (output) always at zero. A detailed description of the self-balancing two-wheel bicycle constitutes in Figure 1.Figure 1
Detailed model of self-balancing two-wheel bicycle.Detailed parameters of the mechanical part of the bicycle are given as follows: bicycle 1,19 m long, 0,5 m high, 0,4 m wide, flywheel weighing 3,976 kg with a diameter of 0,26 m, to spin the flywheel using DC motor 100w-15v-3400 rev/min + H-bridge circuit, measuring speed of flywheel using Encoder Sharp 100 pulses, measuring tilt using angle sensor GY-521 MPU-6050, the backward and forward system including a DC motor, H-bridge, and the remote control. The entire hardware system is connected to circuit Adruino Uno under the following schematic structure in Figure2.Figure 2
Schematic structure of bicycle controller.


### 2.2. Modeling Self-Balancing Two-Wheel Bicycle

The two-wheel bicycle model is shown in the Figure3, in which m1 is the weight of the bicycle (including the DC motor), m2 is the weight of the flywheel, h1 is the height of the center of the gravity of the bicycle (excluding the flywheel), h2 is the height of the center of the gravity of the flywheel, I1 is the moment of inertia of the bicycle, I2 is the moment of inertia of the flywheel, θ is the tilt angle of the bicycle compared to the vertical, and φ is the angle of rotation of the flywheel.Figure 3
Self-balancing two-wheel bicycle model.We have the following:Absolute velocity ofA is vA=h1θ˙.Absolute velocity of B isvB=h2θ˙.In the study [16], we use the Lagrange equations to build dynamic models of the system:(1)ddt∂T∂q˙i−∂T∂qi+∂V∂qi=Qi.T is the total kinetic energy of the system, V is the total potential energy of the system, Qi is external forces, and qi is generality coordinates.Total the kinetic energy of the system is defined asT=T1+T2.T1 is the total kinetic energy of bicycle and is defined by the following formula: T1=1/2m2vB2+1/2I1θ˙2; T2 is the total potential energy of flywheel and is defined by the following formula: T2=1/2m2vB2+1/2I2θ˙+φ˙.From here, we have(2)T=12m1vA2+12m2vB2+12I1θ˙2+12I2θ˙2+12I2φ˙2+I2φ˙θ˙,(3)⟹T=12m1h12+m2h22+I1+I2θ˙2+12I2φ˙2+I2φ˙θ˙.The total potential energy of the system is(4)V=g⋅cosθ⋅m1h1+m2h2,with qi=θ, using formulas (1)–(4), we obtain the following formula:(5)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅sinθ⋅m1h1+m2h2=0,with qi=φ, using formulas (1)–(4), we obtain the following formula:(6)I2φ¨+I2θ¨=Tm,with Tm being torque if the motor shaft.Consider a DC electric motor with a transmission ratio being a:1; the (torsion) torque of DC motor drives for the flywheel as follows:(7)Tm=aKmU−Keφ˙R,where Km is the torque constant of the motor; Ke is the electromotive force constant of the motor; R is the resistance of the motor.Replace (7) with (6); we have(8)I2φ¨+I2θ¨=Tm=aKmU−Keφ˙R.Equations (5) and (8) are the kinematic equations of the system. Obviously, with the above aerodynamics equations, the system is nonlinear.


### 2.3. Linearizing Model and Moving to the Form of the State-Space Model

Assuming that when the bicycle is operating, its angle is very smallθ<100; we linearized (5) around the equilibriumθ=φ=0,sinθ=θ and obtained the following equations:(9)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅θ⋅m1h1+m2h2=0,I2φ¨+I2θ¨=Tm=aKmU−Keφ˙R.SetA1=m1h12+m2h22+I1+I2; B1=m1h1+m2h2.Setx=θ=x1θ˙=x2φ˙=x3 as state variables; y=θ,u=U.From here, we have the state system of equations describing the system as follows:(10)x˙=Ax+Bu,y=Cx+Du.The parameters of the system are as follows:(11)A=010B1gA1−I20aKmKeRA1−I2−B1gA1−I20−aKmKeA1I2RA1−I2;B=0−aKmRA1−I2aKmA1I2RA1−I2;C=100;D=0.The nominal parameters of the two-wheel bicycle are shown in Table1.Table 1
The parameters of the self-balancing two-wheel bicycle.
ParametersValueUnitI10,1105kg·m2h10,105MI20,03289kg·m2h20,205Mm110,024kgm23,976kgKe0,045V·s/radKm0,045Nm/AR0,52Ωa1 : 1g9,81m/s2Replacing number into the system of (10), we obtained the parameters as follows:(12)A=01047,204800,0100−47,20480−0,1248,B=0−0,22302,8541,C=100.Transfer bicycle model into a transfer function; we have results:(13)Ss=θsUs=−0,223ss3+0,1284s2−47,2s−5,589.


### 2.4. Optimized DesignRH∞ for Balancing Two-Wheel Bicycle Problems

Commenting on the two-wheel bicycle model, modeling self-balancing two-wheel bicycle model shows that some parameters of a bicycle are uncertain, such as volume load changes leading to focus height of the bicycle and the moment of inertia of bicycle changes, ... simultaneous operation of the two-wheel bicycle model can be affected by uncertain external factors such as external forces, unknown noise due to the changing of moving topography, ... so that the two-wheel bicycle model is an uncertain object, in which we concerned the most to variability caused by the change of volume load and external force. Unknown factors may reduce the accuracy of the two-wheel bicycle model’s mathematical model that would lead to lower controlling quality and even make the systems unstable. Because of the variability of the two-wheel bicycle model, robust control like in research [12, 26, 39] is the most suitable to control uncertain objects. Do design robust control system for self-balancing two-wheel bicycle model; we executed under the control structure diagram shown in Figure 4.Figure 4
Schematic structure of robust control system for self-balancing two-wheel bicycle model.


### 2.5. Building New Two-Wheel Bicycle ModelSms

Assuming that when the bicycle is operating, its angle is very small; we linearized (5) around the equilibrium θ=φ=0,sinθ=θ and obtained the following system of equations:(14)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅θ⋅m1h1+m2h2=0,I2φ¨+I2θ¨=Tm=aKmU∗−Ke+K1φ˙+K2θ˙R.SetA1=m1h12+m2h22+I1+I2; B1=m1h1+m2h2.Setx=θ=x1θ˙=x2φ˙=x3 as state variables; y=θ,u=U∗.From here, we have the status system of equations describing the system as follows:(15)x˙=Ax+Bu,y=Cx+Du.The parameters of the system are as follows:(16)A=010B1gA1−I2aKmK2RA1−I2aKmKe+K1RA1−I2−B1gA1−I2−aKmK2A1I2RA1−I2−aKmKe+K1A1I2RA1−I2,B=0−aKmRA1−I2aKmA1I2RA1−I2,C=100,D=0.Select parameterK1=2 and K2=5 and replace the parameters in Table 1 in the system of (15); then transfer the bicycle model to form of transfer function obtaining the results:(17)Sms=θsUs=−0,223ss3+4,722s2−47,2s−254.To design a robust controller for self-balancing two-wheel bicycle model, we follow steps of the designRH∞ robust controller under the documents [27–42]; the robust controller is obtained as follows:(18)Rs=HsDs.(19)Hs=−2,23.10−7s30−4,67.10−4s29−0,266s28−22,96s27−1006s26−2,853.104s25−5,837.105s24−9,144.106s23−1,139.108s22−1,158.109s21−9,776.109s20−6,949.1010s19−4,199.1011s18−2,172.1012s17−9,663.1012s16−3,71.1013s15−1,231.1014s14−3,53.1014s13−8,74.1014s12−1,862.1015s11−3,398.1015s10−5,276.1015s9−6,903.1015s8−7,511.1015s7−6,676.1015s6−4,721.1015s5−2,556.1015s4−9,953.1014s3−2,482.1014s2−2,977.1013s−0,00439,Ds=4,971.10−14s30+2,032.10−10s29+2,663.10−7s28+1,221.10−4s27+9,72.10−3s26+0,3918s25+10,14s24+187.1s23+2612s22+2,862.104s21+1,088.107s18+2,523.105s20+1,82.106s19+5,428.107s17+2,273.108s16+8,005.108s15+2,372.109s14+5,9.109s13+1,225.1010s12+2,107.1010s11+2,962.1010s10+3,341.1010s9+2,941.1010s8+1,931.1010s7+8,743.109s6+2,286.109s5+1,519.108s4−5,226.107s3+3,6.10−6s2+5,32.10−22s.When using the 30th-order robust controller (the original controller) to perform bicycle balance control, it will lead to a lot of unfavorable because the complex program codes will make the processing time increase and so speed of response of the control system is delayed and does not meet the real-time requirement of the controller and can cause the balance system instability. Therefore, to improve the quality of this controller, we should perform reducing order of controller for simpler the program code, to reduce processing time and to speed up a response that satisfies the requirement of sustainable stability of the system.


## 2.1. Dynamic Model for Two-Wheel Bicycle

The two-wheel bicycle model is based on the principle of balance using flywheel under the inverted pendulum principle. Briefly, the balance principle is described as follows: without external torque effects on an object or system (or total torque impact to an object is zero), the total angular momentum of that object will be preserved. A bicycle is moved by two wheels. When deflected from the equilibrium position (corresponding to a vertical angle), the gravity of the bike will create a torque leading it to pour down. To maintain equilibrium in general, we put on the bike a flywheel operating based on the principle of “inverted pendulum.” This flywheel will revolve around the axis (with the angular acceleration being a) and generate a torque that is balanced with the torque caused by the gravity the bicycle created. To control the flywheel’s acceleration, we use a DC motor with the voltageU applied to the motor, and then the balance control problem will be put on the angle control problem (output) by controlling the voltage U (input) applied to the DC motor. The mission is set to design a controller to keep the bicycle balanced, that is, keeping the angle (output) always at zero. A detailed description of the self-balancing two-wheel bicycle constitutes in Figure 1.Figure 1
Detailed model of self-balancing two-wheel bicycle.Detailed parameters of the mechanical part of the bicycle are given as follows: bicycle 1,19 m long, 0,5 m high, 0,4 m wide, flywheel weighing 3,976 kg with a diameter of 0,26 m, to spin the flywheel using DC motor 100w-15v-3400 rev/min + H-bridge circuit, measuring speed of flywheel using Encoder Sharp 100 pulses, measuring tilt using angle sensor GY-521 MPU-6050, the backward and forward system including a DC motor, H-bridge, and the remote control. The entire hardware system is connected to circuit Adruino Uno under the following schematic structure in Figure2.Figure 2
Schematic structure of bicycle controller.


## 2.2. Modeling Self-Balancing Two-Wheel Bicycle

The two-wheel bicycle model is shown in the Figure3, in which m1 is the weight of the bicycle (including the DC motor), m2 is the weight of the flywheel, h1 is the height of the center of the gravity of the bicycle (excluding the flywheel), h2 is the height of the center of the gravity of the flywheel, I1 is the moment of inertia of the bicycle, I2 is the moment of inertia of the flywheel, θ is the tilt angle of the bicycle compared to the vertical, and φ is the angle of rotation of the flywheel.Figure 3
Self-balancing two-wheel bicycle model.We have the following:Absolute velocity ofA is vA=h1θ˙.Absolute velocity of B isvB=h2θ˙.In the study [16], we use the Lagrange equations to build dynamic models of the system:(1)ddt∂T∂q˙i−∂T∂qi+∂V∂qi=Qi.T is the total kinetic energy of the system, V is the total potential energy of the system, Qi is external forces, and qi is generality coordinates.Total the kinetic energy of the system is defined asT=T1+T2.T1 is the total kinetic energy of bicycle and is defined by the following formula: T1=1/2m2vB2+1/2I1θ˙2; T2 is the total potential energy of flywheel and is defined by the following formula: T2=1/2m2vB2+1/2I2θ˙+φ˙.From here, we have(2)T=12m1vA2+12m2vB2+12I1θ˙2+12I2θ˙2+12I2φ˙2+I2φ˙θ˙,(3)⟹T=12m1h12+m2h22+I1+I2θ˙2+12I2φ˙2+I2φ˙θ˙.The total potential energy of the system is(4)V=g⋅cosθ⋅m1h1+m2h2,with qi=θ, using formulas (1)–(4), we obtain the following formula:(5)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅sinθ⋅m1h1+m2h2=0,with qi=φ, using formulas (1)–(4), we obtain the following formula:(6)I2φ¨+I2θ¨=Tm,with Tm being torque if the motor shaft.Consider a DC electric motor with a transmission ratio being a:1; the (torsion) torque of DC motor drives for the flywheel as follows:(7)Tm=aKmU−Keφ˙R,where Km is the torque constant of the motor; Ke is the electromotive force constant of the motor; R is the resistance of the motor.Replace (7) with (6); we have(8)I2φ¨+I2θ¨=Tm=aKmU−Keφ˙R.Equations (5) and (8) are the kinematic equations of the system. Obviously, with the above aerodynamics equations, the system is nonlinear.


## 2.3. Linearizing Model and Moving to the Form of the State-Space Model

Assuming that when the bicycle is operating, its angle is very smallθ<100; we linearized (5) around the equilibriumθ=φ=0,sinθ=θ and obtained the following equations:(9)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅θ⋅m1h1+m2h2=0,I2φ¨+I2θ¨=Tm=aKmU−Keφ˙R.SetA1=m1h12+m2h22+I1+I2; B1=m1h1+m2h2.Setx=θ=x1θ˙=x2φ˙=x3 as state variables; y=θ,u=U.From here, we have the state system of equations describing the system as follows:(10)x˙=Ax+Bu,y=Cx+Du.The parameters of the system are as follows:(11)A=010B1gA1−I20aKmKeRA1−I2−B1gA1−I20−aKmKeA1I2RA1−I2;B=0−aKmRA1−I2aKmA1I2RA1−I2;C=100;D=0.The nominal parameters of the two-wheel bicycle are shown in Table1.Table 1
The parameters of the self-balancing two-wheel bicycle.
ParametersValueUnitI10,1105kg·m2h10,105MI20,03289kg·m2h20,205Mm110,024kgm23,976kgKe0,045V·s/radKm0,045Nm/AR0,52Ωa1 : 1g9,81m/s2Replacing number into the system of (10), we obtained the parameters as follows:(12)A=01047,204800,0100−47,20480−0,1248,B=0−0,22302,8541,C=100.Transfer bicycle model into a transfer function; we have results:(13)Ss=θsUs=−0,223ss3+0,1284s2−47,2s−5,589.


## 2.4. Optimized DesignRH∞ for Balancing Two-Wheel Bicycle Problems

Commenting on the two-wheel bicycle model, modeling self-balancing two-wheel bicycle model shows that some parameters of a bicycle are uncertain, such as volume load changes leading to focus height of the bicycle and the moment of inertia of bicycle changes, ... simultaneous operation of the two-wheel bicycle model can be affected by uncertain external factors such as external forces, unknown noise due to the changing of moving topography, ... so that the two-wheel bicycle model is an uncertain object, in which we concerned the most to variability caused by the change of volume load and external force. Unknown factors may reduce the accuracy of the two-wheel bicycle model’s mathematical model that would lead to lower controlling quality and even make the systems unstable. Because of the variability of the two-wheel bicycle model, robust control like in research [12, 26, 39] is the most suitable to control uncertain objects. Do design robust control system for self-balancing two-wheel bicycle model; we executed under the control structure diagram shown in Figure 4.Figure 4
Schematic structure of robust control system for self-balancing two-wheel bicycle model.


## 2.5. Building New Two-Wheel Bicycle ModelSms

Assuming that when the bicycle is operating, its angle is very small; we linearized (5) around the equilibrium θ=φ=0,sinθ=θ and obtained the following system of equations:(14)m1h12+m2h22+I1+I2θ¨+I2φ¨−g⋅θ⋅m1h1+m2h2=0,I2φ¨+I2θ¨=Tm=aKmU∗−Ke+K1φ˙+K2θ˙R.SetA1=m1h12+m2h22+I1+I2; B1=m1h1+m2h2.Setx=θ=x1θ˙=x2φ˙=x3 as state variables; y=θ,u=U∗.From here, we have the status system of equations describing the system as follows:(15)x˙=Ax+Bu,y=Cx+Du.The parameters of the system are as follows:(16)A=010B1gA1−I2aKmK2RA1−I2aKmKe+K1RA1−I2−B1gA1−I2−aKmK2A1I2RA1−I2−aKmKe+K1A1I2RA1−I2,B=0−aKmRA1−I2aKmA1I2RA1−I2,C=100,D=0.Select parameterK1=2 and K2=5 and replace the parameters in Table 1 in the system of (15); then transfer the bicycle model to form of transfer function obtaining the results:(17)Sms=θsUs=−0,223ss3+4,722s2−47,2s−254.To design a robust controller for self-balancing two-wheel bicycle model, we follow steps of the designRH∞ robust controller under the documents [27–42]; the robust controller is obtained as follows:(18)Rs=HsDs.(19)Hs=−2,23.10−7s30−4,67.10−4s29−0,266s28−22,96s27−1006s26−2,853.104s25−5,837.105s24−9,144.106s23−1,139.108s22−1,158.109s21−9,776.109s20−6,949.1010s19−4,199.1011s18−2,172.1012s17−9,663.1012s16−3,71.1013s15−1,231.1014s14−3,53.1014s13−8,74.1014s12−1,862.1015s11−3,398.1015s10−5,276.1015s9−6,903.1015s8−7,511.1015s7−6,676.1015s6−4,721.1015s5−2,556.1015s4−9,953.1014s3−2,482.1014s2−2,977.1013s−0,00439,Ds=4,971.10−14s30+2,032.10−10s29+2,663.10−7s28+1,221.10−4s27+9,72.10−3s26+0,3918s25+10,14s24+187.1s23+2612s22+2,862.104s21+1,088.107s18+2,523.105s20+1,82.106s19+5,428.107s17+2,273.108s16+8,005.108s15+2,372.109s14+5,9.109s13+1,225.1010s12+2,107.1010s11+2,962.1010s10+3,341.1010s9+2,941.1010s8+1,931.1010s7+8,743.109s6+2,286.109s5+1,519.108s4−5,226.107s3+3,6.10−6s2+5,32.10−22s.When using the 30th-order robust controller (the original controller) to perform bicycle balance control, it will lead to a lot of unfavorable because the complex program codes will make the processing time increase and so speed of response of the control system is delayed and does not meet the real-time requirement of the controller and can cause the balance system instability. Therefore, to improve the quality of this controller, we should perform reducing order of controller for simpler the program code, to reduce processing time and to speed up a response that satisfies the requirement of sustainable stability of the system.


## 3. Model Order Reduction Algorithm for Unstable System

### 3.1. Problem of Model Order Reduction

A multiple inputs and outputs linear system is given with continuous-time constant parameters described in space stated in the following equations:(20)x˙=Ax+Bu,y=Cx.x∈ℝn,u∈ℝp,y∈ℝq,A∈ℝnxn,B∈ℝnxp, and C∈ℝqxn.The goal of the order reduction problem with the model described by (20) is to find models described by systems of equations:(21)x˙r=Arxr+Bru,yr=Crxr.xr∈ℝr,ur∈ℝp,yr∈ℝq,Ar∈ℝrxr,Br∈ℝrxp,Cr∈ℝqxr with r≪n, so that the model described by (21) can be replaced by the model described in (20) to be applied in analysis, design, and control system.


### 3.2. Model Order Reduction Algorithm

In this section, we introduce a model order reduction algorithm for unstable system basic approaches as follows: Separation of unstable systemGs into two parts is as follows: Gs=G+s+G−s in which G+s is unstable part and G−s is stable part. Then performing reducing order for stable part G−s obtained the stable compact system G^−s, resulting in reduced order of the unstable system Gs which will be G^s=G^−s+G+s.The details of the algorithm are as follows:Input: the systemA,B,C is described as (20) (unstable system).Step 1: decompose the unstable system into two subsystems: stable subsystem and unstable subsystem.Step 1.1: transform this system to the triangle system; we obtain the system that has the form:At=At11At120At22,Bt=Bt1Bt2,Ct=Ct1Ct2,withAt11∈ℝm×m (m denotes the number of stable poles), At12∈ℂm×n−m, At22∈ℝn−m×n−m, Bt1∈ℂm×p, Bt2∈ℝn−m×p, Ct1∈ℝq×m, and Ct2∈ℝq×n−m.Step 1.2: computeS from Lyapunov equation:At11S−SAt22+At12=0.Step 1.3: define a transition matrixW=Ir.S.......0.In−r,whereIm and In−m are identity matrix of size m×m and n−m×n−m.Step 1.4: computeAd,Bd,Cd=W−1AtW,W−1Bt,CtW.Step 1.5: partitionAd,Bd,Cd asAd=Ad1100Ad22,Bd=Bd1Bd2,Cd=Cd1Cd2,withAd11∈ℝm×m, Ad22∈ℝn−m×n−mBd1∈ℝm×p, Bd2∈ℝn−m×p, Cd1∈ℝq×m, Cd2∈ℝq×n−m,stable subsystemAd11,Bd1,Cd1,unstable subsystemAd22,Bd2,Cd2.Step 2: triangle realization of the stable subsystemAd11,Bd1,Cd1 in which Ad11 has triangle form, according to the following steps:Step 2.1: compute Schur decomposition ofAd11: Ad11=UΔUT, where U is an unitary matrix and Δ is upper-triangle matrix.Step 2.2: compute observability GramianQ came from Lyapunov equation:ΔQ+QΔ+CUTCU=0.Step 2.3: compute Cholesky factorization ofQ:Q=RTR, where R is upper-triangle matrix.Step 2.4: compute nonsingular transformationT=UR−1.Step 2.5: computeA˜,B˜,C˜=T−1Ad11T,T−1Bd1,Cd1T.Step 3: reorder the poles on the main diagonal of the upper-triangle matrixA˜ by H∞−, H2−, or mixed-dominant index.Input: the triangle realizationA˜,B˜,C˜.Step 3.1: for each poleλi, with i=1,…,n computing its H∞-dominant index, Ri=C˜iB˜i2/Reλi (or resp., its H2 -dominant index, Si=traceB˜iTB˜i, or its mixed-dominant index, Ji=maxRi,Si).Step 3.2: choose the largestH∞-dominant index, Ri1(resp., for H2 -dominant index, mixed index).Step 3.3: reorder the poleλi1 (and its conjugate λ¯i1, if it appears) to the first position in the diagonal of A˜ by unitary matrix U1:U1TA˜U1=λi1∗∗∗∗λ¯i1∗∗∗∗∗∗⋱⋮∗.Step 3.4: compute a new equivalent realizationU1TA˜U1,U1TB˜,C˜U1.Step 3.5: remove two first rows and columns ofU1TA˜U1,U1TB˜,C˜U1 to obtain a smaller realization A^,B^,C^ with n−2 dimensions.Step 3.6: do the same procedure from Step 1 to Step 5 for smaller realizationA^,B^,C^ and continue this loop until all poles are reordered.Output: the equivalent systemA⌣,B⌣,C⌣ with the poles arranged in descending of H∞‐, H2-, and mixed-dominant index on the main diagonal of the upper-triangle matrix A⌣.Step 4: reduced equivalent systemA⌣,B⌣,C⌣.Input: the equivalent systemA⌣,B⌣,C⌣.Step 4.1: choose reorderr so that r << n.Step 4.2:A⌣,B⌣,C⌣ is partitioned as follows:A⌣=A⌣11A⌣120A⌣22,B⌣=B⌣1B⌣2,C⌣=C⌣1C⌣2,whereA⌣11∈ℝrxr,B⌣1∈ℝrxp,C⌣1∈ℝqxr.Output: the reduced systemA⌣11,B⌣1,C⌣1.Step 5: compute reduced systemAr,Br,Cr=A⌣11,B⌣1,C⌣1+Ad22,Bd2,Cd2.Output: the reduced systemAr,Br,Cr.


## 3.1. Problem of Model Order Reduction

A multiple inputs and outputs linear system is given with continuous-time constant parameters described in space stated in the following equations:(20)x˙=Ax+Bu,y=Cx.x∈ℝn,u∈ℝp,y∈ℝq,A∈ℝnxn,B∈ℝnxp, and C∈ℝqxn.The goal of the order reduction problem with the model described by (20) is to find models described by systems of equations:(21)x˙r=Arxr+Bru,yr=Crxr.xr∈ℝr,ur∈ℝp,yr∈ℝq,Ar∈ℝrxr,Br∈ℝrxp,Cr∈ℝqxr with r≪n, so that the model described by (21) can be replaced by the model described in (20) to be applied in analysis, design, and control system.


## 3.2. Model Order Reduction Algorithm

In this section, we introduce a model order reduction algorithm for unstable system basic approaches as follows: Separation of unstable systemGs into two parts is as follows: Gs=G+s+G−s in which G+s is unstable part and G−s is stable part. Then performing reducing order for stable part G−s obtained the stable compact system G^−s, resulting in reduced order of the unstable system Gs which will be G^s=G^−s+G+s.The details of the algorithm are as follows:Input: the systemA,B,C is described as (20) (unstable system).Step 1: decompose the unstable system into two subsystems: stable subsystem and unstable subsystem.Step 1.1: transform this system to the triangle system; we obtain the system that has the form:At=At11At120At22,Bt=Bt1Bt2,Ct=Ct1Ct2,withAt11∈ℝm×m (m denotes the number of stable poles), At12∈ℂm×n−m, At22∈ℝn−m×n−m, Bt1∈ℂm×p, Bt2∈ℝn−m×p, Ct1∈ℝq×m, and Ct2∈ℝq×n−m.Step 1.2: computeS from Lyapunov equation:At11S−SAt22+At12=0.Step 1.3: define a transition matrixW=Ir.S.......0.In−r,whereIm and In−m are identity matrix of size m×m and n−m×n−m.Step 1.4: computeAd,Bd,Cd=W−1AtW,W−1Bt,CtW.Step 1.5: partitionAd,Bd,Cd asAd=Ad1100Ad22,Bd=Bd1Bd2,Cd=Cd1Cd2,withAd11∈ℝm×m, Ad22∈ℝn−m×n−mBd1∈ℝm×p, Bd2∈ℝn−m×p, Cd1∈ℝq×m, Cd2∈ℝq×n−m,stable subsystemAd11,Bd1,Cd1,unstable subsystemAd22,Bd2,Cd2.Step 2: triangle realization of the stable subsystemAd11,Bd1,Cd1 in which Ad11 has triangle form, according to the following steps:Step 2.1: compute Schur decomposition ofAd11: Ad11=UΔUT, where U is an unitary matrix and Δ is upper-triangle matrix.Step 2.2: compute observability GramianQ came from Lyapunov equation:ΔQ+QΔ+CUTCU=0.Step 2.3: compute Cholesky factorization ofQ:Q=RTR, where R is upper-triangle matrix.Step 2.4: compute nonsingular transformationT=UR−1.Step 2.5: computeA˜,B˜,C˜=T−1Ad11T,T−1Bd1,Cd1T.Step 3: reorder the poles on the main diagonal of the upper-triangle matrixA˜ by H∞−, H2−, or mixed-dominant index.Input: the triangle realizationA˜,B˜,C˜.Step 3.1: for each poleλi, with i=1,…,n computing its H∞-dominant index, Ri=C˜iB˜i2/Reλi (or resp., its H2 -dominant index, Si=traceB˜iTB˜i, or its mixed-dominant index, Ji=maxRi,Si).Step 3.2: choose the largestH∞-dominant index, Ri1(resp., for H2 -dominant index, mixed index).Step 3.3: reorder the poleλi1 (and its conjugate λ¯i1, if it appears) to the first position in the diagonal of A˜ by unitary matrix U1:U1TA˜U1=λi1∗∗∗∗λ¯i1∗∗∗∗∗∗⋱⋮∗.Step 3.4: compute a new equivalent realizationU1TA˜U1,U1TB˜,C˜U1.Step 3.5: remove two first rows and columns ofU1TA˜U1,U1TB˜,C˜U1 to obtain a smaller realization A^,B^,C^ with n−2 dimensions.Step 3.6: do the same procedure from Step 1 to Step 5 for smaller realizationA^,B^,C^ and continue this loop until all poles are reordered.Output: the equivalent systemA⌣,B⌣,C⌣ with the poles arranged in descending of H∞‐, H2-, and mixed-dominant index on the main diagonal of the upper-triangle matrix A⌣.Step 4: reduced equivalent systemA⌣,B⌣,C⌣.Input: the equivalent systemA⌣,B⌣,C⌣.Step 4.1: choose reorderr so that r << n.Step 4.2:A⌣,B⌣,C⌣ is partitioned as follows:A⌣=A⌣11A⌣120A⌣22,B⌣=B⌣1B⌣2,C⌣=C⌣1C⌣2,whereA⌣11∈ℝrxr,B⌣1∈ℝrxp,C⌣1∈ℝqxr.Output: the reduced systemA⌣11,B⌣1,C⌣1.Step 5: compute reduced systemAr,Br,Cr=A⌣11,B⌣1,C⌣1+Ad22,Bd2,Cd2.Output: the reduced systemAr,Br,Cr.


## 4. Apply MOR Algorithm in Balance Control Two-Wheel Bicycle Problem

### 4.1. The Result of Order Reduction Controller of Two-Wheel Bicycle

The robust controller is designed as (18), which is the 30th-order controller (the original controller). Performing order reduction of the robust controller under the model order reduction algorithm proposed in Part 3, we obtain the results as in Table 2.Table 2
Results the order reduction of 30th-order controller.
OrderReduced system-Wcr(s)5−4,485.106s5−6,804.107s4−4,123.108s3−1,235.109s2−1,816.109s−1,09.109/s5+2009s4+1,833.104s3−1913s2+2,165.10−13s−2,804.10−144−4,485.106s4−2,65.107s3−1,141.108s2−1,833.108s−1,176.108/s4+2000s3−206,5s2+2,369.10−14s−3,026.10−15


### 4.2. Applying the 5th- and 4th-Order Reduction Controller to Control Balance Two Wheelers

Use the 5th- and 4th-order reduction controller in Table2 to control the balance system for the two-wheel bicycle having control object model as (17). To see the quality, we compare it with the original controller (30th-order controller).Performing simulation with the parameter of two-wheel bicycle model is nominal and the bicycle is initial offset from a vertical angleθ=π/180rad. The simulation is based on the Matlab/Simulink. Simulation results are shown in Figure 5.Figure 5
The output response of the balanced control system of the two-wheel bicycle, while the bicycle is not carrying load.When the bicycle carries loadmt=7kg,h1=0,155m, and I1=0,409kg⋅m2, it is initial offset from the vertical an angle θ=π/180rad. The simulation results are shown in Figure 6.Figure 6
The output response of the control system balancing two-wheel bicycle, while the bicycle is carrying load.Compare the result of the control system balancing two-wheel bicycle using the original controller, order reduction controller under the new model order reduction algorithm, and other model order reduction algorithms. We chose to compare the new model order reduction algorithm with the balanced truncation algorithm of Moore [43]; this is the most used model order reduction algorithm. Do perform order reduction under the balanced truncation algorithm in Matlab we use balancmr command, resulting in a 4th-order reduction controller as follows:(22)Wcrs=−4,485.106s4−5,351.108s3+7,513.107s2+2,822.107s+1,307.107s4+2000s3−206,5s2+1,258.10−10s−4,767.10−12.Doing simulation with parameters of the two-wheel bicycle model is nominal, and it is initial offset from the vertical an angleθ=π/180rad. The simulation results are shown in Figure 7.Figure 7
The output response of the control system balancing two-wheel bicycle using 4th-order reduction controller.


### 4.3. Reviews Result

Using 4th- and 5th-order reduction controller under the new algorithm can control balance for two-wheel bicycle model, in which the output response of 5th-order reduction controller absolutely fits with the original controller, and the output response of the 4th-order reduction controller is different from the original system. Comparing the quality of control system balancing two-wheel bicycle model using 4th-order reduction controller according to the new algorithm with the 4th-order reduction controller according to the balanced truncation algorithm, we find that the control system balancing two-wheel bicycle model using the 4th-order reduction controller under the new algorithm ensures stable equilibrium model, two-wheel bicycle model, while the bicycle is offset from the vertical and the parameters of the model change. Balance control system using the 4th-order reduction controller under the balanced truncation algorithm does not ensure stable for two-wheel bicycle model, while the bicycle is offset from the vertical and the parameters of the model change.


## 4.1. The Result of Order Reduction Controller of Two-Wheel Bicycle

The robust controller is designed as (18), which is the 30th-order controller (the original controller). Performing order reduction of the robust controller under the model order reduction algorithm proposed in Part 3, we obtain the results as in Table 2.Table 2
Results the order reduction of 30th-order controller.
OrderReduced system-Wcr(s)5−4,485.106s5−6,804.107s4−4,123.108s3−1,235.109s2−1,816.109s−1,09.109/s5+2009s4+1,833.104s3−1913s2+2,165.10−13s−2,804.10−144−4,485.106s4−2,65.107s3−1,141.108s2−1,833.108s−1,176.108/s4+2000s3−206,5s2+2,369.10−14s−3,026.10−15


## 4.2. Applying the 5th- and 4th-Order Reduction Controller to Control Balance Two Wheelers

Use the 5th- and 4th-order reduction controller in Table2 to control the balance system for the two-wheel bicycle having control object model as (17). To see the quality, we compare it with the original controller (30th-order controller).Performing simulation with the parameter of two-wheel bicycle model is nominal and the bicycle is initial offset from a vertical angleθ=π/180rad. The simulation is based on the Matlab/Simulink. Simulation results are shown in Figure 5.Figure 5
The output response of the balanced control system of the two-wheel bicycle, while the bicycle is not carrying load.When the bicycle carries loadmt=7kg,h1=0,155m, and I1=0,409kg⋅m2, it is initial offset from the vertical an angle θ=π/180rad. The simulation results are shown in Figure 6.Figure 6
The output response of the control system balancing two-wheel bicycle, while the bicycle is carrying load.Compare the result of the control system balancing two-wheel bicycle using the original controller, order reduction controller under the new model order reduction algorithm, and other model order reduction algorithms. We chose to compare the new model order reduction algorithm with the balanced truncation algorithm of Moore [43]; this is the most used model order reduction algorithm. Do perform order reduction under the balanced truncation algorithm in Matlab we use balancmr command, resulting in a 4th-order reduction controller as follows:(22)Wcrs=−4,485.106s4−5,351.108s3+7,513.107s2+2,822.107s+1,307.107s4+2000s3−206,5s2+1,258.10−10s−4,767.10−12.Doing simulation with parameters of the two-wheel bicycle model is nominal, and it is initial offset from the vertical an angleθ=π/180rad. The simulation results are shown in Figure 7.Figure 7
The output response of the control system balancing two-wheel bicycle using 4th-order reduction controller.


## 4.3. Reviews Result

Using 4th- and 5th-order reduction controller under the new algorithm can control balance for two-wheel bicycle model, in which the output response of 5th-order reduction controller absolutely fits with the original controller, and the output response of the 4th-order reduction controller is different from the original system. Comparing the quality of control system balancing two-wheel bicycle model using 4th-order reduction controller according to the new algorithm with the 4th-order reduction controller according to the balanced truncation algorithm, we find that the control system balancing two-wheel bicycle model using the 4th-order reduction controller under the new algorithm ensures stable equilibrium model, two-wheel bicycle model, while the bicycle is offset from the vertical and the parameters of the model change. Balance control system using the 4th-order reduction controller under the balanced truncation algorithm does not ensure stable for two-wheel bicycle model, while the bicycle is offset from the vertical and the parameters of the model change.


## 5. Experiment Results

To determine the results of empirical control self-balancing two-wheel bicycle, we follow these steps:(1)
Start the PC + Run the Matlab-Simulink program.(2)
Open the Simulink file.(3)
Connect the Adruino motherboard in self-balancing two-wheel bicycle with PC through I/O USB.(4)
Turn on the power supply for the two-wheel model.(5)
Build a Simulink model; this process will convert the Simulink model into the sdf form (describing the system file) and save it in the processor’s motherboard Adruino.(6)
Run the Simulink file to control self-balancing two-wheel bicycle.The experiment results as follows:The operation of the two-wheel bicycle while not carrying a load is shown in Figures8 and 9. As can be seen from these figures, when the bicycle does not carry a load, the control system keeps the tilt angle of bicycle balance around the angle of 0 degrees (from −0,1 ÷ 0,1 degree).Figure 8
The output response of the self-balancing two-wheel bicycle while not carrying load.Figure 9
Self-balancing two-wheel bicycle while not carrying load. (a) View from the left. (b) View from the right.
(a)(b)When the bicycle carries load with the volume load ofmt=1,25kg, putting on the height of 0,25 m is shown in the Figures 10 and 11. From these figures, we can see that when the bicycle carries a load (both sides’ balance), after a short-time fluctuation (approximately 10 seconds) with a tilt angle margin of −1,1 ÷ 0,8 degree, the bicycle control system keeps its tilt angle around the 0 degrees.Figure 10
The output response of the self-balancing two-wheel bicycle while carrying load.Figure 11
Self-balancing two-wheel bicycle while carrying load. (a) View from the left. (b) View from the right.
(a)(b)When the vehicle carries an eccentric load with a weight ofmt=1,25kg, set at a height of 0,25 m, the result is shown in Figure 12. The figure shows that when the vehicle carries an eccentric load, after a short time of oscillation (about 15 seconds), with the amplitude of inclination angle ranging from 0 to 1,5 degrees, the control system maintains the vehicle balance at an angle of 1 degree (from 0,8 to 1,1 degrees). The new balanced tilt angle (different from the 0-degree angle) is the position that ensures the vehicle is balanced on both sides compared to the vertical.Figure 12
Output response when the vehicle carries an eccentric load.When the vehicle carries an eccentric load with a weight ofmt=2,2kg, set at a height of 0,25 m, the result shown in Figure 13. The figure depicts that when the vehicle carries an eccentric load, after a short time of oscillation (about 9,5 seconds), with the amplitude of inclination angle ranging between 1,475 and −3,75 degrees, the control system maintains the vehicle balance at an angle of −1,88 degree. The new balanced tilt angle (different from the 0-degree angle) is the position that ensures the vehicle is balanced on both sides compared to the vertical.Figure 13
Output response when the vehicle carries an eccentric load.When the vehicle overcomes obstacles, the result is shown in Figure14. As we can see from this figure, when the vehicle overcomes obstacles, the vehicle’s tilt angle ranges between 1,43 and −1,37 degrees; then the control system maintains the vehicle balance at an angle of −0,2 degree. The new balanced tilt angle (different from the 0-degree angle) is the position that ensures the vehicle is balanced on both sides compared to the vertical.Figure 14
Output response when the vehicle overcomes obstacles.


## 6. Conclusions

The paper has built, modeled, and designed a robust controller for self-balancing two-wheel bicycle. At the same time, the article introduced order reduction algorithms for stable and unstable systems. Applying this algorithm to reduce the order of the 30th-order robust controller of the control system balancing two-wheel bicycle showed that the 4th- and 5th-order controller can be used to replace the 30th-order controller that the system quality guarantees. Using the 4th- and 5th-order controller will create a simpler code of the program, higher calculation speed, and shorter processing duration and ensure the calculation of real-time self-balancing two-wheel bicycle control system. The simulation results and experiment results show the correctness of the proposed algorithms.



---

*Source: 6724382-2020-07-22.xml*