ArduPlane: Correct OSD horizon for VTOL modes and TRIM_PITCH_CD in Fixed Wing

This commit is contained in:
Hwurzburg 2021-08-01 13:34:37 -05:00 committed by Andrew Tridgell
parent b69308858a
commit 1e4a6c9236
2 changed files with 18 additions and 0 deletions

View File

@ -689,4 +689,19 @@ bool Plane::get_target_location(Location& target_loc)
}
#endif // ENABLE_SCRIPTING
#if OSD_ENABLED
// correct AHRS pitch for TRIM_PITCH_CD in non-VTOL modes, and return VTOL view in VTOL
void Plane::get_osd_roll_pitch_rad(float &roll, float &pitch) const
{
pitch = ahrs.pitch;
roll = ahrs.roll;
if (!quadplane.show_vtol_view()) { // correct for TRIM_PITCH_CD
pitch -= g.pitch_trim_cd * 0.01 * DEG_TO_RAD;
} else {
pitch = quadplane.ahrs_view->pitch;
roll = quadplane.ahrs_view->roll;
}
}
#endif
AP_HAL_MAIN_CALLBACKS(&plane);

View File

@ -950,6 +950,9 @@ private:
// ArduPlane.cpp
void disarm_if_autoland_complete();
# if OSD_ENABLED
void get_osd_roll_pitch_rad(float &roll, float &pitch) const override;
#endif
float tecs_hgt_afe(void);
void efi_update(void);
void get_scheduler_tasks(const AP_Scheduler::Task *&tasks,