2021-02-17 18:34:14 -04:00
|
|
|
#include "EKFGSF_yaw.h"
|
|
|
|
|
|
|
|
#include <AP_Logger/AP_Logger.h>
|
|
|
|
|
2023-07-13 21:58:07 -03:00
|
|
|
#if HAL_LOGGING_ENABLED
|
|
|
|
|
2021-05-04 08:12:23 -03:00
|
|
|
#pragma GCC diagnostic ignored "-Wnarrowing"
|
|
|
|
|
2021-02-17 18:34:14 -04:00
|
|
|
void EKFGSF_yaw::Log_Write(uint64_t time_us, LogMessages id0, LogMessages id1, uint8_t core_index)
|
|
|
|
{
|
|
|
|
if (!vel_fuse_running) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static_assert(N_MODELS_EKFGSF >= 5, "Logging will break on <5 EKFGSF models");
|
|
|
|
|
|
|
|
const struct log_KY0 ky0{
|
|
|
|
LOG_PACKET_HEADER_INIT(id0),
|
|
|
|
time_us : time_us,
|
|
|
|
core : core_index,
|
2022-04-15 22:11:32 -03:00
|
|
|
yaw_composite : wrap_360(degrees(GSF.yaw)),
|
|
|
|
yaw_composite_variance : sqrtF(MAX(degrees(GSF.yaw_variance), 0.0f)),
|
|
|
|
yaw0 : wrap_360(degrees(EKF[0].X[2])),
|
|
|
|
yaw1 : wrap_360(degrees(EKF[1].X[2])),
|
|
|
|
yaw2 : wrap_360(degrees(EKF[2].X[2])),
|
|
|
|
yaw3 : wrap_360(degrees(EKF[3].X[2])),
|
|
|
|
yaw4 : wrap_360(degrees(EKF[4].X[2])),
|
2021-02-17 18:34:14 -04:00
|
|
|
wgt0 : GSF.weights[0],
|
|
|
|
wgt1 : GSF.weights[1],
|
|
|
|
wgt2 : GSF.weights[2],
|
|
|
|
wgt3 : GSF.weights[3],
|
|
|
|
wgt4 : GSF.weights[4],
|
|
|
|
};
|
|
|
|
AP::logger().WriteBlock(&ky0, sizeof(ky0));
|
|
|
|
|
|
|
|
const struct log_KY1 ky1{
|
|
|
|
LOG_PACKET_HEADER_INIT(id1),
|
|
|
|
time_us : time_us,
|
|
|
|
core : core_index,
|
|
|
|
ivn0 : EKF[0].innov[0],
|
|
|
|
ivn1 : EKF[1].innov[0],
|
|
|
|
ivn2 : EKF[2].innov[0],
|
|
|
|
ivn3 : EKF[3].innov[0],
|
|
|
|
ivn4 : EKF[4].innov[0],
|
|
|
|
ive0 : EKF[0].innov[1],
|
|
|
|
ive1 : EKF[1].innov[1],
|
|
|
|
ive2 : EKF[2].innov[1],
|
|
|
|
ive3 : EKF[3].innov[1],
|
|
|
|
ive4 : EKF[4].innov[1],
|
|
|
|
};
|
|
|
|
AP::logger().WriteBlock(&ky1, sizeof(ky1));
|
|
|
|
}
|
2023-07-13 21:58:07 -03:00
|
|
|
|
|
|
|
#endif // HAL_LOGGING_ENABLED
|