27 int nNumberSigmaPoints = 2 * nNumberDimensions + 1;
28 Eigen::MatrixXd sigmaPoints(nNumberDimensions, nNumberSigmaPoints);
29 Eigen::VectorXd w_m(nNumberSigmaPoints);
30 Eigen::VectorXd w_c(nNumberSigmaPoints);
33 float fLamda = m_fAlpha * m_fAlpha * (nNumberDimensions - m_fKappa) - nNumberDimensions;
36 sigmaPoints.block(0, 0, sigmaPoints.rows(), 1) = gaussian.
getMean();
37 w_m(0) = fLamda / (nNumberDimensions + fLamda);
38 w_c(0) = fLamda / (nNumberDimensions + fLamda) + (1 - m_fAlpha * m_fAlpha + m_fBeta);
41 Eigen::MatrixXd diff(nNumberDimensions, nNumberDimensions);
42 diff = (nNumberDimensions + fLamda) * gaussian.
getCovariance();
45 diff = squareRoot(diff);
48 Eigen::VectorXd point1(nNumberDimensions);
49 Eigen::VectorXd point2(nNumberDimensions);
53 for (
int i = 0 ; i < nNumberDimensions ; i++)
56 point1 = gaussian.
getMean() + diff.block(i, 0, 1, diff.cols()).transpose();
57 point2 = gaussian.
getMean() - diff.block(i, 0, 1, diff.cols()).transpose();
58 sigmaPoints.block(0, 2 * i + 1, sigmaPoints.rows(), 1) = point1;
59 sigmaPoints.block(0, 2 * i + 2, sigmaPoints.rows(), 1) = point2;
62 fWeight = 1.0f / (2 * (nNumberDimensions + fLamda));
63 w_m(2 * i + 1) = fWeight;
64 w_m(2 * i + 2) = fWeight;
65 w_c(2 * i + 1) = fWeight;
66 w_c(2 * i + 2) = fWeight;
77 Gaussian result(processedSigmaPoints.rows());
80 for (
int i = 0 ; i < m_weights_c.rows() ; i++)
82 result.
setMean(result.
getMean() + m_weights_m(i) * processedSigmaPoints.block(0, i, processedSigmaPoints.rows(), 1));
90 for (
int i = 0 ; i < m_weights_c.rows() ; i++)
92 result.
setCovariance(result.
getCovariance() + m_weights_c(i) * ((processedSigmaPoints.block(0, i, processedSigmaPoints.rows(), 1) - result.
getMean()) * ((processedSigmaPoints.block(0, i, processedSigmaPoints.rows(), 1) - result.
getMean()).transpose())));
98 Eigen::MatrixXd UnscentedTransform::squareRoot(Eigen::MatrixXd
input)
100 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> es(
input);
102 Eigen::MatrixXd sqrtA = es.operatorSqrt();