PID control algorithm

Hey guys! After weeks of work, finally I successfully am able to read all the values from the mpu6050 module with my Arduino Uno and convert them.
My angles are x, and y (I make it so the output is from -180° to 180°) and the °/s is GyX and GyY.( In °/s)
( I didn't use the 3rd axis as none of them were accurate and plan on adding magnometer later )

Bonus doubt: I don't know how the adjust the values in the complimentary filter, is there any method or is it just trial and error?

I want the drone to fly on stabilise mode.
I do have some experience in using PID to make a self balancing robot.
But now I don't know how to use both angles and °/s and implement it in the PID algorithm.

Can someone help me with it.

You'll probably need separate PID controllers for each axis you want to stabilize: x, y, and heading. As for tuning a complimentary filter, usually the weight of the acceleration term is around 2% and the gyro term at 98%, from there you can do trial and error. See this tutorial.

Thanks for the article about the complimentary filter.

Well for the PID I didn’t understand what values where I should use. I wanted some explanation for the picture attached, which I couldn’t understand how to implement.
A formula would be nice.

Looks like the dude in the pic used two PID controllers for each axis.

The "Stabilize" controller uses the difference between the axis's angle and the setpoint to output a desired rotational rate around the axis. This rate output becomes the "Rate" controller's setpoint. The difference between the average rotational velocity from the gyro and the setpoint (output of the "Stabilize" controller) is used by the "Rate" controller to determine motor speeds.

Does that help?

As for formulas, you can google "PID" - lots of documentation has been done on it. Also, PID controllers are best understood using block diagrams:

Well I was able to understand it now, but now I think that is complicated. I am thinking of dropping this method.

I think this will work better, hoop Brookings video

I first didn't go for this cause i couldn't understand how he's converting the transmitters input to rotational rate.
It would really help if you could explain joop Brookings method also.
mainly i didn't understand how he used both angle and rotational rate in one pid.

Thanks.