35 #include "nav2_amcl/pf/pf_pdf.hpp"
37 #include "nav2_amcl/portable_utils.hpp"
40 static unsigned int pf_pdf_seed;
61 pf_matrix_unitary(&pdf->cr, &cd, pdf->cx);
62 pdf->cd.v[0] = sqrt(cd.m[0][0]);
63 pdf->cd.v[1] = sqrt(cd.m[1][1]);
64 pdf->cd.v[2] = sqrt(cd.m[2][2]);
69 srand48(++pf_pdf_seed);
113 for (i = 0; i < 3; i++) {
115 r.v[i] = pf_ran_gaussian(pdf->cd.v[i]);
118 for (i = 0; i < 3; i++) {
119 x.v[i] = pdf->x.v[i];
120 for (j = 0; j < 3; j++) {
121 x.v[i] += pdf->cr.m[i][j] * r.v[j];
132 double pf_ran_gaussian(
double sigma)
145 w = x1 * x1 + x2 * x2;
146 }
while (w > 1.0 || w == 0.0);
148 return sigma * x2 * sqrt(-2.0 * log(w) / w);