ALTERNATIVE CONTROLLER DESIGN FOR ROTARY INVERTED PENDULUM

The inverted pendulum has been considered a classical control problem. Two designs of inverted pendulum are planar and rotary with a nonlinear unstable system characteristic. Inverted pendulum systems are nonlinear. They can be used for testing and studying various observers and controllers. Control of a rotary inverted pendulum is studied here. This paper proposes stabilization of the rotary inverted pendulum at its upright position by using full-state controller. Full-state controllers are designed by using different damping ratios. MATLAB simulation results and the experimental results are taken for 10 degrees step for 5 seconds. The best controller is chosen for SRV02-Rotary inverted pendulum by looking at the simulation and experimental results.


INTRODUCTION
Inverted pendulum systems are treated as underactuated mechanical systems.Different control algorithms are applied for solving swing-up control and stabilization problem.The equations of motion are nonlinear.This makes the inverted pendulum problem one of the favorite topics for control problem.Therefore, they can be linearized at an operating point to carry out proper solution.
Many studies are found in the area of control issues related to inverted pendulum systems.Some of the studies dealing with inverted pendulum control are summarized herein.Yan [1] developed a tracking control law for underactuated RIP by applying nonlinear back stepping, differential flatness, and small gain theorem.Mirsaeid and Zarei [2] presented a mechatronic system case study on adaptive modeling and control of an inverted pendulum.Hassanzadeh et al. [3] presented an optimum Input-Output Feedback Linearization (IOFL) cascade controller.Genetic Algorithm (GA) was applied for the inner loop with PD controller forming the outer loop for balancing the pendulum in an inverted position.The control criterion was to minimize the Integral Absolute Error (IAE) of the system angles.The optimal controller parameters are found by minimizing the objective function related to IAE using Binary Genetic Algorithm (BGA).Ozbek and Efe [4] focused on the swing up and stabilization control of a rotary inverted pendulum (RIP) system with linear quadratic regulator (LQR).Sliding Mode Control (SMC) is based on hard boundary switching law and fuzzy logic control (FLC).Akhtaruzzaman et al. [5] have described different controller designs for rotary pendulum.Experimental and MATLAB based simulation results are given.Hassanzadeh et al. [6] also studied control by using evolutionary approaches.GA, Particle Swarm Optimization (PSO) and Ant Colony Optimization (ACO) are used for designing the rotational inverted pendulum.Quyen et al. [7] presented the dynamic model of RIP.ANN controller is used for controlling the system.Jadlovska and Sarnovsky [8] have revealed an approach for the control of the rotary single inverted pendulum system.State feedback control techniques are used as pole placement and the LQR optimal control.Mathew et al. [9] performed a study on swing up and stabilization control of a RIP system.Two control schemes are performed for stabilization as LQR and SMC.Chen and Huang [10] have proposed an adaptive controller for RIP with time-varying uncertainties to bring the pendulum close to the upright position regardless of the various uncertainties and disturbances.Its underactuated dynamics was first decoupled by Olfati's transformation into a cascade form.Oltean [11] has proposed solution for swing up and stabilization of RIP using PD and fuzzy PD controllers.The models are performed in MATLAB/ Simulink environment.Ding and Li [12] have proposed a cascade fuzzy controller based on Mamdani for the outer loop and Sugeno for the inner loop.The simulation graphs are performed with Simulink.Dang et al. [13] have designed a robust Takagi-Sugeno (T-S) fuzzy descriptor approach for a stabilizing controller for the RIP with real-time implementation.Chandran et al. [14] derived the nonlinear dynamics of the RIP.Artificial neural network (ANN) is applied to identify the model.
This study presents nonlinear and linearized model of the RIP.Four full-state controllers are designed by using MATLAB for the system stabilizing for linear dynamic model.The results of four controllers are compared.The best controller is chosen for SRV02.

ROTARY INVERTED PENDULUM
The experimental setup is in downright position, which is unstable.It consists of PC (1), data acquisition system (2), rotary inverted pendulum (3), and amplifier (4), shown in Fig. 1.The expected upright position of the pendulum after applying controller is shown in Fig. 2.
Fig. 3 presents the rotary inverted pendulum's schematic representation in x-y-z coordinates.The rotary arm pivot is attached to the SRV02 system.The pendulum is connected to the end of the arm by using a revolute joint.The arm length, the arm angle, the pendulum length, and the pendulum angle are denoted by L r , θ, L p , and α, respectively.The arm has a mass of m r , and the pendulum has m p .The mass moment of inertia for the arm and the pendulum are J r and J p , respectively.Parameters of the SRV02 motor and the rotary inverted pendulum are given with their values and units in Tab. 1.These parameters are then used while performing simulation from the mathematical model of the system [15].

MATHEMATICAL MODEL OF THE RIP
The dynamic model of the rotary inverted pendulum is derived by using the Lagrangian (L = T − V) based on energy expressions with respect to variables [16,17].Independent generalized coordinates for this problem are α and θ.T is the sum of the rotary arm kinetic energy Tarm and the pendulum's kinetic energy T pend is given in Eq. ( 1).V is the sum of the rotary inverted pendulum potential energy, which includes only pendulum's potential energy, it is given in Eq. (2).
To attain velocity of the center of the pendulum, the coordinates of the center of mass of the pendulum are determined in Eq. (3) to Eq. ( 5).By taking derivatives of the positions, the velocity of point P is found.Lagrange equation becomes as Eq. ( 6).
The system dynamic model is resulted in Eq. ( 7) and Eq. ( 8).Here τ is the applied torque, B r is the viscous friction coefficient of the torque, and B p is the viscous damping coefficient of the pendulum.Torque based on the rotary arm is generated by a servo motor.It is defined in Eq. ( 9) where η g , η m , K g , R m , k t and V m are the efficiency of gear, the efficiency of motor, the gear ratio, the motor armature resistance, the motor current, the torque constant and the input motor voltage, respectively [16, ( ) For a generalized coordinate, vector q, can be generalized into the matrix form as Eq.(10) in which D is the inertial matrix, C is the damping matrix and g(q) is the gravitational vector.
( ) ( ) ( ) q q q q,q q Eq. ( 7) and Eq. ( 8) are nonlinear equations.They are to be linearized at the zero initial conditions as
The resultant mathematical model of the inverted pendulum is defined as matrix form in Eq. ( 11).
The equation for the angular acceleration of arm , θ  and the angular acceleration of pendulum α  should be determined by using Eq.(11).The equations can be simplified by defining a constant gain G in Eq. ( 12).
( ) The rotary inverted pendulum has two coordinates for description.Two second order equations; thus it has four state variables where: X 1 = θ, X 2 = α, X 3 = θ  and X 4 = .
α  The general state space equations are given in Eq. ( 13) [15] where; A is the state matrix that gives information about characteristic of the system; B is the input-to-state matrix; C is the state-to-output matrix; and D is the feed through matrix.

DESIGN OF A CONTROLLER -POLE PLACEMENT
A linear dynamic system in the state space form is given in Eq. ( 13) where; D = 0. To stabilize the system to improve its response, full state feedback is u = −Kx.The closed loop system is given in Eq. ( 14).The main purpose of the state feedback control is to stabilize the system.Thus, all closed loop poles should be located in the left-hand of the complex plane.

The System Poles
The system poles give information on the system characteristic.Tab. 2 shows the state-space representation matrices of the system.To define the poles of the system det(SI − A) = 0 is estimated.The poles of the system are found as: p 1 = 0, p 2 = −32.39,p 3 = 7.32 and p 4 = −5.15.
The system was expected to be unstable because when the inverted pendulum is kept in an upright position, a small perturbation will remove the inverted pendulum from the stable position.The inverted pendulum will not return back to the upright position.The system is not stable since one of the poles is in the right-hand plane.The pole or poles which are located in the right-hand plane should be transferred in the left-hand plane to provide the stability of the system [11].

The Desired Poles
There are four eigenvalues of the system.Two of them are specified as follows: p 1 = −δw n + jw d and p 2 = −δw n − jw d .They are the complex conjugate dominant poles, where δ is the damping ratio, w n is the natural frequency, and the other poles p 3 and p 4 are defined at −30 and −40, as shown in Fig. 4.  The natural frequency is taken w n = 4 rad/s [15], and four values of damping ratios are used.The desired poles are found according to the damping ratios introduced.The required systems are given with their poles in Tab. 3.

Full-State Controller Coefficient -Pole Placement
The controllability of the system should be checked to decide whether the system can be controlled by full-state controller or not.If A and B matrices of the state-space model are controllable, the system can be controlled by the pole placement method with full-state control gains.The controllability matrix of the system is determined by M = [B AB A 2 B … A n B] and the rank of M is four.The system is controllable with 4 states.
The general equation form of the open loop characteristic equation is given in Eq. ( 15) and companion matrices of A and B should be estimated in z-plane.They can be denoted by A z and B z as given in Eq. ( 16) and the controllability matrix of the companion s a s a s a s a Control gain in z-plane, K z , should be computed to assign the poles of A z − B z K z to required places.The closed loop equation form for desired poles is given in Eq. ( 17) and K z = [K z1 K z2 K z3 K z4 ].Calculations are given in Eq. (18).
The transformation matrix, Z should be calculated by multiplication of controllability and inverse controllability of the companion, Z = M• 1 z M − .Finally, the control gain from z-plane should be transformed to actual plane control gain.
The system poles are located in the desired poles by estimating the control gain, K , where K is the control gain.Four controllers are designed using different damping ratios.The control gains for using ratios are given in Tab. 4.

THEORETICAL AND EXPERIMENTAL RESULTS
The system Simulink model and the system real model are created in MATLAB/Simulink program.The block diagram of the simulation model is presented in Fig. 5.
Then the encoders are read in the plant block by using Simulink Real-Time TM .It is given as the real system block diagram in Fig. 6.A step input of 10 degrees for the angular position of arm is applied for 5 seconds.The arm positions and the pendulum positions are taken and presented for all controllers in Fig. 7 and Fig. 8.A comparison is made between them.All designed controllers stabilize the pendulum at its up-right position.It shows that the system is quite stable for all controllers.The 3 rd and 4 th controllers have given better responses.The fastest response, minimum overshoot and the steady state errors are seen.10 degrees of a step input is applied to the arm of the rotary inverted pendulum for 5 seconds.The experimental results are taken by encoders which can read the arm and the pendulum positions of the system.Fig. 9 and Fig. 10 show actual positions of the arm and the pendulum.
The 4 th controller is given the best system to hold the pendulum at its up-right position.Finally, it can be said that δ = 0.85 of damping ratio with w n = 4 rad/s of the natural frequency is better to use for the SRV02 rotary inverted pendulum system.

CONCLUSIONS
Inverted pendulum system has a great role in real application of engineering fields.Thus, companies in industry and researches have studied the inverted pendulum.In this study, the SRV02 rotary inverted pendulum is studied with controllers which have different damping ratios.Experiments have been performed in Mechatronics Laboratory, Turkish Aeronautical Association University Mechatronics Engineering Department.Having dynamic models of the rotary inverted pendulum, four controllers are designed.δ = 0.8 and δ = 0.85 of damping ratios show better responses than the other controllers.The experimental results for 5 seconds with a 10-degree step input are obtained for all designed controllers.The 4 th controller which has δ = 0.85 of damping ratio with w n = 4 rad/s is the best controller.The pendulum is held at upright position.

Figure 1 Figure 2 Figure 3
Figure 1 Experimental setup in downright position

Figure 4
Figure 4 Desired poles in complex plane

Figure 5 Figure 6
Figure 5 The system simulation block diagram

Figure 7 Figure 8 Figure 9 Figure 10
Figure 7 Simulation results of the arm angular position θ

Table 2
State-Space matrix equations and their results

Table 3
Desired poles for different damping ratios

Table 4
Controllers for different damping ratios