Browse Source

DataFlash: added GPA and GPA2 messages for GPS accuracy

this reverts the GPS format to the old format, thus fixing log
analysers
mission-4.1.18
Andrew Tridgell 10 years ago
parent
commit
c5cd310818
  1. 24
      libraries/DataFlash/DataFlash.h
  2. 16
      libraries/DataFlash/LogFile.cpp

24
libraries/DataFlash/DataFlash.h

@ -215,7 +215,6 @@ struct PACKED log_GPS { @@ -215,7 +215,6 @@ struct PACKED log_GPS {
uint16_t gps_week;
uint8_t num_sats;
uint16_t hdop;
uint16_t vdop;
int32_t latitude;
int32_t longitude;
int32_t rel_altitude;
@ -226,6 +225,15 @@ struct PACKED log_GPS { @@ -226,6 +225,15 @@ struct PACKED log_GPS {
uint8_t used;
};
struct PACKED log_GPA {
LOG_PACKET_HEADER;
uint64_t time_us;
uint16_t vdop;
uint16_t hacc;
uint16_t vacc;
uint16_t sacc;
};
struct PACKED log_Message {
LOG_PACKET_HEADER;
uint64_t time_us;
@ -693,7 +701,13 @@ Format characters in the format string for binary log messages @@ -693,7 +701,13 @@ Format characters in the format string for binary log messages
{ LOG_PARAMETER_MSG, sizeof(log_Parameter), \
"PARM", "QNf", "TimeUS,Name,Value" }, \
{ LOG_GPS_MSG, sizeof(log_GPS), \
"GPS", "QBIHBccLLeeEefB", "TimeUS,Stat,GMS,GWk,NSat,EPH,EPV,Lat,Lng,RAlt,Alt,Spd,GCrs,VZ,U" }, \
"GPS", "QBIHBcLLeeEefB", "TimeUS,Status,GMS,GWk,NSats,HDop,Lat,Lng,RAlt,Alt,Spd,GCrs,VZ,U" }, \
{ LOG_GPS2_MSG, sizeof(log_GPS), \
"GPS2", "QBIHBcLLeeEefB", "TimeUS,Status,GMS,GWk,NSats,HDop,Lat,Lng,RAlt,Alt,Spd,GCrs,VZ,U" }, \
{ LOG_GPA_MSG, sizeof(log_GPA), \
"GPA", "QCCCC", "TimeUS,VDop,HAcc,VAcc,SAcc" }, \
{ LOG_GPA2_MSG, sizeof(log_GPA), \
"GPA2", "QCCCC", "TimeUS,VDop,HAcc,VAcc,SAcc" }, \
{ LOG_IMU_MSG, sizeof(log_IMU), \
"IMU", "QffffffIIfBB", "TimeUS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ,ErrG,ErrA,Temp,GyHlt,AcHlt" }, \
{ LOG_MESSAGE_MSG, sizeof(log_Message), \
@ -725,8 +739,6 @@ Format characters in the format string for binary log messages @@ -725,8 +739,6 @@ Format characters in the format string for binary log messages
// messages for more advanced boards
#define LOG_EXTRA_STRUCTURES \
{ LOG_GPS2_MSG, sizeof(log_GPS), \
"GPS2", "QBIHBcLLeeEefB", "TimeUS,Status,GMS,GWk,NSats,HDop,Lat,Lng,RAlt,Alt,Spd,GCrs,VZ,U" }, \
{ LOG_IMU2_MSG, sizeof(log_IMU), \
"IMU2", "QffffffIIfBB", "TimeUS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ,ErrG,ErrA,Temp,GyHlt,AcHlt" }, \
{ LOG_IMU3_MSG, sizeof(log_IMU), \
@ -894,7 +906,9 @@ enum LogMessages { @@ -894,7 +906,9 @@ enum LogMessages {
LOG_IMUDT2_MSG,
LOG_IMUDT3_MSG,
LOG_ORGN_MSG,
LOG_RPM_MSG
LOG_RPM_MSG,
LOG_GPA_MSG,
LOG_GPA2_MSG,
};
enum LogOriginType {

16
libraries/DataFlash/LogFile.cpp

@ -720,7 +720,6 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati @@ -720,7 +720,6 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati
gps_week : gps.time_week(i),
num_sats : gps.num_sats(i),
hdop : gps.get_hdop(i),
vdop : gps.get_vdop(i),
latitude : loc.lat,
longitude : loc.lng,
rel_altitude : relative_alt,
@ -731,6 +730,21 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati @@ -731,6 +730,21 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati
used : (uint8_t)(gps.primary_sensor() == i)
};
WriteBlock(&pkt, sizeof(pkt));
/* write auxillary accuracy information as well */
float hacc = 0, vacc = 0, sacc = 0;
gps.horizontal_accuracy(i, hacc);
gps.vertical_accuracy(i, vacc);
gps.speed_accuracy(i, sacc);
struct log_GPA pkt2 = {
LOG_PACKET_HEADER_INIT((uint8_t)(LOG_GPA_MSG+i)),
time_us : hal.scheduler->micros64(),
vdop : gps.get_vdop(i),
hacc : (uint16_t)(hacc*100),
vacc : (uint16_t)(vacc*100),
sacc : (uint16_t)(sacc*100)
};
WriteBlock(&pkt2, sizeof(pkt2));
}
// Write an RCIN packet

Loading…
Cancel
Save