#### 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.

#### 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 a *RH*_{∞} 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 the *RH*_{∞} 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 Section 2.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 voltage *U* 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.

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 Figure 2.

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

The two-wheel bicycle model is shown in the Figure 3, in which is the weight of the bicycle (including the DC motor), is the weight of the flywheel, is the height of the center of the gravity of the bicycle (excluding the flywheel), is the height of the center of the gravity of the flywheel, is the moment of inertia of the bicycle, 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.

We have the following: Absolute velocity of *A* is . Absolute velocity of B is .

In the study [16], we use the Lagrange equations to build dynamic models of the system:

is the total kinetic energy of the system, is the total potential energy of the system, is external forces, and is generality coordinates.

Total the kinetic energy of the system is defined as .

is the total kinetic energy of bicycle and is defined by the following formula: ; is the total potential energy of flywheel and is defined by the following formula: .

From here, we have

The total potential energy of the system iswith , using formulas (1)–(4), we obtain the following formula:with , using formulas (1)–(4), we obtain the following formula:with 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:where is the torque constant of the motor; is the electromotive force constant of the motor; is the resistance of the motor.

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 ; we linearized (5) around the equilibrium and obtained the following equations:

Set ; .

Set as state variables; .

From here, we have the state system of equations describing the system as follows:The parameters of the system are as follows:

The nominal parameters of the two-wheel bicycle are shown in Table 1.

Replacing number into the system of (10), we obtained the parameters as follows:

Transfer bicycle model into a transfer function; we have results:

##### 2.4. Optimized Design *RH*_{∞} 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.

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

Assuming that when the bicycle is operating, its angle is very small; we linearized (5) around the equilibrium and obtained the following system of equations:

Set ; .

Set as state variables; .

From here, we have the status system of equations describing the system as follows:

The parameters of the system are as follows:

Select parameter and 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:

To design a robust controller for self-balancing two-wheel bicycle model, we follow steps of the design *RH*_{∞} robust controller under the documents [27–42]; the robust controller is obtained as follows:

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:

and .

The goal of the order reduction problem with the model described by (20) is to find models described by systems of equations:

with , 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 system into two parts is as follows: in which is unstable part and is stable part. Then performing reducing order for stable part obtained the stable compact system , resulting in reduced order of the unstable system which will be .

The details of the algorithm are as follows: Input: the system 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: with ( denotes the number of stable poles), , , , , , and . Step 1.2: compute from Lyapunov equation: . Step 1.3: define a transition matrix , where and are identity matrix of size and . Step 1.4: compute . Step 1.5: partition as with , , , , , stable subsystem , unstable subsystem . Step 2: triangle realization of the stable subsystem in which has triangle form, according to the following steps: Step 2.1: compute Schur decomposition of : , where is an unitary matrix and is upper-triangle matrix. Step 2.2: compute observability Gramian came from Lyapunov equation: Step 2.3: compute Cholesky factorization of , where is upper-triangle matrix. Step 2.4: compute nonsingular transformation . Step 2.5: compute . Step 3: reorder the poles on the main diagonal of the upper-triangle matrix by , , or mixed-dominant index. Input: the triangle realization . Step 3.1: for each pole , with computing its -dominant index, (or resp., its -dominant index, , or its mixed-dominant index, ). Step 3.2: choose the largest -dominant index, (resp., for -dominant index, mixed index). Step 3.3: reorder the pole (and its conjugate , if it appears) to the first position in the diagonal of by unitary matrix : Step 3.4: compute a new equivalent realization . Step 3.5: remove two first rows and columns of to obtain a smaller realization with dimensions. Step 3.6: do the same procedure from Step 1 to Step 5 for smaller realization and continue this loop until all poles are reordered. Output: the equivalent system with the poles arranged in descending of , -, and mixed-dominant index on the main diagonal of the upper-triangle matrix . Step 4: reduced equivalent system . Input: the equivalent system . Step 4.1: choose reorder *r* so that *r* << *n*. Step 4.2: is partitioned as follows: where . Output: the reduced system . Step 5: compute reduced system . Output: the reduced system .

#### 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.

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

Use the 5th- and 4th-order reduction controller in Table 2 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 . The simulation is based on the Matlab/Simulink. Simulation results are shown in Figure 5.

When the bicycle carries load , and , it is initial offset from the vertical an angle . The simulation results are shown in Figure 6.

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:

Doing simulation with parameters of the two-wheel bicycle model is nominal, and it is initial offset from the vertical an angle . The simulation results are shown in Figure 7.

##### 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 Figures 8 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).

**(a)**

**(b)**

When the bicycle carries load with the volume load of , 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.

**(a)**

**(b)**

When the vehicle carries an eccentric load with a weight of , 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.

When the vehicle carries an eccentric load with a weight of , 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.

When the vehicle overcomes obstacles, the result is shown in Figure 14. 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.

#### 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.

#### Data Availability

This publication is supported by multiple datasets, which are available at locations cited in the reference section.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This research was funded by Thai Nguyen University of Technology, No. 666, 3/2 Street, Thai Nguyen, Vietnam.

#### Supplementary Materials

The supplementary materials consist of two appendices to explain in more detail the review question. Appendix 1: model of self-balancing two-wheel vehicle. Appendix 2: determination of the parameters of a two-wheel vehicle model.* (Supplementary Materials)*