I can't believe I finally made this! 🤣 Tuning the PID wasn't easy! I didn't know that derivative gain can cause instability. I was raising the derivative gain just a bit, and then boom! Instability! I've read that it is because derivative gain also amplifies noises and can make the system overreacted.
I watched VDEngineering's video ( • MATLAB & Simulink Tutorial: Quadrotor UAV ... ) to make this simulation. The difference between his model and mine is that his controls the position, while my model controls the velocity of the quadcopter.
I modeled the quadcopter so that they can only apply upward forces, so they have to use gravity to move downwards.