Quadrocopter Simulink Model of the Ardupilot Code

Hey all,
we are a team of two students developing a quadrocopter simulation. We want to calculate the PID values depending on the dynamical behaviour of the aircraft. Therefore we use the PID’s from the Ardupilot AUTOTUNE function as reference to prove a stable and roughly realistic flight behaviour.
The code is still not completely working.
For more information see the Readme in the ZIP file.

Feel free to use the code and do whatever you want with it.
We would appreciate to get some advices to finish this project.

Quadcopter Simulation Ardupilot.zip (299.4 KB)

Yes sure:
SimQuadroCopter_2016a.zip (37.7 KB)

If you need something else please contact us :slight_smile:

We made a mistake at the “X Config Control Mixing” block in Simulink. The picture doesn´t fit to the actual motor setting. The motor “2” and “3” should be swapped (on the picture).

Sorry for that!

Hi there, has there been any update on the progress since this was last posted?

I had my own simulation that was working based on a PD controller for attitude control but I wanted to test the arducopter gains from autotune, similar to you. I then spent the last couple weeks going through the Ardupilot code figuring out how to apply that controller and I stumbled upon your code. It appears you are having similar issues.


I think u made a mistake in Input_Translation_Pitch and Input_Translation_Yaw blocks. In Input_Translation_Pitch block line no should be error_angle=euler_angle-attitude_target_euler_angle(2); in stead of error_angle=euler_angle-attitude_target_euler_angle(3);
In In Input_Translation_Yaw block line no should be error_angle=euler_angle-attitude_target_euler_angle(3); in stead of error_angle=euler_angle-attitude_target_euler_angle(2);