Modeling, Simulation and Implementation of a Quadrotor Farshid Jafari Harandi, Harandi Vahid Khorani, orani, and Alireza Mohammad Shahri

Abstract—In this paper design and implementation of a Quadrotor flying robot named ‘Charotor’ is presented. Based on a developed dynamic amic model in MATLAB Simulink, three PID controllers for Roll, Pitch, and Yaw are designed by trial and error procedures. These PID controllers are simulated and implemented in the real Quadrotor. To validate the simulation and experimental results the pitch ch PID controller performance is examined whilee a disturbance is inserted to the Quadrotor.

eal implementation, Keywords: Quadrotor rotorcraft, Real dynamic modeling, MATLAB model, PID controller. I. INTRODUCTION

F

LYING machines are one of the most complex systems in case of design and control. Development of autonomous flight control for such machines has always been into researchers` center of attention. In smaller-size smaller applications, Vertical Take Off and Landing, VTOL, can provide more flexibility in autonomous flight compared to Conventional Take Off and Landing, CTOL. A Quadrotor flying machine as a VTOL machine uses less number of complex mechanical parts compared to a simple tail rotor helicopter, simplifying its design procedure. Quadrotor concept is not new in flying machines. machines One of the very first VTOL machines was a real-size size Quadrotor built by Frenchman Etienne Oehmichen in 1924 flying for 360 meters [1]. In recent years, Quadrotors became in researchers focus as a reliable platform for Unmanned Air Vehicles, UAVs. One of the earliest examples of such projects is Mesicopter, a micro scale Quadrotor at the scale of a tip of a finger developed in Stanford University starting on 1998[2]. In this project feasibility of a small autonomous flying robot is investigated and technologies and scaling limits are explored. A swarm of Mesicopters Mesicopter are intended to be used for atmosphere exploration. However, most of the researchers keep their focus on modelss with rotor to rotor size of 0.4 to 1 meter. OS4 by S. Bouabdallah et. al. is developed as a PhD thesis in EPFL university [3]. In this thesis dynamic d modeling is used and non-linear linear control techniques are applied on both the model and the actual robot built. Detailed information

Farshid Jafari Harandi is a Master of Science ience student in Mechatronics program at ECE department of Azad University of Qazvin, Qazvin, Iran (email: [email protected]). Vahid Khorani is a Master of Science ience student in Mechatronics program at ECE department of Azad University of Qazvin, Qazvin, Iran (e-mail: [email protected]). Alireza Mohammad Shahri, PhD, is ann assistant professor at Electrical Engineering department of Iran University of Science and Technology, IUST, Tehran, Iran (e-mail: [email protected]).

are presented in order to elaborate the design procedure and highlight main concerns in building a Quadrotor and importance of component selection. selection STARMAC project from Stanford University exports the use of GPS and Microstrain [4] IMUs on a group of Quadrotors flying as multiagent flying robots [5].. In another project by Erdinç Erdi Altug et. al. trajectory control of a Quadrotor with the aid of two cameras for position feedback, feed one pan/tilt/zoom camera on a ground station and another pan/tilt camera onboard is presented [6]. In his work Backstepping controller and feedback linearizing are used in simulation and on the actual robot. The developed flying robot ‘Charotor’ in this paper which is shown hown in figure 1 can hover and follow the commands given to its remote control.. In order to control the Charotor an IMU including a three dimensional accelerometer and three gyroscopes are applied as feedback sensors for the Roll, Pitch, and Yaw PID controllers. Xbee wireless communication moduless with 1 KM ran range are used on-board to communicate with the ground PC station for real-time telemetry. Flight light control results and attitude estimation presented here are all gathered with the aid of this communication possibility.

Fig. 1. Charotor, the developed develo Quadrotor

There are a few challenges behind the design process of a Quadrotor. uadrotor. This paper addresses practical issues in the design process, modeling, and controller design for such a robot. The dynamic model of the Quadrotor which is developed in MATLAB Simulink is presented in the following section. Section III is dedicated to the simulation process while in section IV some practical issues in the design and implementation of the Charotor Ch are addressed. The Roll, Pitch, and Yaw PID controllers design and its implementation results are addressed in section V and VI.

Finally the paper is concluded in section VII. II. DYNAMIC MODELING In the process of designing a controller for a system it is of vital importance to develop a model for that system so the behavior of the system can be experimented artificially. In flying machines, and Quadrotors in this case, modeling can save time and money. A free fall from 10 meters high due to a control failure can impose permanent damage on the frame, propellers, or motors on a real machine. Modeling of a helicopter is not an easy task. As John Watkinson puts it "A helicopter is a collection of vibrations held together by differential equations". The first step of making a model is to model the dynamics of a Quadrotor [7]. By using E-frame for earth fixed frame and B-frame for body fixed frame the two frames which are used in dynamic modeling can be presented as figure 2 [8].

Fig. 2. Body Frame and Earth Frame

A. Kinematics Here dynamic modeling of a Quadrotor is studied. Equation below describes the kinematics of a generic 6-DOF rigid body [8]: (1)    

Where  and  are the generalized velocity vectors with respect to E-frame and B-frame respectively and  is the generalized matrix.  is composed of 4 sub-matrices:  0

(2)    

0

 Where  and  are the rotation and transfer matrices defined as:               (3)                       1      0 0  /

     /

) +, *  -"  #$% '  ' $% $%( ) +  * ,  )  ."  /  #' '( +, * > (5) 56 8)  0  12 34  37  +9 122 122  56 8)  3  1: 04  1 07  1 +

:: ::  4  1 03  < + ;  1;; = Where !, - and . are axes of the E-frame and 7 is the propellers’ speed vector and +, is the vertical force and +9 , + and += are the torques generated by propellers. +,  7,9  799  7 9  7=9 9 9 +9  79  7= 9 9 > (6) +  7,  7

 9 9 9 9 +,  7,  79  7  7=  7  7,  79  7  7= expressed as [8]:

(4)

Where ,  and  represent Euler angles (Roll, Pitch, and Yaw respectively). B. Kinetics A new frame named H-frame which is a hybrid frame composed of E-frame and B-frame is used for the kinetic equations. By using kinematic equations and Newton-Euler formulation, the kinetic equations in H-frame can be

!"  #$% $%  ' $% '(

Where 7? for %  1,2,3,4 indicate the propellers` speed. Combination of BLDC motors and Electronic Speed Controllers on the real Quadrotor are estimated and modeled using DC motor equations: K E KF < 9 KF (7) 7?   7?  7?   56 56 56 ? Where ? for %  1,2,3,4 indicates the motor input voltages. List of the values used as model parameters are listed in TABLE I. By selecting parameters similar to the real Quadrotor it has been tried to make a realistic model. TABLE I PARAMETERS OF THE MODELED QUADROTOR Symbol

Quantity

b

trust factor

d

drag factor

m

122 1:: 1;; l 56 OP

OT

mass of the Quadrotor body moment of inertia around the x-axis body moment of inertia around the y-axis body moment of inertia around the z-axis distance between the center of the Quadrotor and the center of a propeller total rotational moment of inertia around the propeller (motor) axis electric motor constant mechanic motor constant

R

motor resistance

g

acceleration due to gravity

value

11 10GH #I 9 (

1.1 10GH #I* 9 ( 1.3 #K/(

8.1 10G #I* 9 ( 8.1 10G #I* 9 (

14.2 10G #I* 9 ( 0.27 #*(

7.33 10GN #I* 9 ( 6.3 10G #R 4S< G, ( 6.3 10G #I * UG, ( 0.6 #7(

9.81 #* G9 (

III. SIMULATION In this section results of simulations done on the dynamic model introduced in section II are presented. Implementation of the model is done in MATLAB Simulink. Wind is modeled as a Gaussian distributed force by zero means value which is applied to Quadrotor in the direction of each axis. The wind variations by height are not accounted for in this simulation. Figure 3 illustrates block diagram of the PID controller used.

Fig. 3. Block diagram of the PD controller used

For testing the model two tests are done. First, a disturbance on pitch axis is simulated and second, a trajectory is given to the Quadrotor to follow.

bring the pitch angle back to zero. In this process rear motor and front motor’s output will change to compensate this disturbance. In figure 4 the rear motor control effort is shown. Speed of this motor is increased to compensate the increase in the angle where left and right motors` control efforts remain unchanged. B. Trajectory tracking Controller of the Quadrotor in trajectory control uses position and attitude of the robot as feed-back parameters to follow the given path. Apart from attitude controller, three PD controllers are also used for position control in X, Y, and Z axes. A given trajectory is used for simulating the behavior of the Quadrotor in path tracking. The given path, shown in figure 5, is similar to circumference of a rectangle where at the end there is a 1 meter height increase with the robot continuing its way to the center of the rectangle afterwards. Figure 5 represents the reference path and robot’s performance.

A. Hovering control Hovering control of the Quadrotor uses attitude displacement of the robot as feed-back parameters. Attitude is controlled by three separate PD controllers to guarantee hovering of the robot in the Pitch, Roll, and Yaw axis.

Fig. 5. Refrence and results of a 3-D trajectory given to the simulated Quadrotor

In this trajectory Quadrotor must move by a fixed speed of 1 */ on the whole path without stopping at any point of the given path.

Fig. 4. An initial force of 2 (N.m) applied to the Pitch angle of the simulated model (top) and the corresponding motor control effort output (bottom)

Effects of 2 #I. *( disturbance applied on the pitch angle is studied. As results in show figure 4, Pitch angle changes to 1.5° and it takes 2 seconds for the Pitch PD controller to

Fig. 6. results of the same trajectory as in figure 4 shown for Pitch, Roll, and Yaw angles and the trajectory itself in 2-D view

As figure 6 shows, simulated Quadrotor performs required Roll and Pitch changes to move forward, turn, and follow the given trajectory with satisfactory results. To prevent position divergence Pitch and Roll angles are kept around zero by the PD controller. IV. BUILDING THE QUADROTOR Building a flying machine, it is of outmost importance to select the best possible components which match each other to provide the best possible performance. These parts can be generally divided into mechanical and electrical components. A. Mechanical components Body is made out of Fiber Carbon, one of the lightest and strongest materials, reinforced by Balsa wooden dowels. Carbon fiber has greater strength to weight ratio compared to Aluminum or Plastic. Tractor and Pusher APC 10x4.7 propellers are selected as the strongest and most balanced propellers available commercially. These propellers are carefully made out of glass-filled nylon and can survive crashes. Four KDA20-22L BLDC motors with 924 RPM/V spin the propellers. These motors provide high efficiency at low-price. B. Electrical components Set of an MMA7260Q (a 3-axis accelerometer) and 3 x LISY300AL gyros is used for pose estimation. In selection of sensors, availability was the key factor while there were better sensors to be used with higher resolution, bandwidth, and resonant frequency like ADXL335 accelerometer and IDG500/ISZ500 Gyros. An Arduino Duemlianove board [9] which uses an Atmel AVR at 16MHz is used as the controller linking the input sensors to the motors driven by Turnigy Plush 25A BLDC drivers. Remote commands are received by a 6-Channel RC remote control as standard PPM signals. Bidirectional data transfer and telemetry is made possible with the aid of an onboard 60mW Digi Xbee communication module and another module at the ground station. C. Pose estimation Robot's attitude is determined using the sensor outputs fed to a second order complementary filter [10]. This filter accepts gyroscopic sensors as inputs and compensates their drift with the angle read from the accelerometer. This filter maintains good performance with minimum processing usage. Therefore it can run in real-time on an 8-bit microcontroller. Figure 7 shows the performance of this filter while the real Quadrotor is tilted around its Pitch axis from -40 to +40 degrees.

Fig. 7. Output of the second order complementary filter (A) with a rotation around pitch from -40 to +40 calculated based on input sensors (B)

D. Controller software Controller board software is composed of periodic tasks executing at certain intervals while interrupts are exported to minimize processor time needed on reading inputs. Main loop, shown in diagram 1, utilizes 70% of processor time. Serial telemetry

Read remote control

10/200Hz

10 Hz

Update motor speeds

Read input sensors 500 Hz

500 Hz

PID Controllers

Atitude estimation

500 Hz

500 Hz

Dia. 1. Main loop on the Quadrotor controller software

V. CONTROLLER DESIGN A. PID controller Simple discrete PID controllers for each axis of the robot are used for attitude control. As shown in Figure 8 each controller accepts target position and current position as inputs and outputs the corresponding axis command.

Fig. 8. Separate discrete PID controllers for each axis

The motor output for each axis is later calculated using the output given from the corresponding controller and the received throttle signal from the remote control as below: Y4'%Z''4  [4'8\  '88]'**S%< – -S_]'**S%< \S4Z''4  [4'8\  `$[]'**S%< – -S_]'**S%< $/[Z''4  [4'8\ – '88]'**S%<  -S_]'**S%< a\bZ''4  [4'8\  '88]'**S%<  -S_]'**S%<

PID controller loops run at 500Hz. In the controller board software, each PID block is deployed as a standard discrete PID controller according to the formula below [11]: ?

c#%(  Od \#%(  Oe f \#K(  Oj #k#%(  k#%  1(( ghi

Where \ indicates the error signal, k is the output, % is the discrete step at time , and: Oe 

lm 5 5n

, Oj 

Fig. 9. Behavior of the Quadrotor while hovering with various K p values for Pitch axis (O$ and O< are set to zero)

Figure 10 shows the effect of different values of Oe on the behavior of the robot. Having a small constant like Oe  0.05 here improves the performance.

lm 5o 5

B. PID controller parameter determination Parameters for the PID controller were determined experimentally. For example for Pitch PID loop, While Quadrotor is hovering and Oe and Oj are set to zero, Od is increased until the output of the control loop starts to oscillate. Then for “quarter amplitude decay” type response, Od is set to approximately half of the value measured. Oe is used to correct any offset in sufficient time for the process knowing that increasing it too much will cause instability. Increasing Oj will enhance disturbances introduced while increasing it too much will lead to excessive response and overshoot [12]. Figure 9 shows the behavior of the Quadrotor for different values of K p . The best value for Od is determined to be equal to 6 which is approximately half of the Od  10 where system starts to show instability and relatively high amplitude oscillations.

Fig. 10. Behavior of the Quadrotor while hovering with various K q values for Pitch axis (K p  6.0 and K r = 0)

Result of different values experimented for Oj is shown in figure 11. A derivative term of 1 does not introduce a significant improvement while Oj  10 demonstrates the quickest response with least amount of oscillations compared to the other values experimented. Final parameters for the Pitch PID controller are chosen as Od  6, Oe  0.05, Or  10. A similar approach for determination of the parameters for Roll and Yaw axis PID controller is used. For the Roll axis PID controller same values were determined. Symmetry of the robot on Pitch and Roll axis is the reason behind this. On Yaw axis best parameters were determined to be Od  10, Oe  0, Or  0.

Fig. 11. Behavior of the Quadrotor while hovering with various K r values for Pitch axis (K p  6.0 and K q= 0)

VI. REAL IMPLEMENTATION RESULTS Using the parameters determined in section V, Charotor can fly and hover within s1° of horizon in air while no external disturbances introduced to it. Charotor can move forward, backward, left, right, up, and down in the air by the commands received from its remote control. Disturbances introduced to the robot are compensated rapidly with satisfactory performance. In Figure 12, a force equal to 2#N. m( is applied to the rear axis of the Quadrotor at the second 1.5 introducing a maximum of 1.5° displacement in Pitch. Quadrotor quickly tries to dampen the disturbance introduced by increasing the rear motor control effort. This test is similar to the simulation test done in III.A. Results of the real test show bigger oscillations in Pitch angle control and motor speed compared to the simulation. This is mainly due to the non-linearity of the set of BLDC motors and drivers and non-ideal sensors used in reality. Videos of the robot in action and relevant source code are available online at farshidjh.wordpress.com. VII. CONCLUSION In this paper design of a Quadrotor, modeling and simulation of it are presented. The real robot’s components selection and attitude estimation method are presented accompanied by the details of the developed model. Results of an initial force given to Pitch axis of the real Quadrotor and simulated model are presented and compared. Developed model demonstrates similar performance with smaller oscillations compared to the real robot. A trajectory is given to the simulated model and the result is reported. For further work, this Quadrotor can be upgraded with odometery and sensor fusion by adding complementary sensors such as GPS. Thanks to the embedded bidirectional wireless Xbee link a swarm of similar robots can be used in multiagent setups with the aid of Xbee localization. Genetic Algorithm can be used to tune the PID parameters further.

Fig. 12. An initial force of 2 (N.m) applied to the Pitch angle of the real Quadrotor and the corresponding motor control effort output

REFERENCES [1]

Rumerman, Judy, "Helicopter Development in the Early Twentieth Century". Centennial of Flight Commission. http://www.centennialofflight.gov/essay/Rotary/early_20th_century/H E2.htm , Retrieved: January 28, 2010 [2] Ilan Kroo, Fritz B. Prinz, Mesicopter project , Stanford University, http://adg.stanford.edu/mesicopter/ [3] S. Bouabdallah, "Design and Control of Quadrotors with application to autonomous flying", EPFL university, PhD Thesis, 2007 [4] MicroStrain® microminiature orientation sensors, www.microstrain.com , Retrieved: 28 January 2010 [5] Claire Tomlin et al., STARMAC project, Stanford University, http://hybrid.eecs.berkeley.edu/starmac , Retrieved: January 28, 2010 [6] Erdinç Altug, James P. Ostrowski and Camillo J. Taylor, “Control of a Quadrotor Helicopter Using Dual Camera Visual Feedback”, The International Journal of Robotics Research, 2005 [7] Samir Buabdollah, Pierpaolo Murrieri, Roland Siegwart, “Design and Control of an Indoor Micro Quadrotor”, ICRA '04, 2004 IEEE International Conference on Robotics and Automation, Page(s): 4393 - 4398 Vol.5 [8] Tommaso Bresciani, “Modelling, Identification and Control of a Quadrotor Helicopter”, Master Thesis, Lund University, October 2008 [9] Arduino development board, www.arduino.cc , Retrieved: January 28, 2010 [10] Second order complementary filter, www.rcgroups.com/forums/showpost.php?p=12082524&postcount=1 286 , Retrieved: January 28, 2010 [11] Atmel semiconductors, “Discrete PID controller”, AVR221 Application note, www.atmel.com/dyn/resources/prod_documents/doc2558.pdf , Retrieved: January 28, 2010 [12] Manual PID tuning, http://en.wikipedia.org/wiki/PID_controller , Retrieved: January 28, 2010

Modeling, Simulation and Im eling, Simulation and ...

PID controllers for Roll, Pitch, and Yaw are designed and error .... design and implementation of the Ch. The Roll .... select the best possible components which match each other to provide the .... available online at farshidjh.wordpress.com. VII.

542KB Sizes 8 Downloads 144 Views

Recommend Documents

Process-Control-Modeling-Design-and-Simulation-B-Wayne-Bequette ...
Process-Control-Modeling-Design-and-Simulation-B-Wayne-Bequette.pdf. Process-Control-Modeling-Design-and-Simulation-B-Wayne-Bequette.pdf. Open.

Modeling and Simulation of Dry Sliding Wear for Micro-machine ...
wear and eventually the useful life span of a micro-machine. A simple equation ...... potential energy is identical to the principle of virtual displacement, the unknown nodal point ...... Hi. D w w i i. E. R a. F a. aaE. F h aa. F p h. hR a h h h ap