Mathematical Problems in Engineering

Volume 2011, Article ID 659685, 11 pages

http://dx.doi.org/10.1155/2011/659685

## A Flatness-Based Controller for the Stabilization of the Inverted Pendulum

^{1}CIC IPN, Avenida Juan de Dios Bátiz s/n, U.P.A.L.M, Col. San Pedro Zacatenco, A.P. 75476, Mèxico, D.F. 07738, Mexico^{2}CINVESTAV IPN, Avenida IPN 2508, Col. San Pedro Zacatenco, A.P. 14740, México, D.F. 07700, Mexico^{3}ESCOM IPN, Mèxico, D.F. 07738, Mexico

Received 2 September 2010; Accepted 30 December 2010

Academic Editor: Elbert Macau

Copyright © 2011 Carlos Aguilar-Ibáñez et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

We propose a flatness based approach for controlling the inverted pendulum cart system, under the assumption that the pendulum state is always located on a vicinity of its unstable equilibrium point. This is achieved by representing the original system, as a chain of integrators with an additive nonlinear state dependent perturbation. After discarding the small nonlinear perturbation, we may directly use design tools provided by the the flatness approach. The effectiveness and robustness of the obtained control law, which turned out to have a large domain of attraction, were numerically assessed in the context of stabilization and, also, for a reference oscillatory trajectory tracking task.

#### 1. Introduction

The inverted pendulum on a cart (IPC) is a mechanical device that consists of a free vertical rotating pendulum with its pivot point mounted on a cart moved by a horizontal input force. This device has been widely used as a challenging benchmark to test the performance of advanced control strategies (see [1, 2] and references therein). Since the pendulum angular acceleration cannot be controlled, the IPC is an example of an under-actuated system with two degrees of freedom. Under-actuated systems have been widely used in robotics, especially for developing suitable control strategies for a kind of robots known as the “acrobot” or the balancing mobile manipulator. The dynamics of the IPC device resembles that of the acrobot. Contrary to customary factory robots that are attached to the ground, these robots must move in unstructured environments. Consequently, these manipulators must accomplish a sustained vertical stability in a wide range of circumstances, which is by no means an easy task. It is well-known that many control techniques developed for fully-actuated systems cannot be used directly to stabilize the IPC device. For instance, the IPC is not input-output linearizable by means of static state feedback [3]. Also, the system controllability and other geometric properties are lost while the pendulum moves through the horizontal plane [4, 5]. On the other hand, the IPC is locally controllable around the unstable equilibrium point; so that it can be stabilized by means of a direct pole placement procedure [6].

In general, stabilizing an IPC presents two important difficulties. The first one deals with swinging up the pendulum from the hanging position to the upright vertical position. To overcome this problem, the pendulum is brought to a homoclinic orbit; then, once the system is close enough to the desired upright position, with a conveniently slow velocity, a simple change from a nonlinear to a linear controller, allows one to indefinitely keep the pendulum at the unstable position (see [7–14]). The second difficulty consists in stabilizing the IPC around its unstable equilibrium point, assuming that the pendulum is initially above the horizontal plane, or lies inside an open vicinity of zero, which defines the stability domain for the closed-loop system. This problem has been treated before in the literature. In [15], a nonlinear controller, based on the back-stepping procedure, is used to solve the stabilization problem around the unstable equilibrium point. The authors build an interconnected system by applying some nonlinear transformations, and then, by a recursively back-stepping, they derive a stabilizing controller that forces the angular position to converge toward the unstable position, while the position of the cart also tends to zero. In [16] a nonlinear controller forcing the angular position of the pendulum to zero is presented. However, this procedure does not guarantee convergence of the cart position to zero. This controller is based on nested saturation functions. In [7] a stabilization technique is proposed using a combination of switching and saturation functions, in addition to a stability enforcement via the Lyapunov method. The resulting closed-loop system possesses a quite large region of attraction (for almost all initial conditions). In [17], the authors present a control strategy based on the method of the controlled Lagrangian, in conjunction with some symmetry properties satisfied by the IPC. This strategy also ensures asymptotic stability of the origin for a rather large domain of attraction. A similar work, with similar tools, was presented in [18]. In [19] a semiglobal stabilization for the IPC is proposed by means of a fixed point controller. This controller is introduced assuming that the pendulum is initialized above the upper half plane. This technique consists of first putting the system in a cascade form. Fixed point equations for the control force are then obtained by applying the back-stepping procedure to develop a global control strategy allowing the stabilization of the pendulum around the upper position. The proposed scheme is based on the use of saturation functions. The resulting closed-loop system is asymptotically stable without switching to a stabilizing local controller. A similar work, using nested saturation function approach, is presented in [20]. In that work, the authors first write an approximate model of the IPC model as a chain of integrators, by using a convenient transformation. Then, they apply a nested saturation control technique to stabilize it.

Based on the approximate flatness property of the IPC system [21], we introduce a linear control law, in transformed coordinates, for approximately solving both the stabilization and the reference trajectory tracking problems, under the assumption that the pendulum is located inside a vicinity around its unstable equilibrium point. To this end, we first rewrite the original IPC model as if it were an integrator chain affected by a nonlinear perturbation. Then, using a reasonable approximation, we were able to use the tools provided by the flatness property to control the nonlinear system. The obtained control strategy turns out to have a larger domain of attraction than the one we obtained analytically. To test the effectiveness of our control strategy, some controlled maneuver tasks were performed via digital computer simulations.

The rest of this paper is organized as follows. In Section 2, we introduce the IPC model and through suitable state coordinate transformations we express the system as a perturbed chain of integrators. Section 3 is devoted to design the flatness based locally stabilizing controller for the IPC. In this section we present the estimation of the domain of attraction of the closed-loop system. Numerical simulations are included assessing the effectiveness of the proposed control strategy. Finally, the conclusions are presented in Section 4.

#### 2. The Inverted Pendulum Cart System

Consider the inverted pendulum mounted on a cart. This system is described by the set of normalized differential equations (see, e.g., Síra-Ramirez and Agrawal [6]) where is the normalized horizontal displacement of the cart, is the angular position of the pendulum with respect to the vertical, is the horizontal normalized force applied to the cart, and is a constant depending directly on the cart and the pendulum masses. Note that, for , and , the above system exhibits one unstable equilibrium point, defined by , , , , with being a constant.

*Motivation*

Since the IPC system is nonfeeback linearizable by means of static state feedback (see [3]), nor linearizable via dynamic state feedback, it is difficult to impose some controlled manoeuvres, like the tracking of an arbitrary reference trajectory. On the other hand, the linearized tangent model, around the unstable equilibrium point of (2.1), is indeed controllable [4], but with the inconvenience of having the nonlinear closed-loop system exhibit a small basin of attraction. To overcome this problem, we provide an approximate solution by considering of a nearly linear version of the original IPC system in conjunction with the use of the flatness approach. We tested the control performance in both the regulation and the reference trajectory tracking problems. We have obtained a significatively enlarged basin of attraction for the closed-loop system.

##### 2.1. Representing the IPC Model As an Approximate Chain of Integrators

To obtain a convenient IPC model, we first introduce the following transformations: which takes the system (2.1) into: where Notice that the transformations in (2.2) are well defined for all . Now, if the states and are available, then can be proposed to be Substituting the feedback law into the system equations (2.3), we obtain

*Comment 1. *It is important to emphasize that the previous IPC model is quasilinear and controllable inside of region defined by . This is due to the fact that, . Notice that the virtual controller acts directly on the coordinate . For details on the system (2.6) The reader is referred to (Olfati-Saber [19]).

#### 3. A Flatness-Based Pole Placement Approach for Stabilization of the IPC System

In this section, we develop some control strategies for controlling the under-actuated inverted pendulum by using flatness techniques. These techniques work well for any of the two transformed models of the IPC system, (2.3) and (2.6). Both mathematical models describe the behavior of this system, under the assumption that the pendulum moves in the upper half plane. Note that for achieving the control model (2.6), the whole state has to be available, while this condition is not necessary for the model (2.3).

##### 3.1. Upright IPC System Stabilization When the Entire State Is Available

The tangent linearized version of system (2.6), around the origin, is given by Evidently, this system is controllable and, hence, it is flat, with a flat output given by . It is easy to show that the system variables can be parameterized in terms of “” and a finite number of its time derivative, as follows Therefore, approximate reference trajectory tracking my be achieved by choosing , as follows: where is the flat output reference signal and the set of coefficients is chosen so that the characteristic polynomial of the closed-loop linearized system, given by is Hurwitz. Notice that the stabilization of the single IPC, around , can be equally achieved in a local manner by setting .

##### 3.2. Simulation Results

To show the effectiveness of the derived feedback controller, described by (2.2), (2.3), (2.5) and (3.3), when applied to the nonlinear normalized IPC model (2.1), we carried out some pertinent digital computer simulations.

###### 3.2.1. Regulation of the IPC around Its Unstable Position

The purpose of this simulation is to assess how large is the domain of attraction of our control strategy. The numerical experiment consisted of three simulation using the following set of hypothesized initial conditions, The closed-loop characteristic polynomial was chosen to be That is, , is implemented in the normalized coordinates, as which are well defined for all .

The numerical simulation results are shown in Figure 1. From this figure we can see that the proposed control strategy is capable of stabilizing the system, even when the initial conditions are selected far from the origin.

###### 3.2.2. Oscillating around the IPC Unstable Equilibrium Point

To show the effectiveness and robustness of the proposed control strategy, we performed a more challenging task, which consisted in making the system flat output oscillate around its unstable point. In other words, we designed a feedback law that makes the inverted pendulum to reach a periodic motion in a stable way. This is an interesting and challenging problem due to the fact that when periodic oscillations are present, we may have solutions that are not completely stable. That means that the inverted pendulum can reach stable orbits, while the cart position does not remain bounded. From the simulation results shown in Figure 2, we claim that our control strategy is quite robust, considering that the obtained transformed model is nearly linear. The initial conditions are fixed sustained far from the origin as (, , [rad], [rad/sec]). The gains of the controller was set as before, while the selected trajectory was defined to be, .

##### 3.3. A Conservative Estimation of the Domain of Attraction

In this section, we discuss the stability and robustness of the proposed flatness based controller (3.3), when acting in closed-loop with the transformed nonlinear IPC system (2.6). We emphasize that the proposed strategy exhibits a domain of attraction which is significantly large, when compared to the corresponding domains achieved by the majority of the approximate linear feedback control approaches. For simplicity, we only analyze the case when all the system states are available. We assume that the the desired, locally valid, closed-loop characteristic polynomial is given by . Under these assumptions, the closed-loop system can be rewriten as To have a good estimation of the domain of attraction, we use the following linear state transformation, , defined by The closed-loop system (3.8) is then expressed as where, .

Consider the following Lyapunov function candidate, , defined as:

The first order time derivative of , computed along the trajectories of (3.10), leads to: where is a symmetric matrix defined by : if then else . This matrix exhibits the following property: .

Notice that from the well-known inequality , valid for any positive real number , and the fact that, ; for all . Then, the following inequality is readily verified: After some algebraic manipulations and recalling that , we have that satisfies where is selected, such that the two first terms in the right hand side of inequality (3.14) are strictly negative. This can be assured whenever, . On the other hand, the fourth term in (3.14) is strictly negative provided . Let . Hence, , for all with . That is, any initial condition, , satisfying , guarantees that the closed-loop solution converges to the origin. On the other hand, the estimation of can be improved by using some iterative numerical method, such as the one suggested by Khalil in [22], which consists of finding a such that In our case, applying this method, the corresponding domain of attraction is found to be characterized by . Hence, the region of attraction of the closed-loop system can be estimated as

This result means, roughly speaking, that, for the initial conditions , , , the pendulum angular position can be initialized inside the sector . Finally, we must emphasize that the numerical estimation of is quite conservative. In actual applications, this value is found to be even larger, as it can be seen in Figure 1. From this figure, we can see that for initial conditions set sufficiently far from origin, say, rad, the proposed flatness based controller stabilizes the system state to origin. A better estimation of the stability domain is beyond the scope of this paper.

*Remark 3.1. *Even if we used a quadratic Lyapunov function to estimate the domain of attraction, we suspect that the system in (2.6) can be almost globally stabilized by using a linear controller, despite the fact that we were not able to prove it.

#### 4. Conclusions

In this work, we introduced a feedback control strategy for controlling the IPC system around its unstable equilibrium point. From the fact that the original system can be approximately expressed as a chain of integrators, we may use the differential flatness approach for deriving a suitable stabilizing controller. We propose a quasilinear controller when all the states are available. Some numerical simulations have been performed to evaluate the effectiveness of the proposed control strategies.

#### Acknowledgments

This research was supported by the Centro de Investigación en Computación of the Instituto Politecnico Nacional (CIC-IPN), by the Secretaría de Investigación y Posgrado of the Instituto Politecnico Nacional (SIP-IPN), under Research Grants 20100587 and 20101756 and by Conacyt Project No. 60877Y.

#### References

- K. Furuta and M. Iwase, “Swing-up time analysis of pendulum,”
*Bulletin of the Polish Academy of Sciences: Technical Sciences*, vol. 52, no. 3, pp. 153–163, 2004. View at Google Scholar · View at Scopus - K. Furuta, “Control of pendulum: from super mechano-system to human adaptive mechatronics,” in
*Proceedings of the 42nd IEEE Conference on Decision and Control*, pp. 1498–1507, December 2003. - B. Jakubczyk and W. Respondek, “On linearization of control systems,”
*L'Académie Polonaise des Sciences. Bulletin. Série des Sciences Mathématiques*, vol. 28, no. 9-10, pp. 517–522, 1980. View at Google Scholar - I. Fantoni and R. Lozano,
*Nonlinear Control for the Underactuacted Mecanical System*, Springer, London, UK, 2002. - D. Angeli, “Almost global stabilization of the inverted pendulum via continuous state feedback,”
*Automatica*, vol. 37, no. 7, pp. 1103–1108, 2001. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at Scopus - H. Síra-Ramirez and S. K. Agrawal,
*Differentially Flat Systems*, Marcel Dekker, New York, NY, USA, 2004. - M. W. Spong and L. Praly, “Control of underactuated mechanical systems using switching and saturation,” in
*Proceedings of the Block Island Workshop on Control Using Logic Based Switching*, Springer, 1996. - K. J. Aström and K. Furuta, “Swinging up a pendulum by energy control,”
*Automatica*, vol. 36, no. 2, pp. 287–295, 2000. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - C. C. Chung and J. Hauser, “Nonlinear control of a swinging pendulum,”
*Automatica*, vol. 36, pp. 287–295, 2000. View at Google Scholar · View at Scopus - Alexander L. Fradkov, “Swinging control of nonlinear oscillations,”
*International Journal of Control*, vol. 64, no. 6, pp. 1189–1202, 1996. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - R. Lozano, I. Fantoni, and D. J. Block, “Stabilization of the inverted pendulum around its homoclinic orbit,”
*Systems & Control Letters*, vol. 40, no. 3, pp. 197–204, 2000. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - M. W. Spong, “Energy based control of a class of underactuated mechanical systems,” in
*Proceedings of the World Congress of the International Federation of Automatic Control (IFAC '96)*, San Francisco, Calif, USA, 1996. - A. Shiriaev, A. Pogromsky, H. Ludvigsen, and O. Egeland, “On global properties of passivity-based control of an inverted pendulum,”
*International Journal of Robust and Nonlinear Control*, vol. 10, no. 4, pp. 283–300, 2000. View at Google Scholar - J. Araceli, F. Gordillo, and K. J. Astrom, “A family of pumping-damping smooth strategies for swinging up a pendulum,” in
*Proceedings of the 3rd IFAC Workshop on Lagrangian and Hamiltonian Methods for Nonlinear Control*, Negoya, Japan, 2006. - F. Mazenc and L. Praly, “Adding integrations, saturated controls, and stabilization for feedforward systems,”
*Institute of Electrical and Electronics Engineers. Transactions on Automatic Control*, vol. 41, no. 11, pp. 1559–1578, 1996. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - A. R. Teel, “A nonlinear small gain theorem for the analysis of control systems with saturation,”
*IEEE Transactions on Automatic Control*, vol. 41, no. 9, pp. 1256–1270, 1996. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - A. M. Bloch, D. E. Chang, N. E. Leonard, and J. E. Marsden, “Controlled Lagrangians and the stabilization of mechanical systems. II. Potential shaping,”
*IEEE Transactions on Automatic Control*, vol. 46, no. 10, pp. 1556–1571, 2001. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - D. E. Chang, A. M. Bloch, N. E. Leonard, J. E. Marsden, and C. A. Wollsey, “The equivalence of controlled Lagrangian and controlled Hamiltonian systems,”
*Control and the Calculus of Variations*, vol. 8, pp. 393–422, 2002. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - R. Olfati-Saber, “Fixed point controllers and stabilization of the cart-pole system and the rotating pendulum,” in
*Proceedings of the 38th IEEE Conference on Decision and Control (CDC '99)*, vol. 2, pp. 1174–1181, Phoenix, Ariz, USA, December 1999. - R. Lozano and D. Dimogianopoulos, “Stabilization of a chain of integrators with nonlinear perturbations: application to the inverted pendulum,” in
*Proceedings of the 42nd IEEE Conference on Decision and Control*, pp. 5191–5196, Maui, Hawaii, USA, December 2003. - M. Fliess, J. Lévine, P. Martin, and P. Rouchon, “Flatness and defect of non-linear systems: introductory theory and examples,”
*International Journal of Control*, vol. 61, no. 6, pp. 1327–1361, 1995. View at Publisher · View at Google Scholar · View at MathSciNet - H. K. Khalil,
*Non-Linear Systems*, Prentice Hall, Upper Saddle River, NJ, USA, 2nd edition, 1996.