From 2e02ee1df83e1818f5c34f748795dfc7024f23ab Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 30 Dec 2019 09:34:44 +0900 Subject: [PATCH] AP_OADatabase: send_adsb uses vehicle's current altitude --- libraries/AC_Avoidance/AP_OADatabase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AC_Avoidance/AP_OADatabase.cpp b/libraries/AC_Avoidance/AP_OADatabase.cpp index 762acbe1bd..c888603e40 100644 --- a/libraries/AC_Avoidance/AP_OADatabase.cpp +++ b/libraries/AC_Avoidance/AP_OADatabase.cpp @@ -341,6 +341,12 @@ void AP_OADatabase::send_adsb_vehicle(mavlink_channel_t chan, uint16_t interval_ return; } + // use vehicle's current altitude + Location current_loc; + if (!AP::ahrs().get_position(current_loc)) { + current_loc.alt = 0; + } + const uint8_t chan_as_bitmask = 1 << chan; const char callsign[9] = "OA_DB"; @@ -381,7 +387,7 @@ void AP_OADatabase::send_adsb_vehicle(mavlink_channel_t chan, uint16_t interval_ item_loc.lat, item_loc.lng, 0, // altitude_type - 0, // altitude is always zero + current_loc.alt, // use vehicle's current altitude 0, // heading 0, // hor_velocity 0, // ver_velocity