Unstable flight, drone is leaping from side to side

Hello,

I had a strange flight where the drone was very unstable in air trying to balance and maintain its position by short roll and pitch movements, almost no wind. It is my first flight with this setup and I was wondering if someone can take a look into the log before I am starting to replace dorne parts one by one.
log - https://logs.px4.io/plot_app?log=8dfa4940-16f4-4934-b91b-281926d05ce9
S500
Pixhawk clone 2.4.8, m8n gps
ESC 40A
T-motor 2216 with 1045 props
5200maH 60C lipo

Hi @Yonatan_Ridelman,

You need to tune the rate PID controllers: https://docs.px4.io/master/en/config_mc/pid_tuning_guide_multicopter.html#multicopter-pid-tuning-guide

Thank you for your response bresch.
I am a bit concern of flying again with this unstable setup. Luckily I did not crash last time.
Is there an offline way of getting the correct PID parameters without having to fly the drone and set the parameters during flight ?

Is there an offline way of getting the correct PID parameters without having to fly the drone and set the parameters during flight ?

It is possible but extremely complicated, so no.

Looking at the log, the main issue seems to be the roll rate loop; the gain is too large. You can set MC_ROLLRATE_K to 0.5 and it should be flyable. Then you can start tuning from there.

I will definitely try this one.
Is there a reason why the PID tuning is needed only for roll and not for pitch. I would expect a similar behavior for pitch and roll because of drone symmetry ?
The only thing that may break the symmetry is the battery which is parallel to the roll axis. I am worry about having some bad motor or esc.

Hi Bresch,

Thanks a lot for your help. The in-flight PID tuning fixed the issue. During the tuning there was relativly strong wind and I had to use Position mode. Reducing MC_ROLLRATE_P and MC_ROLLRATE_D did the magic. Here are the logs collected during PID tuning: