Understanding stabilization while loitering


We are thinking of using px4 for experimentation using simulators. We want to understand how stabilization is managed in PX4 while loitering at a certain height. From what we understand so far, set points are the pitch, roll and yaw values that we want it to have. But if there are certain environmental factors acting such as wind which make the multicopter tilt in some way, then how and at exactly which part of the code does the system correct that and make itself stay level?


There is a nested attitude and position control.
“Errors” in position become setpoints for attitude and thrust.

You need to learn some basics of control system and modeling of multicopters to understand the logic behind it.