6#include <janus/janus.hpp>
28template <
typename Scalar,
int M>
31 const Eigen::Matrix<Scalar, M, M> &S) {
32 return (innovation.transpose() * S.inverse() * innovation)(0, 0);
57template <
typename Scalar,
int M>
58bool passes_gate(
const Eigen::Matrix<Scalar, M, 1> &innovation,
59 const Eigen::Matrix<Scalar, M, M> &S,
double threshold) {
61 return static_cast<double>(nis) <= threshold;
78template <
typename Scalar,
int M>
80 const Eigen::Matrix<Scalar, M, 1> &z_pred,
81 const Eigen::Matrix<Scalar, M, M> &S,
83 Eigen::Matrix<Scalar, M, 1> innovation = z - z_pred;
109template <
int N,
int M>
110Eigen::Matrix<double, N, N>
112 const Eigen::Matrix<double, N, M> &K,
113 const Eigen::Matrix<double, M, N> &H,
114 const Eigen::Matrix<double, M, M> &R) {
115 Eigen::Matrix<double, N, N> I = Eigen::Matrix<double, N, N>::Identity();
116 Eigen::Matrix<double, N, N> IKH = I - K * H;
119 return IKH * P_prior * IKH.transpose() + K * R * K.transpose();
138 if (confidence >= 0.99) {
154 return dof + 2.33 * std::sqrt(2.0 * dof);
173 return dof + 1.645 * std::sqrt(2.0 * dof);
194Eigen::Matrix<double, N, N>
symmetrize(
const Eigen::Matrix<double, N, N> &P) {
195 return 0.5 * (P + P.transpose());
Definition EstimationTypes.hpp:8
Scalar normalized_innovation_squared(const Eigen::Matrix< Scalar, M, 1 > &innovation, const Eigen::Matrix< Scalar, M, M > &S)
Compute normalized innovation squared (NIS).
Definition EstimationUtils.hpp:30
bool passes_gate(const Eigen::Matrix< Scalar, M, 1 > &innovation, const Eigen::Matrix< Scalar, M, M > &S, double threshold)
Chi-squared gating for outlier rejection.
Definition EstimationUtils.hpp:58
Eigen::Matrix< double, N, N > joseph_update(const Eigen::Matrix< double, N, N > &P_prior, const Eigen::Matrix< double, N, M > &K, const Eigen::Matrix< double, M, N > &H, const Eigen::Matrix< double, M, M > &R)
Joseph form covariance update.
Definition EstimationUtils.hpp:111
double chi_squared_threshold(int dof, double confidence=0.95)
Chi-squared threshold lookup.
Definition EstimationUtils.hpp:136
Eigen::Matrix< double, N, N > symmetrize(const Eigen::Matrix< double, N, N > &P)
Enforce covariance matrix symmetry.
Definition EstimationUtils.hpp:194
bool measurement_passes_gate(const Eigen::Matrix< Scalar, M, 1 > &z, const Eigen::Matrix< Scalar, M, 1 > &z_pred, const Eigen::Matrix< Scalar, M, M > &S, double threshold)
Compute innovation and check gate in one call.
Definition EstimationUtils.hpp:79