Sliding Mode Approach to Control Quadrotor Using Dynamic Inversion

The main objective of this book is to present important challenges and paradigms in the field of applied robust control design and implementation. Book contains a broad range of well worked out, recent application studies which include but are not limited to H-infinity, sliding mode, robust PID and fault tolerant based control systems. The contributions enrich the current state of the art, and encourage new applications of robust control techniques in various engineering and non-engineering systems.

yaw-pitch-roll of a helicopter, as well as the problem of coupled dynamics-kinematic underactuated system, can be solved by back-stepping (Kanellakopoulos, Kokotovic, and Morse 1991;Khalil 2002;Slotine and Li 1991). Dynamic inversion (Stevens and F. L. Lewis 2003;Slotine and Li 1991;A. Das et al. 2004) is effective in the control of both linear and nonlinear systems and involves an inner inversion loop (similar to feedback linearization) which results in tracking if the residual or internal dynamics is stable. Typical usage requires the selection of the output control variables so that the internal dynamics is guaranteed to be stable. This implies that the tracking control cannot always be guaranteed for the original outputs of interest. The application of dynamic inversion on UAV's and other flying vehicles such as missiles, fighter aircrafts etc. are proposed in several research works such as (Kim and Calise 1997;Prasad and Calise 1999;Calise et al. 1994) etc. It is also shown that the inclusion of dynamic neural network for estimating the dynamic inversion errors can improve the controller stability and tracking performance. Some other papers such as (Hovakimyan et al. 2001;Rysdyk and Calise 2005;Wise et al. 1999;Campos, F. L. Lewis, and Selmic 2000) etc. discuss the application of dynamic inversion on nonlinear systems to tackle the model and parametric uncertainties using neural nets. It is also shown that a reconfigurable control law can be designed for fighter aircrafts using neural net and dynamic inversion. Sometimes the inverse transformations required in dynamic inversion or feedback linearization are computed by neural network to reduce the inversion error by online learning. In this chapter we apply dynamic inversion to tackle the coupling in quadrotor dynamics which is in fact an underactuated system. Dynamic inversion is applied to the inner loop, which yields internal dynamics that are not necessarily stable. Instead of redesigning the output control variables to guarantee stability of the internal dynamics, we use a sliding mode approach to stabilize the internal dynamics. This yields a two-loop structured tracking controller with a dynamic inversion inner loop and an internal dynamics stabilization outer loop. But it is interesting to notice that unlike normal two loop structure, we designed an inner loop which controls and stabilizes altitude and attitude of the quadrotor and an outer loop which controls and stabilizes the position (x,y) of the quadrotor. This yields a new structure of the autopilot in contrast to the conventional loop linear or nonlinear autopilot. Section 2 of this chapter discusses the basic quadrotor dynamics which is used for control law formulation. Section 3 shows dynamic inversion of a nonlinear state-space model of a quadrotor. Sections 4 discuss the robust control method using sliding mode approach to stabilize the internal dynamics. In the final section, simulation results are shown to validate the control law discussed in this chapter. Fig. 1 shows a basic model of an unmanned quadrotor. The quadrotor has some basic advantage over the conventional helicopter. Given that the front and the rear motors rotate counter-clockwise while the other two rotate clockwise, gyroscopic effects and aerodynamic torques tend to cancel in trimmed flight. This four-rotor rotorcraft does not have a swashplate (P. Castillo, R. Lozano, and A. Dzul 2005). In fact it does not need any blade pitch control. The collective input (or throttle input) is the sum of the thrusts of each motor (see Fig. 1). Pitch movement is obtained by increasing (reducing) the speed of the rear motor while reducing (increasing) the speed of the front motor. The roll movement is obtained similarly using the lateral motors. The yaw movement is obtained by increasing (decreasing) www.intechopen.com the speed of the front and rear motors while decreasing (increasing) the speed of the lateral motors (Bouabdallah, Noth, and Siegwart 2004).

Fig. 1. A typical model of a quadrotor helicopter
In this section we will describe the basic state-space model of the quadrotor. The dynamics of the four rotors are relatively much faster than the main system and thus neglected in our case. The generalized coordinates of the rotorcraft are    (,,, ,, ) qx y z , where (,,) x y z represents the relative position of the center of mass of the quadrotor with respect to an inertial frame  , and   (,,) is the translational kinetic energy,    (1 / 2) T rot TI is the rotational kinetic energy with  as angular speed,  Um gz is the potential energy, z is the quadrotor altitude, I is the body inertia matrix, and g is the acceleration due to gravity. Then the full quadrotor dynamics is obtained as a function of the external generalized forces The principal control inputs are defined as follows. Define where u is the main thrust and defined by Thus the control distribution from the four actuator motors of the quadrotor is given by where l is the distance from the motors to the center of gravity,  i M is the torque produced by motor i M , and c is a constant known as force-to-moment scaling factor. So, if a required thrust and torque vector are given, one may solve for the rotor force using (10).

Partial feedback linearization for Quadrotor model
Dynamic inversion (Stevens and F. L. Lewis 2003) is an approach where a feedback linearization loop is applied to the tracking outputs of interest. The residual dynamics, not directly controlled, is known as the internal dynamics. If the internal dynamics are stable, dynamic inversion is successful. Typical usage requires the selection of the output control variables so that the internal dynamics is guaranteed to be stable. This means that tracking cannot always be guaranteed for the original outputs of interest.
In this chapter we apply dynamic inversion to the system given by (15) and (16)  which makes the dynamic inverse easy to find. Dynamic inversion now yields effectively an inner control loop that feedback linearizes the system from the control . Note that the output contains attitude parameters as well as altitude of the quadrotor. Note however that di y is not the desired system output. Moreover, dynamic inversion generates a specific internal dynamics, as detailed below, which may not always be stable. Therefore, a second outer loop is designed to generate the required values for xyz . An overall Lyapunov proof guarantees stability and performance. The following background is required. Consider a nonlinear system of the form where  m q uR is the control input and  n qR is state vector. The technique of designing the control input u using dynamic inversion involves two steps. First, one finds a state transformation  () zz q and an input transformation  (,) qq uu q v so that the nonlinear system dynamics is transformed into an equivalent linear time invariant dynamics of the form where   , nn nm aR bR are constant matrices with v is known as new input to the linear system. Secondly one can design v easily from the linear control theory approach such as pole placement etc. To get the desired linear equations (18), one has to differentiate outputs until input vector di u appears. The procedure is known as dynamic inversion.

Dynamic inversion for inner loop
The system, (15)→ (16) (15) and (16)  The number    8 r of differentiation required for an invertible di E is known as the relative degree of the system and generally   12 rn ; if  rn then full state feedback linearization is achieved if di E is invertible. Note that for multi-input multi-output system, if number of outputs is not equal to the number of inputs (under-actuated system), then di E becomes non-square and is difficult to obtain a feasible linearizing input di u . It is seen that for non-singularity of di E ,    0,9 0 . The relative degree of the system is calculated as 8 whereas the order of the system is 12 . So, the remaining dynamics  (4 ) which does not come out in the process of feedback linearization is known as internal dynamics. To guarantee the stability of the whole system, it is mandatory to guarantee the stability of the internal dynamics. In the next section we will discuss how to control the internal dynamics using a PID with a feed-forward acceleration outer loop. Now using (19) we can write the desired input to the system which yields where, This system is decoupled and linear. The auxiliary input di v is designed as described below.

Design of linear controller
Assuming the desired output to the system is where,  1 is a diagonal positive definite design parameter matrix. Common usage is to select  1 diagonal with positive entries. Then, (23) is a stable system so that 1 e is bounded as long as the controller guarantees that the filtered error 1 r is bounded. In fact it is easy to show (F. Lewis, Jagannathan, and Yesildirek 1999) Note that    11 1 0 ee defines a stable sliding mode surface. The function of the controller to be designed is to force the system onto this surface by making 1 r small. The parameter  1 is selected for a desired sliding mode response We now focus on designing a controller to keep 1 r small. From (23), Adding an integrator to the linear controller given in (22), and now we can rewrite (22) (20) and (27)  Note that  0 R is also a diagonal matrix.

Sliding mode control for internal dynamics
The internal dynamics (Slotine and Li 1991) for the feedback linearizes system given by For the stability of the whole system as well as for the tracking purposes, , xy should be bounded and controlled in a desired way. Note that the altitude z of the rotorcraft a any given time t is controlled by (20)

Controller structure and stability analysis
The overall control system has two loops and is depicted in Fig. 2 (15) and (16) with a control law shown in Fig. 2. and  given by (20), (27), (42) , (43) . Then, the tracking errors 1 r and 2 r and thereby 1 e and 2 e are UUB if (53) and (54) (37), whcih in fact a simpler version of (31),(32). But we belive, for designing autopilot for quadrotor, the proposed mehtod discussed in this chapter can be used without loss of any genreality.

Rotorcraft parameters
Simulation for a typical quadrotor is performed using the following parameters (SI unit): www.intechopen.com It can be seen that the tracking is almost perfect as well as the tracking errors are significantly small. Figure 5 describes the attitude of the quadrotor   , along with their demands   , dd and attitude errors in radian. Again the angles match their command values nearly perfectly. Figure 6 describes the control input requirement which is very much realizable. Note that as described before the control requirement for yaw angle is    0 and it is seen from Fig. 6. values. Fig. 8 shows that the change in x does not make any influence on  . The corresponding control inputs are also shown in Fig. 9 and due to the full decoupling effect it is seen that   is almost zero.
The similar type of simulations are performed for y and z directional motions separately and similar plots are obtained showing excellent tracking. The simulation is performed to verify its robustness properties against unmodeled input disturbances. For this case we simulate the dynamics with high frequency disturbance 0.1* sin(5 ) (1% of maximum magnitude of force) for force channel and 0.01sin(5 ) (~15% of maximum angular acceleration) for torque channel.  From Fig 10 and Fig 11, it is also seen that the position errors are bounded and small. Fig. 12 shows the bounded variation of control inputs in presence of disturbance. Similar tracking performance is obtained for other commanded motion.

Conclusion
Sliding mode approach using input-output linearization to design nonlinear controller for a quadrotor dynamics is discussed in this Chapter. Using this approach, an intuitively structured controller was derived that has an outer sliding mode control loop and an inner feedback linearizing control loop. The dynamics of a quadrotor are a simplified form of helicopter dynamics that exhibits the basic problems including under-actuation, strong coupling, multi-input/multi-output. The derived controller is capable of deal with such problems simultaneously and satisfactorily. As the quadrotor model discuss in this Chapter is similar to a full scale unmanned helicopter model, the same control configuration derived for quadrotor is also applicable for a helicopter model. The simulation results are presented to demonstrate the validity of the control law discussed in the Chapter.

Acknowledgement
This work was supported by the National Science Foundation ECS-0801330, the Army Research Office W91NF-05-1-0314 and the Air Force Office of Scientific Research FA9550-09-1-0278.