Research on Double Cascade Control Algorithm for Self-Balancing Two-Wheeled Vehicle

DOI: 10.4236/jamp.2016.44069   PDF   HTML   XML   1,772 Downloads   2,253 Views   Citations


To solve the problem of self-balancing two-wheeled vehicle, this article presents double cascade PID control algorithm. This method reduces the coupling of balance control, speed control and direction control, because of the special system structure. This article successfully solved the sensor fusion of gyroscope and accelerometer by using Kalman filtering algorithm, and adding in fuzzy PID algorithm to improve the flexibility of the steering system, thus greatly improving the accuracy and response rate of the system.

Share and Cite:

Zhang, Q. (2016) Research on Double Cascade Control Algorithm for Self-Balancing Two-Wheeled Vehicle. Journal of Applied Mathematics and Physics, 4, 618-622. doi: 10.4236/jamp.2016.44069.

1. Introduction

There are several control schemes of the self-balancing two-wheeled vehicle at home and abroad. A reference scheme of three PID controllers which are linear combined is given by Freescale Smart Car Competition Committee [1]. The two-wheeled robot JOE developed by the Swiss federal university of technology is designed based on optimal control and state-feedback control [2]. The artificial neural network has been used to construct the adaptive controller for the self-balancing two-wheeled robot [3]. On the basis of the first scheme, this article presents a new method of double cascade PID control. The structure of the control system itself greatly reduces the mutual coupling among balance control, speed control and direction control, so that the parameters of the system are easy to be adjusted, What’s more, compared with state-feedback control and advanced intelligent control, it do not require very precise system model, and the complexity of the control method is reduced.

2. Model Analysis

Self-balancing two-wheeled vehicle is a typical under-actuated system, two-wheeled vehicle has four degrees of freedom, in which only the left and right wheels can be drove. The motion control task can be divided into the following three basic control tasks: balance control, speed control and direction control.

The model of posture balance is similar to the one-level inverted pendulum [4]. The upright car model can be regarded as a simple pendulum which is upended on the wheels, the wheels can be driven to generate a relative acceleration, the mechanical model of inverted pendulum is shown in Figure 1.

In the noninertial system, it stresses additional inertia force, the force is proportional to the acceleration of the wheels, but it’s direction is on the contrary, so the restoring force is:


Owing to the θ is small, it can be linearized. It also need to add an additional damping force to make the inverted pendulum stable, thus the equation can be turned into:


The acceleration of the wheels is:


The θ is the obliquity of the inverted pendulum, θ’ is the angular velocity of inclination, k1 and k2 are the proportional coefficients.

The control period to adjust the angle of model is short, usually a few milliseconds, it is far less than the constant time of the machine. so the motor is basically running in accelerating stage [5]. It is possible to control the model remain upright if we can control the acceleration of the wheels as shown in Equation (3).

3. Double Cascade Control

Double cascade control sets balance control as the inner loop of the speed control, its output is the control voltage, at the same time, it sets the steering angular velocity control as the inner loop of direction control, its output is the differential voltage, the diagram is shown in Figure 2. In the speed-balance cascade control system attitude angle with large disturbance is included in the minor loop, which greatly improves the ability of distur- bance rejection of the system. While in the direction and angular velocity cascade control system, nonlinear control object is included in the minor loop, so the control system has a good dynamic performance [6], which makes the steering system faster and more flexible.

3.1. Speed-Balance Cascade Control

For the upright vehicles, the speed is proportional to the forwards inclination [7]. Therefore, we control the attitude angle of the car to control the speed. The input of the outer loop is the deviation of the average speed and the expected speed of two wheels, and the output is the size of an angle. While the input of the inner loop is the deviation of the dip angle related to speed and the attitude angle feedback by the gyroscope, the output is the PWM signal. In order to reduce the cascade disturbance of inner and outer loop, usually the output of the outer loop is smooth, and the inner loop should response rapidly, so the speed loop uses PI controller, the execution period is 10 milliseconds, and the balance loop uses PD controller, the execution period is 2 milliseconds.

3.2. Direction and Angular Velocity Cascade Control

The direction control is mainly accomplished by the differential speed system. In the design of the car, single loop control is difficult to achieve a fluent and swift turning, so this article introduces the angular velocity

Figure 1. Mechanical model of inverted pendulum.

closed-loop as the minor loop of direction control. The traditional PID control cannot adapt to different environment, so it is needed to add the fuzzy controller. Fuzzy self-tuning of PID parameter is to find out the fuzzy relationship of the 3 parameters between the change rate of error and error. According to fuzzy control principle, the 3 parameters are modified online to meet the different requirements of control parameter as different error and change rate of error, so as the controlled object has good dynamic and static performance [8]. Introducing the servo structure of the double closed loop with fuzzy PID control can make the car respond rapidly, and have a good self-adaptability.

3.3. The Angular Velocity Feedback without IMU Sensors

The traditional measuring method of the steering angular velocity is adding a gyro which reflects yaw bias, while using existing speed encoder which feedback speed signal of the two wheels can also infer the size of turning rate, the principle is shown in Figure 3.

Assuming that the car has a constant angular velocity, the turning radius is L, the car’s wheel tread is 2d, the speed of left and right wheels respectively are VLeft and VRight, it can be obtained that:

Figure 2. Diagram of control structure.

Figure 3. Principle of angular velocity measurement.


the numerator and denominator minus the right equation at the same time:


After simplification:


It can be concluded that steering angular velocity ω is proportional to the differential of the left and right wheels, when sampling interval is very short, the speed of two wheels can reflect the real-time turning angular velocity. This method not only avoids the drift of the gyroscope, but also can simplify the design of hardware without reducing the accuracy.

3.4. The Fusion Filter of Gyroscope and Accelerometer

In this article, Kalman filtering method is adopted to fuse the signals from accelerometers and gyroscope, which can solve the problem of noise jamming and pose optimal estimation value [9]. It has four steps: firstly, predicting the priori estimate value; secondly, predicting the priori estimate covariance matrix; thirdly, correcting priori estimate value; finally, correcting prior estimate covariance matrix. As a recursive filter, the Kalman filter only needs to calculate the current state estimate value by the estimate state of previous and the current observed quantity. Compared with the filtering technology of batch processing, the Kalman filter does not need the historical estimates and observation data, which can not only save memory but also provide high accuracy of attitude angle.

4. Conclusion

This article puts forward a control algorithm of the double cascade PID. A self-balancing two-wheeled vehicle designed by this algorithm can be driven at the speed of 2.2 meters per second, Moreover it can adapt to ramps, sudden turns, continuous turns and other complex road conditions. It can greatly reduce the mutual coupling among balance control, speed control and direction control. It is a simple and practical control method for transportation.


This work was financially supported by College Students’ innovation and entrepreneurship training plan of southwest University for Nationalities No. 201510656051.

Conflicts of Interest

The authors declare no conflicts of interest.


[1] Zhuo, Q., Huang, K.S. and Shao, B.B. (2007) Learn to Do Intelligent Vehicle—Challenge “Freescale” Cup. Beijing Aerospace University Press, Beijing.
[2] Liu, X.C. (2008) Design of Self-Balancing Two-Wheeled Vehicle and Research on Its Variable Structure Control. Master’s Degree Thesis, Xidian University, Xi’an.
[3] Cheng, G. (2009) Design of Self-Balancing Two-Wheeled Vehicle and Research on Its Stability in Wide-Range. Master’s Degree Thesis, Xidian University, Xi’an.
[4] Zhao, S.H., Huang, J.M., Liu, P. and Lv, C.M. (2014) Application of Inverted Pendulum Theory in the Upright and Self-Balancing Intelligent Vehicle System. Electronic Technology, 2, 45-47.
[5] Ruan, Y. and Chen, B.S. (2009) Control System of Electric Drives. 4th Edition, Mechanical Industry Press, Beijing.
[6] Yu, H.S., Ding, J.H., Pan, S.F. and Wu, H.R. (2009) Technology of Micro-Computer Control. 2nd Edition, Tsinghua University Press, Beijing.
[7] Ruan, X.G., Cai, J.M., Li, X.Y. and Zhao, J.W. (2012) Research and Design of Self-Balancing Two-Wheeled Robot. Science Press, Beijing.
[8] Geng, R. (2007) Computer Simulation of Adaptive Fuzzy PID Control System Based on MATLAB. In-formation Technology, 1, 43-46.
[9] Feng, Z.Y., Zeng, H., Zhang, L., Zhao, Y.X. and Huang, W. (2011) Angle Measurement Based on Gyroscope and Accelerometer Signal Fu-sion. Journal of Southwest China Normal University, 4, 36.

comments powered by Disqus

Copyright © 2020 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.