Skip to content
Snippets Groups Projects
Commit a9eec29e authored by priseborough's avatar priseborough Committed by Andrew Tridgell
Browse files

DataFlash: Update EKF optical flow data logging

parent 69e86d3e
No related branches found
No related tags found
No related merge requests found
...@@ -354,12 +354,13 @@ struct PACKED log_EKF5 { ...@@ -354,12 +354,13 @@ struct PACKED log_EKF5 {
uint32_t time_ms; uint32_t time_ms;
int16_t FIX; int16_t FIX;
int16_t FIY; int16_t FIY;
int16_t AFIX; uint8_t normInnovFX;
int16_t AFIY; uint8_t normInnovFY;
int16_t gndPos; uint16_t estHAGL;
uint8_t scaler; uint8_t scaler;
int16_t RI; int16_t RI;
uint16_t range; uint16_t meaRng;
uint16_t errHAGL;
}; };
struct PACKED log_Cmd { struct PACKED log_Cmd {
...@@ -531,7 +532,7 @@ struct PACKED log_Esc { ...@@ -531,7 +532,7 @@ struct PACKED log_Esc {
{ LOG_ESC8_MSG, sizeof(log_Esc), \ { LOG_ESC8_MSG, sizeof(log_Esc), \
"ESC8", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \ "ESC8", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
{ LOG_EKF5_MSG, sizeof(log_EKF5), \ { LOG_EKF5_MSG, sizeof(log_EKF5), \
"EKF5","IhhhhcBcC","TimeMS,FIX,FIY,AFIX,AFIY,gndPos,fScaler,RI,rng" } "EKF5","IhhBBCBcCC","TimeMS,FIX,FIY,SFX,SFY,estHAGL,fScaler,RI,meaRng,errHAGL" }
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75 #if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
#define LOG_COMMON_STRUCTURES LOG_BASE_STRUCTURES, LOG_EXTRA_STRUCTURES #define LOG_COMMON_STRUCTURES LOG_BASE_STRUCTURES, LOG_EXTRA_STRUCTURES
......
...@@ -1009,23 +1009,25 @@ void DataFlash_Class::Log_Write_EKF(AP_AHRS_NavEKF &ahrs, bool optFlowEnabled) ...@@ -1009,23 +1009,25 @@ void DataFlash_Class::Log_Write_EKF(AP_AHRS_NavEKF &ahrs, bool optFlowEnabled)
// Write fifth EKF packet // Write fifth EKF packet
if (optFlowEnabled) { if (optFlowEnabled) {
float fscale; float fscale;
float gndPos; float estHAGL;
float flowInnovX, flowInnovY; float flowInnovX, flowInnovY;
float augFlowInnovX, augFlowInnovY; float flowVarX, flowVarY;
float rngInnov; float rngInnov;
float range; float range;
ahrs.get_NavEKF().getFlowDebug(fscale, gndPos, flowInnovX, flowInnovY, augFlowInnovX, augFlowInnovY, rngInnov, range); float gndOffsetErr;
ahrs.get_NavEKF().getFlowDebug(fscale, estHAGL, flowInnovX, flowInnovY, flowVarX, flowVarY, rngInnov, range, gndOffsetErr);
struct log_EKF5 pkt5 = { struct log_EKF5 pkt5 = {
LOG_PACKET_HEADER_INIT(LOG_EKF5_MSG), LOG_PACKET_HEADER_INIT(LOG_EKF5_MSG),
time_ms : hal.scheduler->millis(), time_ms : hal.scheduler->millis(),
FIX : (int16_t)(1000*flowInnovX), FIX : (int16_t)(1000*flowInnovX),
FIY : (int16_t)(1000*flowInnovY), FIY : (int16_t)(1000*flowInnovY),
AFIX : (int16_t)(1000*augFlowInnovX), normInnovFX : min((uint8_t)(100*flowVarX),255),
AFIY : (int16_t)(1000*augFlowInnovY), normInnovFY : min((uint8_t)(100*flowVarY),255),
gndPos : (int16_t)(100*gndPos), estHAGL : (uint16_t)(100*estHAGL),
scaler: (uint8_t)(100*fscale), scaler: (uint8_t)(100*fscale),
RI : (int16_t)(100*rngInnov), RI : (int16_t)(100*rngInnov),
range : (uint16_t)(100*range) meaRng : (uint16_t)(100*range),
errHAGL : (uint16_t)(100*gndOffsetErr)
}; };
WriteBlock(&pkt5, sizeof(pkt5)); WriteBlock(&pkt5, sizeof(pkt5));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment