Referencing gimbal Yaw to airframe

How to use follow mode with 3 axis gimbals on airborne applications, so that the average heading of the gimbal is fixed to forward related to airframe.