Quadcopter Simulink Model
Quadcopter Dynamics, Simulation. In order to properly model the dynamics of the system, we need an understanding of the physical properties that govern it. This example shows how to use Simulink® to model a toy quadcopter, based on the Parrot (R) series of mini-drones, to help estimate the snow levels on the MathWorks.
There are a number of papers that describe the dynamics of a quad. You have a few options. First, you can create a CAD model and use simmechanics link to derive the mechanics. This would work well if you already have a model in solidworks. Otherwise you can define the aerodynamics and use the 6-dof block to create the simulation For the controller, you want to feedback the rates and use a discrete time PID block.
Design an inner loop for the rates and an outer loop for positions. The PID blocks have PID tuners so you don't really need to understand control that well to utilize them: But if you are actually using this on a real system you need to understand that the controller is only as good as the model it was designed for. So make sure you have a good model.
Check out this paper for the aerodynamic forces and moments: It's a pretty good starting point and you can figure out how these can be applied to the 6-dof block.
Quadcopter Simulink Model
I'm trying to implement with simulink a PD controller for my quadcopter. I use a simplified model, and for the roll case I have $ Ix. phi = L $, where L is the roll torque. So, the transfer function of my model is $ Ix/s^2 = L $in continous time. My real system needs that the output of the transfer function is a torque, that is converted (with the other torques) in the PWM frequencies for the 4 motors. In order to implement my simulation and close the loop (that in reality is closed by the IMU unit), I have expressed the same previous equation in terms of $ phi$ to get the obtained angle and close the loop.
When I'm trying to tune my PD automatically with matlab, it doesn't find a stable configuration of the parameters. I'm pretty sure that I'm doing something wrong, but I'm not very familiar with control. I attach two pictures of my control loop (continous and discrete, even if the final system will be discrete). Someone can tell me what is the problem?