<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JAMP</journal-id><journal-title-group><journal-title>Journal of Applied Mathematics and Physics</journal-title></journal-title-group><issn pub-type="epub">2327-4352</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jamp.2016.44069</article-id><article-id pub-id-type="publisher-id">JAMP-65446</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  Research on Double Cascade Control Algorithm for Self-Balancing Two-Wheeled Vehicle
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Qingqing</surname><given-names>Zhang</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>College of Electrical &amp;amp; Information Engineering, Southwest University for Nationalities, Chengdu, China</addr-line></aff><author-notes><corresp id="cor1">* E-mail:</corresp></author-notes><pub-date pub-type="epub"><day>13</day><month>04</month><year>2016</year></pub-date><volume>04</volume><issue>04</issue><fpage>618</fpage><lpage>622</lpage><history><date date-type="received"><day>7</day>	<month>December</month>	<year>2015</year></date><date date-type="rev-recd"><day>accepted</day>	<month>6</month>	<year>April</year>	</date><date date-type="accepted"><day>13</day>	<month>April</month>	<year>2016</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
   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. 
 
</p></abstract><kwd-group><kwd>Cascade Control</kwd><kwd> Kalman Filter</kwd><kwd> Fuzzy Control</kwd><kwd> PID Algorithm</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>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 [<xref ref-type="bibr" rid="scirp.65446-ref1">1</xref>]. The two-wheeled robot JOE developed by the Swiss federal university of technology is designed based on optimal control and state-feedback control [<xref ref-type="bibr" rid="scirp.65446-ref2">2</xref>]. The artificial neural network has been used to construct the adaptive controller for the self-balancing two-wheeled robot [<xref ref-type="bibr" rid="scirp.65446-ref3">3</xref>]. 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.</p></sec><sec id="s2"><title>2. Model Analysis</title><p>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.</p><p>The model of posture balance is similar to the one-level inverted pendulum [<xref ref-type="bibr" rid="scirp.65446-ref4">4</xref>]. 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 <xref ref-type="fig" rid="fig1">Figure 1</xref>.</p><p>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:</p><disp-formula id="scirp.65446-formula185"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x4.png"  xlink:type="simple"/></disp-formula><p>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:</p><disp-formula id="scirp.65446-formula186"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x5.png"  xlink:type="simple"/></disp-formula><p>The acceleration of the wheels is:</p><disp-formula id="scirp.65446-formula187"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x6.png"  xlink:type="simple"/></disp-formula><p>The θ is the obliquity of the inverted pendulum, θ’ is the angular velocity of inclination, k<sub>1</sub> and k<sub>2</sub> are the proportional coefficients.</p><p>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 [<xref ref-type="bibr" rid="scirp.65446-ref5">5</xref>]. It is possible to control the model remain upright if we can control the acceleration of the wheels as shown in Equation (3).</p></sec><sec id="s3"><title>3. Double Cascade Control</title><p>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 <xref ref-type="fig" rid="fig2">Figure 2</xref>. 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 [<xref ref-type="bibr" rid="scirp.65446-ref6">6</xref>], which makes the steering system faster and more flexible.</p><sec id="s3_1"><title>3.1. Speed-Balance Cascade Control</title><p>For the upright vehicles, the speed is proportional to the forwards inclination [<xref ref-type="bibr" rid="scirp.65446-ref7">7</xref>]. 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.</p></sec><sec id="s3_2"><title>3.2. Direction and Angular Velocity Cascade Control</title><p>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</p><fig id="fig1"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref></label><caption><title> Mechanical model of inverted pendulum</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/65446x7.png"/></fig><p>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 [<xref ref-type="bibr" rid="scirp.65446-ref8">8</xref>]. 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.</p></sec><sec id="s3_3"><title>3.3. The Angular Velocity Feedback without IMU Sensors</title><p>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 <xref ref-type="fig" rid="fig3">Figure 3</xref>.</p><p>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 V<sub>Left</sub> and V<sub>Right</sub>, it can be obtained that:</p><fig id="fig2"  position="float"><label><xref ref-type="fig" rid="fig2">Figure 2</xref></label><caption><title> Diagram of control structure</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/65446x8.png"/></fig><fig id="fig3"  position="float"><label><xref ref-type="fig" rid="fig3">Figure 3</xref></label><caption><title> Principle of angular velocity measurement</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/65446x9.png"/></fig><disp-formula id="scirp.65446-formula188"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x10.png"  xlink:type="simple"/></disp-formula><p>the numerator and denominator minus the right equation at the same time:</p><disp-formula id="scirp.65446-formula189"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x11.png"  xlink:type="simple"/></disp-formula><p>After simplification:</p><disp-formula id="scirp.65446-formula190"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/65446x12.png"  xlink:type="simple"/></disp-formula><p>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.</p></sec><sec id="s3_4"><title>3.4. The Fusion Filter of Gyroscope and Accelerometer</title><p>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 [<xref ref-type="bibr" rid="scirp.65446-ref9">9</xref>]. 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.</p></sec></sec><sec id="s4"><title>4. Conclusion</title><p>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.</p></sec><sec id="s5"><title>Acknowledgements</title><p>This work was financially supported by College Students’ innovation and entrepreneurship training plan of southwest University for Nationalities No. 201510656051.</p></sec><sec id="s6"><title>Cite this paper</title><p>Qingqing Zhang, (2016) Research on Double Cascade Control Algorithm for Self-Balancing Two-Wheeled Vehicle. Journal of Applied Mathematics and Physics,04,618-622. doi: 10.4236/jamp.2016.44069</p></sec></body><back><ref-list><title>References</title><ref id="scirp.65446-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Zhuo, Q., Huang, K.S. and Shao, B.B. (2007) Learn to Do Intelligent Vehicle—Challenge “Freescale” Cup. Beijing Aerospace University Press, Beijing.</mixed-citation></ref><ref id="scirp.65446-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">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.</mixed-citation></ref><ref id="scirp.65446-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">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.</mixed-citation></ref><ref id="scirp.65446-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">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</mixed-citation></ref><ref id="scirp.65446-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Ruan, Y. and Chen, B.S. (2009) Control System of Electric Drives. 4th Edition, Mechanical Industry Press, Beijing.</mixed-citation></ref><ref id="scirp.65446-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">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.</mixed-citation></ref><ref id="scirp.65446-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">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.</mixed-citation></ref><ref id="scirp.65446-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Geng, R. (2007) Computer Simulation of Adaptive Fuzzy PID Control System Based on MATLAB. In-formation Technology, 1, 43-46. http://lib.cqvip.com/qk/91788A/200701/24857256.html</mixed-citation></ref><ref id="scirp.65446-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">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</mixed-citation></ref></ref-list></back></article>