Testing/tuning custom quadcopter software for a graduate project. Starting out, the P gains were too high and the quadcopter would just flip around the rope. I eventually lowered the P and D gains to have average performance but it still seemed to have trouble auto leveling and maintaining an angle when rolling or pitching. I eventually found a huge bottle neck with the way I was reading the receiver channels using pulseIn on the Arduino for analog signals. The timeout was set to 25,000 microseconds, I managed to get it to 16,000 microseconds and still have the receiver inputs working but it was still slowing down the main loop to the point where the quadcopter was a little sluggish and having trouble maintaining level flight. I eventually had to use an interrupt based solution from the open source project Aeroquad. Now it seems to read the accelerometer and gyro much faster after removing the receiver bottle neck. I also increased the speed controllers update speed from 300hz to 400hz (ESC would need to support those refresh rates, the DJI 18 amp ones I have on this quadcopter do support up to 450hz I believe).It auto levels almost instantly and holds on roll angles as I control it in the video. The gains may need a little more tuning but this is a huge improvement from what I had a few days ago. Sorry for the video quality I'll take another during the day.
I'm using a Direction Cosine Matrix attitude estimation algorithm with PID controllers on an Arduino Mega 2560. Sensors: 3 axis accelerometer, 3 axis gyroscope, 3 axis magnetometer, and a barometer.