Browse Source

DataFlash: Update for AHRS NED changes

Report both origin and home NED altitudes to the log file
mission-4.1.18
Michael du Breuil 8 years ago committed by Andrew Tridgell
parent
commit
31f1545223
  1. 16
      libraries/DataFlash/LogFile.cpp
  2. 5
      libraries/DataFlash/LogStructure.h

16
libraries/DataFlash/LogFile.cpp

@ -1107,15 +1107,17 @@ void DataFlash_Class::Log_Write_POS(AP_AHRS &ahrs) @@ -1107,15 +1107,17 @@ void DataFlash_Class::Log_Write_POS(AP_AHRS &ahrs)
if (!ahrs.get_position(loc)) {
return;
}
Vector3f pos;
ahrs.get_relative_position_NED(pos);
float home, origin;
ahrs.get_relative_position_D_home(home);
ahrs.get_relative_position_D_origin(origin);
struct log_POS pkt = {
LOG_PACKET_HEADER_INIT(LOG_POS_MSG),
time_us : AP_HAL::micros64(),
lat : loc.lat,
lng : loc.lng,
alt : loc.alt*1.0e-2f,
rel_alt : -pos.z
time_us : AP_HAL::micros64(),
lat : loc.lat,
lng : loc.lng,
alt : loc.alt*1.0e-2f,
rel_home_alt : -home,
rel_origin_alt : -origin
};
WriteBlock(&pkt, sizeof(pkt));
}

5
libraries/DataFlash/LogStructure.h

@ -210,7 +210,8 @@ struct PACKED log_POS { @@ -210,7 +210,8 @@ struct PACKED log_POS {
int32_t lat;
int32_t lng;
float alt;
float rel_alt;
float rel_home_alt;
float rel_origin_alt;
};
struct PACKED log_POWR {
@ -835,7 +836,7 @@ Format characters in the format string for binary log messages @@ -835,7 +836,7 @@ Format characters in the format string for binary log messages
{ LOG_AHR2_MSG, sizeof(log_AHRS), \
"AHR2","QccCfLL","TimeUS,Roll,Pitch,Yaw,Alt,Lat,Lng" }, \
{ LOG_POS_MSG, sizeof(log_POS), \
"POS","QLLff","TimeUS,Lat,Lng,Alt,RelAlt" }, \
"POS","QLLfff","TimeUS,Lat,Lng,Alt,RelHomeAlt,RelOriginAlt" }, \
{ LOG_SIMSTATE_MSG, sizeof(log_AHRS), \
"SIM","QccCfLL","TimeUS,Roll,Pitch,Yaw,Alt,Lat,Lng" }, \
{ LOG_NKF1_MSG, sizeof(log_EKF1), \

Loading…
Cancel
Save