How does Autotune Function work?

Hi everyone,
Is there anyone know where is .cpp file which run for Autotune function ?

Not very hard to find

Thanks. But what theory they use to implement autotune PID? The code didn’t show any method to autotune PID.

The first few lines of comments can help you

 * What it's doing during each "twitch":
 *      a) invokes 90 deg/sec rate request
 *      b) records maximum "forward" roll rate and bounce back rate
 *      c) when copter reaches 20 degrees or 1 second has passed, it commands level
 *      d) tries to keep max rotation rate between 80% ~ 100% of requested rate (90deg/sec) by adjusting rate P
 *      e) increases rate D until the bounce back becomes greater than 10% of requested rate (90deg/sec)
 *      f) decreases rate D until the bounce back becomes less than 10% of requested rate (90deg/sec)
 *      g) increases rate P until the max rotate rate becomes greater than the request rate (90deg/sec)
 *      h) invokes a 20deg angle request on roll or pitch
 *      i) increases stab P until the maximum angle becomes greater than 110% of the requested angle (20deg)
 *      j) decreases stab P by 25%

What is the principle of this autotune process? Is there any theory or literature that can be referred to; I don’t understand the meaning of ‘bounce back’. I can’t understand the adjustment principle of D value