scieee AI-readable full text Open interactive document viewer

Nonlinear model predictive control with constraint satisfactions for a quadcopter

Wang, Ye,Ramírez Jaime, Andrés Felipe,Xu, Feng,Puig Cayuela, Vicenç

Abstract

This paper presents a nonlinear model predictive control (NMPC) strategy combined with constraint satisfactions for a quadcopter. The full dynamics of the quadcopter describing the attitude and position are nonlinear, which are quite sensitive to changes of inputs and disturbances. By means of constraint satisfactions, partial nonlinearities and modeling errors of the control-oriented model of full dynamics can be transformed into the inequality constraints. Subsequently, the quadcopter can be controlled by an NMPC controller with the updated constraints generated by constraint satisfactions. Finally, the simulation results applied to a quadcopter simulator are provided to show the e ectiveness of he proposed strategy.

Full text

Nonlinear Model Predictive Control with Constraint Satisfactions for a Quadcopter Ye Wang1, Andres Ramirez-Jaime2, Feng Xu3and Vicen¸c Puig1 1Advanced Control Systems (SAC) Research Group at Institut de Rob`otica i Inform`atica Industrial, CSIC-UPC, Universitat Polit`ecnica de Catalunya-BarcelonaTech (UPC), C/. Llorens i Artigas 4-6, 08028 Barcelona, Spain 2Departamento de Ingenier´ıa El´ectrica y Electr´onica, Universidad de los Andes, Carrera 1, No. 18A-10, Colombia 3Center of Intelligent Control and Telescience, Graduate School at Shenzhen, Tsinghua University, 518055 Shenzhen, P.R. China E-mail: [email protected], [email protected], [email protected], [email protected] Abstract. This paper presents a nonlinear model predictive control (NMPC) strategy combined with constraint satisfactions for a quadcopter. The full dynamics of the quadcopter describing the attitude and position are nonlinear, which are quite sensitive to changes of inputs and disturbances. By means of constraint satisfactions, partial nonlinearities and modeling errors of the control-oriented model of full dynamics can be transformed into the inequality constraints. Subsequently, the quadcopter can be controlled by an NMPC controller with the updated constraints generated by constraint satisfactions. Finally, the simulation results applied to a quadcopter simulator are provided to show the effectiveness of the proposed strategy. 1. Introduction The quadcopter has become one of the most popular unmanned aerial vehicles (UAVs), which attracts considerable attention in both academia and industry. Due to its simple structure and flexible flight ability, the quadcopter is playing a significant role in applications such as video surveillance, agricultural service, mapping, goods delivery and other military applications [1, 2, 3]. The motion of a quadcopter relies on the rotation of four propellers to generate thrusts and to control its attitude and position. In general, a simultaneous increasing/decreasing of angular speed of four propellers will make the quadcopter fly upward/downward. When keeping the vertical component of total thrust from four propellers equal to the gravity of quadcopter, the quadcopter can be controlled to fly forward/backward or /leftward/rightward by increasing the angular speed of one propeller and simultaneous decreasing the angular speed of the propeller on its centrosymmetric position, respectively. Additionally, simultaneous increasing the speed of one pair of propellers centrosymmetric to each other and decreasing the speed of the other pair can control the quadcopter to rotate in horizontal plane. However, due to the nonlinear dynamics and high degrees of couplings between different control channels, to achieve high-performance control of quadcopter is still an issue full of challenges. The control problem of quadcopter has been widely investigated by using a variety of approaches such as proportional-integral-derivative (PID) control, backstepping control, feedback linearization, linear quadratic regulator and model predictive control (MPC). In [4, 5, 6], the PID control was used to control the quadcopter with the objective of achieving robustness and fault tolerance. The application of backstepping control and feedback linearization to the quadcopter could be found in [7, 8, 9, 10]. Related to the topic of the current paper, we can also find MPC control of quadcopter in [2, 11, 12], where a common feature of these works is that they are based on the linear MPC techniques. Commonly, the quadcopter is normally considered as a system with high nonlinearities and fast dynamics. Although it is possible to achieve some control objectives by using a linearized model or a group of linearized models to approximate the nonlinear dynamics of quadcopter, we have to face a degree of performance degradation. Motivated by this point, we propose to directly use the nonlinear MPC technique to control the quadcopter. In this case, we can not only simultaneously obtain better performance but also make use of the inherent capability of MPC, i.e., explicit constraint handling, which is very helpful to deal with the constraints on states, inputs and outputs. Additionally, turning to the constraint-handling capability, MPC is quite convenient to be used for tolerance of faults in actuators (i.e., motors of quadcopter) by adjusting its input constraints, which is also of vital important interest of many works [13, 14]. The main contribution of this paper is to present a nonlinear MPC (NMPC) strategy combined with constraint satisfactions for a quadcopter. Paritial nonlinear constraints and modeling errors are updated through the procedure of constraint satisfactions. Then, the NMPC strategy is implemented by solving a nonlinear optimization problem through the nonlinear programming technique. As a result, simulation results by applying the proposed NMPC strategy to a quadcopter simulator implemented in MATLAB environment are shown in order to verify the effectiveness of the proposed MPC strategy. Besides, comparison results show the performance of the proposed MPC strategy. The remainder of this paper is organized as follows: The nonlinear dynamics and controloriented model of the quadcopter are briefly introduced in Section 2. The constraint satisfaction for the quadcopter control is addressed in Section 3. In Section 4, the NMPC design for the quadcopter is presented. The simulation results as well as comparisons results with different uncertain cases based on a quadcopter simulator are shown in Section 5. Finally, some conclusions are written in Section 6. 2. Nonlinear Dynamics of the Quadcopter 2.1. Quadcopter Dynamic Description The motion of the quadcopter is generated by the lift forces produced by the rotating propeller blades, where the translations and rotations are realized by manipulating the difference between velocities of four rotors. The quadcopter has 6 degrees of freedom (attitude and position) according to the earth-fixed frame. The position of this helicopter is described by the position vector [x, y, z]Tand its attitude is defined by three Euler angles (pitch, roll and yaw) as [φ, θ, ψ]T, where these three angles are assumed to satisfy the following constraints [15]: −π 2≤φ≤π 2,(1a) −π 2≤θ≤π 2,(1b) −π≤ψ≤π. (1c) Consider the earth-fixed frame as inertial frame and body-fixed frame with the origin in the mass center of the quadcopter. It is further assumed that the body of quadcopter is rigid and symmetric. The dynamics of the quadcopter can be characterized by a set of continuous-time differential equations as follows [2]: ¨ φ=˙ θ˙ ψa1+˙ θa2Ωr+b1U2,(2a) ¨ θ=˙ φ˙ ψa3−˙ φa4Ωr+b2U3,(2b) ¨ ψ=˙ φ˙ θa5+b3U4,(2c) ¨z=−g+ (cosφcosθ)U1/m, (2d) ¨x= (cosφsinθcosψ+ sinφsinψ)U1/m, (2e) ¨y= (cosφsinθsinψ−sinφcosψ)U1/m, (2f) with       U1 U2 U3 U4 Ωr       =       bΩ2 1+ Ω2 2+ Ω2 3+ Ω2 4 bΩ2 2−Ω2 4 b−Ω2 1+ Ω2 3 d−Ω2 1+ Ω2 2−Ω2 3+ Ω2 4 −Ω1+ Ω2−Ω3+ Ω4       (3) and the parameters of the quadcopter are defined as a1=Iyy −Izz Ixx , a2=Jr Ixx , a3=Izz −Ixx Iyy , a4=Jr Iyy , a5=Ixx −Iyy Izz , b1=` Ixx , b2=` Iyy , b3=1 Izz . where Ω1, Ω2, Ω3and Ω4denote the speeds of four rotors, respectively, Ixx,Iyy and Izz are the moments of inertial of the quadcopter around three body axes, respectively, Jris the propeller rotational moment of inertia, `denotes the arm length of the quadcopter, band drepresent thrust and drag coefficients. Besides, the constraints on the rotor angular speeds can be formulated by 0≤Ωi≤Ωmax i, i = 1,2,...,4,(4) where Ωmax idenotes the maximum angular speed of the i-th rotor. It is noticed that the dynamic model in (2) for designing the MPC controller is a simplified one, where some modeling errors are ignored, such as the wind resistances. In the simulation, the uncertain simulator model including some modeling errors will be used. 2.2. Control-oriented Model of the Quadcopter Considering the dynamic equations of the quadcopter in (2), the variables of system states and inputs are chosen as x,hφ˙ φ θ ˙ θ ψ ˙ ψ z ˙z x ˙x y ˙yiT,(5a) u,[Ω1Ω2Ω3Ω4]T.(5b) Then, by means of the Euler discretization method, the discrete-time control-oriented model of the quadcopter can be generally formulated as x(k+ 1) = F(x(k),u(k)) + w(k),(6a) y(k) = G(x(k)) + v(k),(6b) where x(k) and u(k) denote vectors of system states and inputs defined in (5) at time instant k, respectively. F(·) denotes the nonlinear mapping function describing the system dynamics in (2) and (3). G(·) represents the measurement function based on the characteristics of the available sensors. Besides, w(k) and v(k) denote the vectors of the system disturbances of modeling errors and the measurement noise of sensors at time instant k, respectively. The quadcopter operates under some constraints, which can be written as follows: xmin ≤x(k)≤xmax,(7) 0≤u(k)≤umax,(8) where xmin denotes the vector of minimum values of the system states, xmax and umax denote vectors of maximum values of system states and inputs. 2.3. Partial Nonlinearity Embeddings Depending on (3), it is clear that the selected input of the quadcopter Ωiis hidden in [U1, U2, U3, U4,Ωr]T. Hence, the virtual inputs of the quadcopter are chosen as e u,[U1, U2, U3, U4,Ωr]T.(9) Therefore, the nominal and uncertain control-oriented model of the quadcopter (6) can be reformulated with the virtual inputs as x(k+ 1) = F(x(k),e u(k)) + w(k),(10a) y(k) = G(x(k)) + v(k).(10b) 3. Constraint Satisfactions for the Quadcopter Control In this section, the constraint-satisfaction approach is used to find the suitable bounds of the defined virtual inputs (9) in order to guarantee the consistency (3). The utilized constraintsatisfaction approach relies on an interval-based method, which has been popularly applied in the robotics [16]. The interval-based constraint-satisfaction approach can be implemented by a procedure of the forward and backward propagations to refine the value range from wide intervals to short ones including eliminating the impossible values violated from some defined equality and inequality constraints. 3.1. Constraint-Satisfaction Approach As introduced in [16], a constraint-satisfaction approach on sets can be formulated as a 3-tuple H= (Z,D,C), where • Z ={z1, z2,· · · , zn}is a finite set of variables. • D ={D1,D2,· · · ,Dn}is the set of domains of the variables. • C ={c1, c2,· · · , cn}is a finite set of constraints, where each constraint ciis specified by the pair (Zi,Ri), in which Zi, that is called as the constraint scope, is a subset of Zand Ri, that is called as constraint relation, is a relation indicating the allowed combination of values for the variables belonging to Zi. The contractors are the useful tools for solving the constraint-satisfaction problem [16], [17]. Solving a constraint-satisfaction problem consists in finding all variable assignments such that all constraints are satisfied. The variable value assignment (ˆz1,ˆz2,· · · ,ˆzn)∈ D is a solution of Hif all constraints in Care satisfied. The set of all solution points of His called the global solution set and denoted by S(H). The variable zi∈ Z is consistent in Hif and only if ∀ˆzi∈ Di, ∃(ˆz1∈ D1,· · · ,ˆzn∈ Dn) such that (ˆzi,· · · ,ˆzn)∈ S(H). The solution of a constraint-satisfaction problem is said to be globally consistent if and only if every variable is consistent. A variable is locally consistent if and only if it is consistent with respect to all directly connected constraints. Thus, the solution of the constraint-satisfaction problem is said to be locally consistent if all variables are locally consistent. An algorithm for finding an approximation of the solution set of a constraint-satisfaction problem can be found in [16]. 3.2. Constraint Satisfactions for the Quadcopter Control As aforementioned, partial nonlinearities in (3) are embedded into the control-oriented model of the quadcopter. Therefore, u(k) is replaced by e u(k) in (9). The constraints on u(k) and Equation (3) are transformed into the new constraints on e u(k). The constraint-satisfaction approach for the quadcopter control along the MPC prediction horizon Hpis implemented by using the following algorithm. Algorithm 1 Constraint Satisfaction applied to the Quadcopter 1: for k:= 1 to Hpdo 2: Xk⇐[0,xmax] 3: Uk−1⇐[0,umax] 4: e Uk−1⇐[0,e umax] 5: end for 6: V ⇐ X z }| { x(1),x(2), . . . x(Hp), U z }| { u(0),u(1),...,u(Hp−1), e U z }| { e u(0),e u(1),...,e u(Hp−1) 7: D ⇐ X1,X2,...,XHp,U0,U1,...,UHp −1,e U0,e U1,..., e UHp −1 8: C ⇐ Equation (3) 9: H ⇐ V,D,C 10: S=solve(H) 11: Implement the new constraint Sinto the MPC optimization problem. 4. Nonlinear Model Predictive Control of the Quadcopter 4.1. Closed-loop NMPC Scheme The closed-loop NMPC scheme is shown in Figure 1. The constraint-satisfaction approach presented in Algorithm 1 is solved off-line and the updated constraints can be found. A path planner is usually required to generate a reference trajectory in order to let the quadcopter track it, where the reference trajectory contains not only the position vector [x, y, z]Tbut also the attitude of the quadcopter ψ. In this paper, the NMPC controller is divided into two layers: In the upper layer, a nonlinear optimization problem is proposed in order to control the quadcopter to track the given references generated by the path planner and subsequently the virtual inputs e u(k) can be obtained. In the lower layer, the actual input can be computed by solving a set of algebraic equations. Besides, when there are no enough sensors available in the quadcopter to feedback the values of the system states, an observer for the quadcopter is also required, for instance, the zonotopic extended Kalman filter proposed in [18]. Finally, a quadcopter simulator is used to test the effectiveness of the proposed NMPC controller. 4.2. The Upper Level: Nonlinear Optimization Problem The MPC prediction model of the quadcopter is chosen by the nominal model of (10) without considering system disturbances and measurement noise. The constraints on system states x(k), NMPC Controller Quadcopter r(k)Ω(k)y(k) w(k) CSP Sk Path Planner Upper Level: Optimization Lower Level: Algebraic e u(k) Dk Simulator Observer ˆ x(k) v(k) Figure 1. The closed-loop simulation scheme of the NMPC strategy with constraint satisfactions for the quadcopter the virtual inputs e u(k) at time instant kcan be denoted as 0≤x(k+i|k)≤xmax, i = 1,2, . . . , Hp,(11a) 0≤e u(k+j|k)≤e umax, j = 0,1, . . . , Hp−1.(11b) The control objective of the quadcopter is mainly towards controlling the quadcopter to track the given position references and attitude references both generated by the path planner. Therefore, the cost function for the NMPC controller mainly includes two parts: a tracking part of the minimization of the deviations between x,y,zand ψwith their references xr,yr,zrand ψrand a smoothness part with the minimization of the slew rate of the virtual inputs, which can be defined as L(x,e u), Hp X i=1 λx`x(x9(k+i|k), xr(k+i)) +λy`y(x11(k+i|k), yr(k+i)) +λz`z(x7(k+i|k), zr(k+i)) +λψ`ψ(x5(k+i|k), ψr(k+i))  + Hp−1 X j=0 λ∆u`∆u(e u(k+j|k)) ,(12) with `x(x9(k+i|k)) = kx9(k+i|k)−xr(k+i)k2,(13a) `y(x11(k+i|k)) = kx11(k+i|k)−yr(k+i)k2,(13b) `z(x7(k+i|k)) = kx7(k+i|k)−zr(k+i)k2,(13c) `ψ(x5(k+i|k)) = kx5(k+i|k)−ψr(k+i)k2,(13d) and `∆u(e u(k+j|k)) = k∆e u(k+j|k)k2,(14a) ∆e u(k+j|k) = e u(k+j|k)−e u(k+j−1|k),(14b) where λx,λy,λz,λψand λ∆udenote the weights for each objective and k·k2denotes the 2-norm operator. The selected observer, here the zonotopic extended Kalman filter in [18], can be written as ˆ x(k) = χ(y(k)),(15) where ˆ x(k) denotes the estimated full states at time instant kand χ(·) represents the modelbased observer function based on the model of the quadcopter in (2). In general, the NMPC strategy in the upper layer can be implemented by solving the following nonlinear optimization problem Pq(k): Problem 1 (NMPC-Quadcopter Problem) min e u∗(k|k),...,e u∗(k+Hp−1|k)L(x,e u),(16a) subject to x(k+i+ 1 |k) = F(x(k+i|k),e u(k|k)),(16b) 0≤x(k+i|k)≤xmax,(16c) 0≤e u(k+i|k)≤e umax,(16d) x(k|k) = ˆ x(k),(16e) ˆ x(k) = χ(y(k)).(16f) After solving the nonlinear optimization problem Pq(k) at time step k, a series of the virtual inputs e u∗(k|k), . . . ,e u∗(k+Hp−1|k) can be obtained. By means of the receding horizon approach, the first value e u∗(k|k) is used as the optimal control action e u∗(k) at this time step. 4.3. The Lower Level: Algebraic Problem As introduced in the previous subsection, the virtual input can be found by solving the nonlinear optimization problem. Then, the actual input can be computed after the virtual input obtained by means of the algebraic problem. Depending on (3), the virtual input e u(k) and actual input u(k) has the obvious algebraic relationship, which can be written as follows: e u(k) =     b b b b 0−b0b b0−b0 −d d −d d    u2(k).(17) And then the actual input at time instant kcan be computed by u(k) =     b b b b 0−b0b b0−b0 −d d −d d     −1 2 e u1 2(k).(18) The solution u(k) of (17) satisfies the nonlinear optimization problem proposed in the upper layer as well as (18). Therefore, the solution u(k) can be used for the actual input at time instant k. 5. Simulation Results In this section, the proposed NMPC controller combined with constraint satisfactions is tested using continuous-time quadcopter simulator implemented in MATLAB. In order to evaluate the inherent robustness of the NMPC controller, the simulator model includes the uncertainties in (6), which are not explicitly considered in the prediction model in the NMPC controller. 5.1. Simulator Model Taking into account the uncertainties discussed before, the mathematical model of the simulator can be formulated as follows: ¨ φ=˙ θ˙ ψa1+˙ θa2Ωr+b1U2+ω1,(19a) ¨ θ=˙ φ˙ ψa3−˙ φa4Ωr+b2U3+ω2,(19b) ¨ ψ=˙ φ˙ θa5+b3U4+ω3,(19c) ¨z=Kz a˙z−g+ (cosφcosθ)U1/m, (19d) ¨x=Kx a˙x+ (cosφsinθcosψ+ sinφsinψ)U1/m, (19e) ¨y=Ky a˙y+ (cosφsinθsinψ−sinφcosψ)U1/m, (19f) where ω1, ω2, ω3∈Rdenote the system disturbances that can be regarded as the Gaussian white noise following some certain distributions, respectively. Kx a,Ky aand Kz adenote the aerodynamic friction coefficients for the axes x,yand z, respectively. All the parameters of the quadcopter are obtained from [2]. The measurement outputs of the quadcopter simulator are selected as y=h˙x˙y˙z˙ ψiT.(20) 5.2. Results The NMPC optimization problem is solved by using the nonlinear programming technique implemented through YALMIP toolbox [19] and IPOPT solver implemented in OPTI toolbox [20]. The constraint-satisfaction algorithm for the quadcopter control is implemented using the Interval Peeler software [21]. The continuous-time quadcopter simulator is built by means of the function of ode in MATLAB. In this work, the reference trajectory is assumed to be available generated by a path planner. The weights for each objective are set as λx= 10, λy= 10, λz= 10, λψ= 10 and λ∆u= 0.1. The sampling time is chosen as 0.1s. The NMPC prediction horizon Hpis chosen equal to 10. Besides, three scenarios are provided in the simulations defined as follows: •Deterministic scenario: ω1=ω2=ω3= 0, Kz a=Kx a=Ky a= 0, •Resistant scenario: ω1=ω2=ω3= 0, Kz a= 4.36, Kx a= 2.91, Ky a= 2.91, •Noisy scenario: ω1, ω2, ω3∼ N(0,0.05), Kz a=Kx a=Ky a= 0, where N(0,0.05) denotes the Gaussian distribution with the zero mean and the variance of 0.05. Time [s] 0 10 20 30 40 50 60 x [m] -0.5 0 0.5 1 1.5 2 2.5 Deterministic Resistant Noisy Reference 24 26 28 30 1 1.5 2 (a) x Time [s] 0 10 20 30 40 50 60 y [m] -0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 Deterministic Resistant Noisy Reference 26 28 30 32 34 36 1 1.2 1.4 1.6 (b) y Time [s] 0 10 20 30 40 50 60 z [m] -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 Deterministic Resistant Noisy Reference 32 34 36 38 40 0.5 0.6 0.7 0.8 0.9 1 (c) z Time [s] 0 10 20 30 40 50 60 Yaw [rad] -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Deterministic Resistant Noisy Reference (d) ψ Figure 2. Simulation results of x,y,zand ψfor three scenarios The selected simulation results with the three scenarios are shown in Figure 2 and Figure 3. Four references for x,y,zand ψare generated by the path planner in red dashed lines. It can be seen that the control objective of tracking the given references is well achieved for all the scenarios. The deterministic scenario presents the case that the simulator model is the same as the prediction model in the controller. In this case, the real trajectories on each axis and angle can follow the given references with a fast response, which means that the MPC is able to find feasible solutions with the mathematical model of the quadcopter. For the resistant scenario, the continuous resistant forces are included in order to simulate the quadcopter is operated in an environment with the effect of the wind. Consequently, as shown in the simulation results, the real trajectories of the quadcopter have some delays to reach the references compared to the deterministic scenario. In terms of the noisy scenario, additive noise following a Gaussian distribution with zero mean and variance of 0.05 is assumed, which is mainly generated from sensors located in the quadcopter. Therefore, there exist small deviations around the given the references on each axis. Besides, four actual control inputs Ω1, Ω2, Ω3and Ω4are plots. For the deterministic and resistant cases, these inputs are quite smooth compared to the noisy case. The real trajectory in 3-dimensional space ([x, y, z]T) is plotted in Figure 4. The quadcopter is controlled to do a set of motions including taking off, moving along x,yand zaxis and turning the head of the quadcopter through changing ψ. As shown in Figure 4, the quadcopter is able to reach the end point from a given start point for the deterministic and resistant cases. For the noisy scenario, the quadcopter arrives at an area around the target place (the end point) since there are small deviations for the each axis. Hence, the tracking accuracy for the quadcopter fullstate control is quite significant. As a result, the quadcopter controlled by the NMPC controller is able to track the given references. In reality, the quadcopter could suffer some unexpected disturbances at a certain time. Hence, it is necessary to test the behavior of the designed NMPC controller under these disturbances. From Figure 5, two peak disturbances with the same magnitude of 0.5 in ˙zaround two different