Balancing Control of Two-Wheel Bicycle Problems

In recent years, more and more scientists have been interested in research on driving two-wheel bicycles. ,e problems in twowheel bicycle control problem are self-balancing, uncertain models, and the impact of noise. In the paper, to solve the selfbalancing 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. ,e simulation and experimental results have proved the correctness of the solutions given in the paper.


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][3][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] e control method using centrifugal force has the disadvantage of not being able to control bicycle balance when the bicycle is stationary. e control method by changing the center of mass requires more weight, increasing the bicycle weight, while the response time of the system is slow. e 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. e 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. is group's typical work is research [25]; the author has built a self-balancing two-wheeled model based on the bike's chassis. e 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. e 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. erefore, in this paper, we choose to build a self-balancing two-wheel bicycle model using flywheel based on the principle of an inverted pendulum.
ere 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][3][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. erefore, 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][28][29][30][31][32][33][34][35][36][37][38] which usually has high order (order of controller is defined as the order of the sample polynomial). e 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. erefore, 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 loworder 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 loworder 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 loworder 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 loworder robust controller for the control problems of selfbalancing 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. e meaning of this order reduction is the reduced response time of the system. e rest of this paper is organized as follows. e 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. e 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. en, the conclusion of this research is described in Part 6.

Dynamic Model for Two-Wheel Bicycle.
e 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." is 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. e 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. e entire hardware system is connected to circuit Adruino Uno under the following schematic structure in Figure 2.

Modeling Self-Balancing Two-Wheel Bicycle.
e twowheel bicycle model is shown in the Figure 3, in which m 1 is the weight of the bicycle (including the DC motor), m 2 is the weight of the flywheel, h 1 is the height of the center of the gravity of the bicycle (excluding the flywheel), h 2 is the height of the center of the gravity of the flywheel, I 1 is the moment of inertia of the bicycle, I 2 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: In the study [16], we use the Lagrange equations to build dynamic models of the system: T is the total kinetic energy of the system, V is the total potential energy of the system, Q i is external forces, and q i is generality coordinates.
Total the kinetic energy of the system is defined as T 1 is the total kinetic energy of bicycle and is defined by the following formula: ; T 2 is the total potential energy of flywheel and is defined by the following formula: ⟹T � 1 2 e total potential energy of the system is with q i � θ, using formulas (1)-(4), we obtain the following formula: with q i � φ, using formulas (1)-(4), we obtain the following formula: with T m 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 K m is the torque constant of the motor; K e is the electromotive force constant of the motor; R is the resistance of the motor. Replace (7) with (6); we have Equations (5) and (8) are the kinematic equations of the system. Obviously, with the above aerodynamics equations, the system is nonlinear.

Linearizing Model and Moving to the Form of the State-Space Model.
Assuming that when the bicycle is operating, its angle is very small (θ < 10 0 ); we linearized (5) around the equilibrium(θ � φ � 0, sin θ � θ) and obtained the following equations: From here, we have the state system of equations describing the system as follows: e parameters of the system are as follows: e 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:

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

Building New Two-Wheel Bicycle Model S m (s).
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: Set From here, we have the status system of equations describing the system as follows: e parameters of the system are as follows: Select parameter K 1 � 2 and K 2 � 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: Two-wheel bicycle model S (s) Figure 4: Schematic structure of robust control system for self-balancing two-wheel bicycle model.
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. erefore, 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.

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: x ∈ R n ,u ∈ R p , y ∈ R q , A ∈ R nxn , B ∈ R nxp , and C ∈ R qxn . e goal of the order reduction problem with the model described by (20) is to find models described by systems of equations: x r ∈ R r , u r ∈ R p , y r ∈ R q , A r ∈ R rxr ,B r ∈ R rxp , C r ∈ R 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.

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 G(s) into two parts is as follows: G(s) � G + (s) + G − (s) in which G + (s) is unstable part and G − (s) is stable part. en performing reducing order for stable part G − (s) obtained the stable compact system G − (s), resulting in reduced order of the unstable system G(s) which will be G(s) � G − (s) + G + (s).
e details of the algorithm are as follows: Input: the system (A, 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: Step 1.2: compute S from Lyapunov equation: Step 1.4: compute Step 1.5: partition Step 2: triangle realization of the stable subsystem (A d11 , B d1 , C d1 ) in which A d11 has triangle form, according to the following steps: Step 2.1: compute Schur decomposition of A d11 : A d11 � UΔU T , where U is an unitary matrix and Δ is upper-triangle matrix.
Step 2.2: compute observability Gramian Q came from Lyapunov equation: Step 2.3: compute Cholesky factorization of Q: Q � R T R, where R is upper-triangle matrix.
Step 2.5: compute Step 3: reorder the poles on the main diagonal of the upper-triangle matrix A by H − ∞ , H − 2 , or mixed-dominant index. Input: the triangle realization (A, tBn, qC).
Step 3.3: reorder the pole λ i 1 (and its conjugate λ i 1 , if it appears) to the first position in the diagonal of A by unitary matrix U 1 : Step 3.4: compute a new equivalent realization Step 3.5: remove two first rows and columns of (U T 1 AU 1 , U T 1 B, CU 1 ) to obtain a smaller realization (A, tBn, qC) with n − 2 dimensions.
Step 3.6: do the same procedure from Step 1 to Step 5 for smaller realization (A, tBn, qC) and continue this loop until all poles are reordered. Step 4.1: choose reorder r so that r << n.
Step 4.2: (A ⌣ , tB ⌣ n, qC ⌣ ) is partitioned as follows: Step 5: compute reduced system (A r , B r , Output: the reduced system (A r , B r , C r ).

Apply MOR Algorithm in Balance Control
Two-Wheel Bicycle Problem

e Result of Order Reduction Controller of Two-Wheel
Bicycle. e 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.

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 θ � π/180(rad). e simulation is based on the Matlab/Simulink. Simulation results are shown in Figure 5.
When the bicycle carries load m t � 7 kg, h 1 � 0, 155 m, and I 1 � 0, 409 kg·m 2 , it is initial offset from the vertical an angle θ � π/180(rad). e simulation results are shown in Figure 6.
Compare the result of the control system balancing twowheel 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 θ � π/180(rad). e simulation results are shown in Figure 7.

Reviews Result.
Using 4th-and 5th-order reduction controller under the new algorithm can control balance for twowheel 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 4thorder 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.

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.
(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 twowheel bicycle.
e experiment results as follows: e operation of the two-wheel bicycle while not carrying a load is shown in Figures 8 and 9. As can be seen from  Time (sec) Figure 6: e output response of the control system balancing twowheel bicycle, while the bicycle is carrying load. 8 Mathematical Problems in Engineering 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). When the bicycle carries load with the volume load of m t � 1, 25 kg, 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 shorttime 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.
When the vehicle carries an eccentric load with a weight of m t � 1, 25 kg, set at a height of 0,25 m, the result is shown in Figure 12. e 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). e new balanced tilt angle (different from the 0degree 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 m t � 2, 2 kg, set at a height of 0,25 m, the result shown in Figure 13. e 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  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. e 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.

Conclusions
e 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. e simulation results and experiment results show the correctness of the proposed algorithms.

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

Conflicts of Interest
e authors declare that they have no conflicts of interest.