ArduPlane 4.0.1 Custom Flight Mode Help

I am attempting to create a custom flight mode for a plane running 4.0.1 ArduPlane software. I’m familiar with the environment setups and have everything ready to compile my own version of Ardupilot and installing it onto the plane.

My doubts come when making the code for this new custom flight mode. I’ve been scouring over the repository for days now and while this page helped a little I am still uncertain as to what each method does, where variables are stored, etc.

The flight mode is essentially aiming to fly in something similar to FBWB but changing pitch and throttle depending on inputs from sensors on the craft. Is there any way I can get some help regarding how to read from the sensors and update the correct variables / methods during flight?

Thanks in advance.