From 296fb567ca8e658b46d94938aa5a020ded42cf06 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sat, 14 Nov 2020 20:50:50 +1100 Subject: [PATCH] AP_DAL: Enable default airspeed variance to be specified externally --- libraries/AP_DAL/AP_DAL.cpp | 6 ++++-- libraries/AP_DAL/AP_DAL.h | 4 ++-- libraries/AP_DAL/LogStructure.h | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libraries/AP_DAL/AP_DAL.cpp b/libraries/AP_DAL/AP_DAL.cpp index c074e5d57a..934d4ef308 100644 --- a/libraries/AP_DAL/AP_DAL.cpp +++ b/libraries/AP_DAL/AP_DAL.cpp @@ -174,11 +174,12 @@ void AP_DAL::log_SetOriginLLH2(const Location &loc) #endif } -void AP_DAL::log_writeDefaultAirSpeed2(const float aspeed) +void AP_DAL::log_writeDefaultAirSpeed2(const float aspeed, const float uncertainty) { #if !APM_BUILD_TYPE(APM_BUILD_AP_DAL_Standalone) && !APM_BUILD_TYPE(APM_BUILD_Replay) struct log_RWA2 pkt{ airspeed: aspeed, + uncertainty: uncertainty, }; WRITE_REPLAY_BLOCK(RWA2, pkt); #endif @@ -207,11 +208,12 @@ void AP_DAL::log_SetOriginLLH3(const Location &loc) #endif } -void AP_DAL::log_writeDefaultAirSpeed3(const float aspeed) +void AP_DAL::log_writeDefaultAirSpeed3(const float aspeed, const float uncertainty) { #if !APM_BUILD_TYPE(APM_BUILD_AP_DAL_Standalone) && !APM_BUILD_TYPE(APM_BUILD_Replay) struct log_RWA3 pkt{ airspeed: aspeed, + uncertainty: uncertainty }; WRITE_REPLAY_BLOCK(RWA3, pkt); #endif diff --git a/libraries/AP_DAL/AP_DAL.h b/libraries/AP_DAL/AP_DAL.h index 9a831abaac..c8027b090b 100644 --- a/libraries/AP_DAL/AP_DAL.h +++ b/libraries/AP_DAL/AP_DAL.h @@ -75,11 +75,11 @@ public: void log_event2(Event event); void log_SetOriginLLH2(const Location &loc); - void log_writeDefaultAirSpeed2(float aspeed); + void log_writeDefaultAirSpeed2(const float aspeed, const float uncertainty); void log_event3(Event event); void log_SetOriginLLH3(const Location &loc); - void log_writeDefaultAirSpeed3(float aspeed); + void log_writeDefaultAirSpeed3(const float aspeed, const float uncertainty); void log_writeEulerYawAngle(float yawAngle, float yawAngleErr, uint32_t timeStamp_ms, uint8_t type); enum class StateMask { diff --git a/libraries/AP_DAL/LogStructure.h b/libraries/AP_DAL/LogStructure.h index 6f60628ac3..8d39ac8b13 100644 --- a/libraries/AP_DAL/LogStructure.h +++ b/libraries/AP_DAL/LogStructure.h @@ -115,6 +115,7 @@ struct log_RSO2 { // @Description: Replay set-default-airspeed event struct log_RWA2 { float airspeed; + float uncertainty; uint8_t _end; }; @@ -365,13 +366,13 @@ struct log_RBOH { { LOG_RSO2_MSG, RLOG_SIZE(RSO2), \ "RSO2", "III", "Lat,Lon,Alt", "DUm", "GGB" }, \ { LOG_RWA2_MSG, RLOG_SIZE(RWA2), \ - "RWA2", "f", "Airspeed", "n", "0" }, \ + "RWA2", "ff", "Airspeed,uncertainty", "nn", "00" }, \ { LOG_REV3_MSG, RLOG_SIZE(REV3), \ "REV3", "B", "Event", "-", "-" }, \ { LOG_RSO3_MSG, RLOG_SIZE(RSO3), \ "RSO3", "III", "Lat,Lon,Alt", "DUm", "GGB" }, \ { LOG_RWA3_MSG, RLOG_SIZE(RWA3), \ - "RWA3", "f", "Airspeed", "n", "0" }, \ + "RWA3", "ff", "Airspeed,Uncertainty", "nn", "00" }, \ { LOG_REY3_MSG, RLOG_SIZE(REY3), \ "REY3", "ffIB", "yawangle,yawangleerr,timestamp_ms,type", "???-", "???-" }, \ { LOG_RISH_MSG, RLOG_SIZE(RISH), \