3-Dof Quadcoptor Simulation and Control
Demo
User can input the Waypoints in matrix form. Then the drone will automatically fly to that specified points at specific time.
Current Model
3 degree of freedom: y,z, and roll.
2 control inputs: u1 for thrust, u2 for torque on y-z plane. (control limits: u1 <= 30 Newton; roll angle < 30 degree)
Equations
| z_dd = g - (u1/m)*cos(roll)
| y_dd = (u1/m)*sin(roll)
| roll_dd = u2/Ixx
Current Control
Altitdue control: PD control + Mass Feedforward
Horizontal control: cascaded PID loop; outer Y PID controller generates the refernce roll angle input for inner roll PID loop.
Takeoff flag: now I use clock + Takeoff time to set the takeoff flag.
Command Matrix and Animation
Now, we can control the drone by setting waypoints in WayPts matrix(in the form of [y,z,t]). The signal.m script will calculate the corresponding input signal of Y(t), Z(t) position (use the concept of superposition to combine the nonlinear signals automatically.)
Then run the simulink model: nonlinear_airframe (it will generate tout,yout,zout,rollout datas in the out structure).
Then run the animation.m script to see the animation. (logdataprocess.m script will run first to collect the y_plot,z_plot,roll_plot points for animation)
MATLAB Project Download Link
You can download the full project by:
3dofQuadcopter_download.zip