and here is also the answer:
Yes, the estimation of the terrain altitude takes into account the altitude of the UAV and can be found here.
When changing the altimeter on a stabilized gimbal, you will need to change the code to not account for the tilt angle.