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 . The two-wheeled robot JOE developed by the Swiss federal university of technology is designed based on optimal control and state-feedback control . The artificial neural network has been used to construct the adaptive controller for the self-balancing two-wheeled robot . 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 . 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 . 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 , 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 . 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 . 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:
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 . 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.
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.
 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. http://lib.cqvip.com/qk/90274X/201402/48971826.html
 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. http://lib.cqvip.com/qk/93403X/201104/38873579.html