Where is the fast_loop() called and following that what is the first file executed (entry point)?

I have a question. From my understanding, the ‘fast_loop()’ in Copter.cpp is the main the scheduler task that comes first and takes care of reading IMU, calling motor mixing and all other core functions etc. The other tasks in the scheduler table follow.
However the fast_loop() isnt included in the scheduler table defined in Copter.cpp so where is it being called? I thought copter.cpp was the first file executed according to this image (From the docs):

Which file is the very first executed?, Is it a scheduler file because the scheduler initializaiton and calling of fast_loop() etc. isnt in copter.cpp and unless im blind I cant see another file that looks like an entry point to the whole thing calling those functions?

Hi @clinteastwood,

I think of the two main entry points as “init()” and “loop()”. So “init” is called once when the autopilot is first booted up and then loop() is called as quickly as possible from then on. The “fast_loop()” and scheduler are called from within “loop”. On each iteration the “fast_loop” runs first so that we can get all the critical methods out of the way (AHRS update, flight mode’s run, navigation, position control, attitude control and motor outputs) and then all the less critical methods can run from the scheduler.

I think the “init()” and “loop()” may be off in AP_Vehicle which is actually the parent class of all the vehicle types.