diff --git a/src/modules/ekf2/EKF/python/ekf_derivation/generated/predict_covariance.h b/src/modules/ekf2/EKF/python/ekf_derivation/generated/predict_covariance.h index 5fa0ad1772d1..1ff79d8c7e61 100644 --- a/src/modules/ekf2/EKF/python/ekf_derivation/generated/predict_covariance.h +++ b/src/modules/ekf2/EKF/python/ekf_derivation/generated/predict_covariance.h @@ -236,57 +236,16 @@ matrix::Matrix PredictCovariance(const matrix::Matrix _res; + _res.setZero(); + _res(0, 0) = std::pow(_tmp15, Scalar(2)) * gyro_var + _tmp15 * _tmp27 + _tmp18 * _tmp26 + std::pow(_tmp23, Scalar(2)) * gyro_var + _tmp23 * _tmp25 + _tmp24 * _tmp6 + std::pow(_tmp6, Scalar(2)) * gyro_var; - _res(1, 0) = 0; - _res(2, 0) = 0; - _res(3, 0) = 0; - _res(4, 0) = 0; - _res(5, 0) = 0; - _res(6, 0) = 0; - _res(7, 0) = 0; - _res(8, 0) = 0; - _res(9, 0) = 0; - _res(10, 0) = 0; - _res(11, 0) = 0; - _res(12, 0) = 0; - _res(13, 0) = 0; - _res(14, 0) = 0; - _res(15, 0) = 0; - _res(16, 0) = 0; - _res(17, 0) = 0; - _res(18, 0) = 0; - _res(19, 0) = 0; - _res(20, 0) = 0; - _res(21, 0) = 0; - _res(22, 0) = 0; _res(0, 1) = _tmp15 * _tmp38 + _tmp18 * _tmp35 + _tmp24 * _tmp34 + _tmp25 * _tmp29 + _tmp27 * _tmp36 + _tmp29 * _tmp37 + _tmp34 * _tmp39; _res(1, 1) = _tmp18 * _tmp43 + std::pow(_tmp29, Scalar(2)) * gyro_var + _tmp29 * _tmp40 + std::pow(_tmp34, Scalar(2)) * gyro_var + _tmp34 * _tmp41 + std::pow(_tmp36, Scalar(2)) * gyro_var + _tmp36 * _tmp42; - _res(2, 1) = 0; - _res(3, 1) = 0; - _res(4, 1) = 0; - _res(5, 1) = 0; - _res(6, 1) = 0; - _res(7, 1) = 0; - _res(8, 1) = 0; - _res(9, 1) = 0; - _res(10, 1) = 0; - _res(11, 1) = 0; - _res(12, 1) = 0; - _res(13, 1) = 0; - _res(14, 1) = 0; - _res(15, 1) = 0; - _res(16, 1) = 0; - _res(17, 1) = 0; - _res(18, 1) = 0; - _res(19, 1) = 0; - _res(20, 1) = 0; - _res(21, 1) = 0; - _res(22, 1) = 0; _res(0, 2) = _tmp15 * _tmp47 * gyro_var + _tmp18 * _tmp46 + _tmp24 * _tmp44 + _tmp25 * _tmp45 + _tmp27 * _tmp47 + _tmp37 * _tmp45 + _tmp39 * _tmp44; _res(1, 2) = _tmp18 * _tmp48 + _tmp29 * _tmp45 * gyro_var + _tmp34 * _tmp44 * gyro_var + @@ -294,26 +253,6 @@ matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix PredictCovariance(const matrix::Matrix& P, const if (P_new != nullptr) { matrix::Matrix& _p_new = (*P_new); + _p_new.setZero(); + _p_new(0, 0) = -P(0, 0) * _tmp9 + P(0, 0) - P(1, 0) * _tmp12; - _p_new(1, 0) = 0; - _p_new(2, 0) = 0; _p_new(0, 1) = -P(0, 1) * _tmp9 + P(0, 1) - P(1, 1) * _tmp12; _p_new(1, 1) = -P(0, 1) * _tmp10 - P(1, 1) * _tmp13 + P(1, 1); - _p_new(2, 1) = 0; _p_new(0, 2) = -P(0, 2) * _tmp9 + P(0, 2) - P(1, 2) * _tmp12; _p_new(1, 2) = -P(0, 2) * _tmp10 - P(1, 2) * _tmp13 + P(1, 2); _p_new(2, 2) = -P(0, 2) * _tmp11 - P(1, 2) * _tmp14 + P(2, 2); diff --git a/src/modules/ekf2/EKF/yaw_estimator/derivation/generated/yaw_est_predict_covariance.h b/src/modules/ekf2/EKF/yaw_estimator/derivation/generated/yaw_est_predict_covariance.h index 5d2c4327a55a..d3fefb61d848 100644 --- a/src/modules/ekf2/EKF/yaw_estimator/derivation/generated/yaw_est_predict_covariance.h +++ b/src/modules/ekf2/EKF/yaw_estimator/derivation/generated/yaw_est_predict_covariance.h @@ -24,14 +24,14 @@ namespace sym { * d_ang_var: Scalar * * Outputs: - * P_new: Matrix33 + * res: Matrix33 */ template -void YawEstPredictCovariance(const matrix::Matrix& state, - const matrix::Matrix& P, - const matrix::Matrix& d_vel, const Scalar d_vel_var, - const Scalar d_ang, const Scalar d_ang_var, - matrix::Matrix* const P_new = nullptr) { +matrix::Matrix YawEstPredictCovariance(const matrix::Matrix& state, + const matrix::Matrix& P, + const matrix::Matrix& d_vel, + const Scalar d_vel_var, const Scalar d_ang, + const Scalar d_ang_var) { // Total ops: 39 // Input arrays @@ -48,19 +48,18 @@ void YawEstPredictCovariance(const matrix::Matrix& state, const Scalar _tmp7 = std::pow(d_ang, Scalar(2)) + 1; // Output terms (1) - if (P_new != nullptr) { - matrix::Matrix& _p_new = (*P_new); + matrix::Matrix _res; - _p_new(0, 0) = P(0, 0) + P(2, 0) * _tmp2 + _tmp2 * _tmp3 + _tmp4; - _p_new(1, 0) = 0; - _p_new(2, 0) = 0; - _p_new(0, 1) = P(0, 1) + P(2, 1) * _tmp2 + _tmp3 * _tmp5; - _p_new(1, 1) = P(1, 1) + P(2, 1) * _tmp5 + _tmp4 + _tmp5 * _tmp6; - _p_new(2, 1) = 0; - _p_new(0, 2) = _tmp3 * _tmp7; - _p_new(1, 2) = _tmp6 * _tmp7; - _p_new(2, 2) = P(2, 2) * std::pow(_tmp7, Scalar(2)) + d_ang_var; - } + _res.setZero(); + + _res(0, 0) = P(0, 0) + P(2, 0) * _tmp2 + _tmp2 * _tmp3 + _tmp4; + _res(0, 1) = P(0, 1) + P(2, 1) * _tmp2 + _tmp3 * _tmp5; + _res(1, 1) = P(1, 1) + P(2, 1) * _tmp5 + _tmp4 + _tmp5 * _tmp6; + _res(0, 2) = _tmp3 * _tmp7; + _res(1, 2) = _tmp6 * _tmp7; + _res(2, 2) = P(2, 2) * std::pow(_tmp7, Scalar(2)) + d_ang_var; + + return _res; } // NOLINT(readability/fn_size) // NOLINTNEXTLINE(readability/fn_size)