Quadcopter Design for Payload Delivery

This paper presents the design and implementation of a quadcopter capable of payload delivery. A quadcopter is a unique unmanned aerial vehicle which has the capability of vertical take-off and landing. In this design, the quadcopter was controlled wirelessly from a ground control station using radio frequency. It was modeled mathematically considering its attitude and altitude, and a simulation carried out in MATLAB by designing a proportional Integral Derivative (PID) controller was applied to a mathematical model. The PID controller parameters were then applied to the real system. Finally, the output of the simulation and the prototype were compared both in the presence and absence of disturbances. The results showed that the quadcopter was stable and able to compensate for the external disturbances.


Introduction
Quadcopters are unique unmanned aerial vehicles which have a vertical take-off and landing ability [1].In the past, it was primarily used in the military, where it was deployed in hostile territory, to reduce pilot losses.The recent reduction in cost and feature size of semi-conductor logic has led to the application of quadcopters in many other areas like weather monitoring, forest fire detection, traffic control, cargo transport, emergency search and rescue, communication relaying, etc. Quadcopters operate in fixed rotor propulsion mode, an advantage over the traditional helicopter.They have four rotors which are arranged in such a way that rotors on transverse ends rotate in the same direction, while the other two operate in the opposite direction [1].Changing the parameters of the attitude (roll, pitch and yaw), and altitude determines the behavior and position of the quadcopter.The throttle on each rotor changes its attitude.The UAVs can be broadly classified into two categories: fixed wing versus rotary wing, each with their own strengths and weaknesses.For instance, the fixed-wing UAVs usually have high speed, and heavy payload, but they must maintain a continuous forward motion to remain in the air [2].
The applications for quadcopters have recently grown significantly, and related works are presented here.[3] presented an altitude controller design for UAVs in real time applications.The author described a controller design method for the hovering control of UAVs and automatic vertical take-off systems.In 2012, the attitude and altitude dynamics of an outdoor quadrotor were controlled using two different structures of proportional integral derivative (PID) controllers [4].The tests showed that the two structures were successful.[5] presents a Quadcopter for surveillance monitoring.In [6], the design and control of VertiKUL, a Vertical Take-Off and Landing (VTOL) transitioning tail-sitter Unmanned Aerial Vehicle (UAV) was presented.The UAV is capable of hover flight and forward flight, and its main application is for parcel delivery.

Methodology
In this work, aquadcopter was first modeled mathematically, after which a simulation was carried out in MATLAB by designing a PID controller, which was applied to the mathematical model.The PID controller parameters were then applied to the real system.Finally, the output of the simulation and the real system were compared.In this paper, attitude and altitude dynamics of a quadcopter were considered.Therefore, roll, pitch, yaw, and altitude dynamics were modeled.

Mathematical Model of Attitude Dynamics
One of the aims of the work is to stabilize the quadcopter in the hovering condition.The following assumptions were made [4]- [7]: i) System structure is supposed to be rigid and symmetrical.ii) Earth fixed reference frame is assumed to be inertial.iii)The rotors are rigid, i.e. no blade flapping occurs.
Attitude of the quadcopter is defined by roll, pitch and yaw angles; namely φ , θ , and ψ , respectively.An- gular velocity components in body reference frame are p, q, and r, respectively.F 1 , F 2 , F 3 , and F 4 are the thrust forces from the four motors, which are generated by propellers.Axes and states are represented in Figure 1.It is possible to obtain a rotation matrix with the following equation: where R is the matrix transformation dynamics of the model quadcopter moving from landing position to a fixed position in space.Therefore, substituting x R , y R , and z R into Equation (2.1), we get the system matrix: cos cos cos sin sin sin sin cos sin cos sin sin sin sin sin sin sin cos cos sin sin cos sin cos sin sin cos cos cos θ ϕ θ θ ψ The angular velocity of the quadcopter can be written as: It is possible to write state equations of the Euler angles in terms of angular velocity components, p, q, and r by using rotation matrices.tan sin tan cos p q r Inertia matrix, I is assumed to be a diagonal matrix (i.e. the mass products of inertia terms are assumed to be 0).Thrust forces generated by each motor-propeller pair are denoted by F 1 , F 2 , F 3 and F 4 .Therefore, resultant moments about roll, pitch and yaw axes are given below: ( ) ) ( ( ) Hence, state vector and state equations considering the yaw, roll and the pitch dynamics of the platform are expressed below: ( ) Also, by applying the force and moment balance laws, we have the following quadcopter motion formulation: 1 sin sin cos cos sin where K i is the drag coefficient (assume zero since drag is negligible at low speed).
The angle movement of Quadcopter is given by

Controller Input
Quadcopter has four controller input U 1 , U 2 , U 3 , and U 4 .

Motor and Propeller Model
Brushless motors are used as the actuators of propellers of the quadcopter.Four brushless motors in the system are driven via Electronic Speed Controllers (ESC).ESC's converts PWM signals into a three-phased signal, which rotates the motor continuously.Motor and propeller unit models are identified experimentally.These models are algebraic, steady state ones.Thrust force generated due to the rotation of propellers can be calculated with the equation given below: where b is thrust factor which is determined experimentally.

Mathematical Model of Altitude Dynamics
Total thrust force and weights are the acting forces in z direction.Translational acceleration of the quadcopterin z-axis can be obtained, using the following formula; This equation reveals position in z-axis and velocity in z-axis as two states.

The PID Controller Design
The PID is a popular way of controlling the quadcopter, and one widely used strategy to control a quadcopter with a PID is to create an individual closed-loop system for each independent axis of each sensor.That is, we would have the same structure depicted in Figure 2 for each sensor axis where ( ) y t would be the sensor out- put (angular velocity or acceleration of each axis) and ( ) u t the desired value to that axis.This way we would have three different PID controllers for the gyroscope (one for each axis) and the input to each control loop would be an angular velocity reference.That is, making all references equal to zero would make the quadcopter preserve all its rotation angles.Other three distinct PIDs would then be used to control the accelerometer axes.Therefore, setting zero to x and z axes would make the quadcopter hover (all weight force would be concentrated in y axis).
Another widely used strategy is to mix the accelerometer and gyroscope signals to find a single angle value for each axis.That is, combining the gyroscope information with the accelerometer information, one can find a unique angle value for each axis that can represent an absolute angle of rotation or a variation with respect to the previous time step.Therefore, one can use a total of only three closed-loop systems instead of six.Also, there are three multiple ways of combining those signals, and the control system efficiency will directly depend on which way is chosen.Since the sensors can have errors (e.g.noise and drift), a method that minimizes the main problems of each sensor is chosen and the best features of each can be combined.
Therefore, the control signals generated by each closed-loop structure must be combined before sending to the motors.A commonly adopted way of combining those signals is given below: It can be seen in the equations above that those signals are used in a differential mode due to the plant symmetry.Thus, another important detail is that the signals of each term inside each equation depends on each axis reference (e.g.whether positive pitch rotation is clockwise or counter-clockwise) as well as where each motor is positioned.So one must know the motor configuration (whether plus + or cross ×) before writing the equations.Finally, each motor will be individually controlled in an open-loop configuration which can already lead us to a flyable quadcopter.

Simulation
The quadcopter design details were used to produce a model to be constructed in the simulation window.Some effects (like aerodynamic effects such as blade flapping) were ignored or dramatically simplified, thus, a limitation to the model.The system model contains five major blocks (systems) each containing its own subsystem or unit blocks that describe the overall system dynamics of our quadcopter.The system blocks include: i) Path Command block; ii) Position Controller block; iii) Attitude Controller block; iv) Quadcopter Control mixing block; v) Quadcopter Dynamics block.

Path Command and Position Controller
The path command block is used to set the desired position of quadcopter in terms of x, y and z coordinates as well as the yaw (for directioning on the x-y plane).These parameters serve as the set points for the position controller.These variables are loaded as Matlab codes into the simulation through the MATLAB workspace.The position controller takes inputs from the Path command as its set point, and also receives the current position (state) of the quadcopter as feedback.It then compares this feedback with the set point to give the error.
The position error in the body frame is computed, and maps the body frame desired velocity.This desired velocity is then mapped to a desired attitude.The essence of this rotation is because the Inertial-frame velocity is used as the state to be controlled (Path command input).

The Attitude Controller
The attitude controller, like the position controller, takes feedback from the output of the system as one of its inputs, but takes its second input from the position controller.This block contains the full proportional integral derivative (PID) controller which does the final attitude correction.The feedback to this block contains the current attitude, and angular velocity of the quadcopter in x, y and z axes.The controller essentially compares the current state with the set point, and attempts to bring these various parameters to the set point.The integral part of the PID ensures that the parameters remain at set point once achieved.

Quadcopter Control Mixing
There are two quadcopter configurations available, the quad + configuration and the quad × configuration.The quadcopter control mixing block does the control signal mixing depending on the quadcopter configuration used (plus + or cross ×).It gets the corrected parameters for Pitch (θ ), Roll (ψ ), Yaw ( φ ) and Altitude (Z) from the attitude controller and generates the necessary throttle commands to actuate each motor (m 1 , m 2 , m 3 , m 4 ).
The equations below are used for the control signal mixing of a quad × configuration.

Quadcopter Dynamics
The quadcopter dynamics block contains two major subsystem blocks: The motor dynamics block, and The State Equations block.The Primary function of the Motor dynamics block is to convert the percentage throttle command to the motor RPM.The motor dynamics block contains the state space model; x Ax Bu = +  (3.5) where, ( ) The four RPM values generated are fed into the State equations block which contains a level two S-function block, where the flight dynamic state equations are loaded.This S-function is written in MATLAB.The S-function block holds the initial conditions (Table 1) used for the simulation.Its parameters are the quadcopter model functions and the input initial conditions.The outputs, ( ) , , , , , , , , , , ,  p q r u v w x y z φ θ ψ describes the physical behavior of the quadcopter.
The main function of the S-function block is to use various parameters fed into it, to calculate the quadcopter outputs (Angular velocities, linear velocities, position (along the x, y and z axes) and attitude (yaw, pitch and roll)) which are then used for the simulation plots and 3D animation.Also, a disturbance block was added as input to the S-function block to simulate for response to external forces which might act on the quadcopter body during flight and how it can compensate and recover from these disturbances whilst still trying to maintain flight stability (set point).
The data used for the quadcopter simulation was based on the design model presented.The individual parameters of the components that make up the quadcopter were carefully calculated.Some parameters such as Torque, Thrust and Time Constants where estimated from already measured data of a similar system.This estimation is due to the unavailability of necessary test bench (and instruments) required to carefully monitor and measure these parameters.Since our design model is a quadcopter for payload delivery, our simulation focused on the following: 1) Load test (maximum allowable load on-board); 2) Hover test (with load and without load); 3) Disturbance test (with load and without load).
The PID Control gains were carefully tuned and the appropriate gain value was chosen based on the simulation results obtained.The PID gains used in the Attitude controller are presented in Table 1 while the PD gains of the position controller are presented in Table 2.

Simulation Results and Discussion
The simulation was run for 60 seconds and several graphs were generated.Figure 4 shows the result of the simulation with no external disturbance added.The Path command was such that the quadcopter will move a diamond-shaped path.P, Q and R are angular velocities about the X, Y and Z axes respectively; Phi, theta and Psi are the Roll, Pitch and Yaw angles; U, V and W are the translational velocities along the X, Y and Z axes respectively; X, Y, and Z define the position of the quadcopter along the X, Y and Z axes respectively.

Hover Test
The hover simulation of a quadcopter in flight describes its ability to float at/about a fixed point in air.Hover test was done at 10 feet and the results are given below.The graphs shown in Figure 4 represent a stable system.At first, there was an overshoot, but with time the controller sets each of these parameters to set point.

Disturbance Test
Disturbance was introduced to the quadcopter flight simulation which could represent the action of external force like wind on the body of the quadcopter while in flight.The graph in Figure 5 represents the system without any disturbance.However, as can be seen from the graph in Figure 6, when a disturbance was introduced, the quadcopter was able to compensate properly.Therefore, the PID controller logic is functional and it can be implemented for the actual system.
The effect of a disturbance to the flight path was further tested with regards to linear and angular velocity is presented in Figure 7.The system acknowledged the disturbance but was able to compensate adequately, and return to a stable flight.

Load Test
Since the quadcopter design model is for payload delivery, the simulation shows how an increase in the gross mass of the quadcopter affects its motor speed.The result is presented in Figure 8 and Figure 9. Again, the system was able to maintain a stable flight.

Conclusion and Future Work
A stable 1.26 kg quadcopter for payload delivery was designed, simulated and implemented.The design and simulation, which utilized a PID controller, was able to yield results that showed good compensation in the   presence of external disturbances.The Quad X structural model was used to enable the Quadcopter to gain more speed over a short period of operation, as timely delivery of payload is an important factor.Future study would be to equip the quadcopter with a solar powered system, and to encrypt the communication between the quadcopter and the ground station.
by each motor Th = force to moment scaling factor l = moment of inertia with respect to the axes i I = .

Figure 2 .
Figure 2. A typical PID controller internal blocks.
= control signals (for pitch, roll and yaw axes respectively)

Figure 3 (
a) and Figure 3(b) are the Simulink blocks for Pitch and Yaw, including their corresponding attitude correction outputs.

Figure 4 .
Figure 4. Result of the simulation without disturbance.

Table 2 .
The position controller PD gains.