Complete Mathematical modelling and Control equations for Quadcopter .
Hello guys, I have finally completed the mathematical modelling for the quadcopter. Below is the detailed description for the same. We have zaxis pointing down, xaxis pointing left to right and yaxis perpendicular to the screen. Let rotation along the xaxis be denoted with phi, the rotation along the yaxis be denoted with theta and rotation along the zaxis be denoted by psi. The angular velocities along these axes x,y and z be denoted by p, q and r respectively.

Balancing the THRUST: In order to balance the thrust, we have to apply appropriate acceleration in the zaxis
along with mg.
F (or THRUST) = mass(gravity+ des_state.acc(z)+Kdz*(des_state.vel(z)state.vel(z))+Kpz*(des_state.pos(z)state.pos(z));
where:
des_state.acc(z) = Desired acceleration in zdirection,
des_state.vel(z) = Desired velocity in in zdirection,
des_state.pos(z) = Desired position in zdirection,
state.vel(z) = Actual velocity in zdirection,
state.pos(z) = Actual position in zdirection,
Kdz = Derivative gain in z direction,
kpz = Proportional gain in zdirection. 
Balancing the MOMENT : We need to balance the moments in the x, y and z axis in order to keep the quadcopter stable. Below is the equation for the same.
M(or MOMENT) =[Kpphi*(phi_desstate.rot(x)) + Kdphi*(0p);
Kptheta*(theta_desstate.rot(y)) + Kdtheta*(0q);
Kppsi*(des_state.yawstate.rot(z)) + Kdpsi*(des_state.yawdotr)];where :
r_x_des_ddot = des_state.acc(x)+Kdx*(des_state.vel(x)state.vel(x))+Kpx*(des_state.pos(x)state.pos(x));
r_y_des_ddot = des_state.acc(y)+Kdy*(des_state.vel(y)state.vel(y))+Kpy*(des_state.pos(y)state.pos(y));
phi_des = (r_x_des_ddotdes_state.yaw  r_y_des_ddot)/gravity ;
theta_des = (r_x_des_ddot + r_y_des_ddotdes_state.yaw)/gravity ;here,
phi_des = Desired phi angle(along x axis),
state.rot(x) = Actual phi angle(along xaxis),
p = Actual angular velocity along xaxis,
Kpphi = Proportional gain in phi angle,
kdphi = Derivative gain in angular velocity along xaxis,
theta_des = Desired theta angle(along y axis),
state.rot(y) = Actual theta angle(along yaxis),
q = Actual angular velocity along yaxis,
Kptheta = Proportional gain in theta angle,
kdtheta = Derivative gain in angular velocity along yaxis,
des_state.yaw = Desired psi angle(along z axis),
state.rot(z) = Actual psi angle(along zaxis),
des_state.yawdot= Desired angular velocity along zaxis,
r = Actual angular velocity along zaxis,
Kppsi = Proportional gain in psi angle,
kdpsi = Derivative gain in angular velocity along zaxis,
I do understand that these equations are not easy to understand in a go, so please give it some time. For any doubt, please comment. Also, let me know if there is requirement for a video if you do not get the complete clarity.