Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
pf_pdf.hpp
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey & Kasper Stoy
4  * gerkey@usc.edu kaspers@robotics.usc.edu
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 /**************************************************************************
22  * Desc: Useful pdf functions
23  * Author: Andrew Howard
24  * Date: 10 Dec 2002
25  * CVS: $Id: pf_pdf.h 6345 2008-04-17 01:36:39Z gerkey $
26  *************************************************************************/
27 
28 #ifndef NAV2_AMCL__PF__PF_PDF_HPP_
29 #define NAV2_AMCL__PF__PF_PDF_HPP_
30 
31 #include "nav2_amcl/pf/pf_vector.hpp"
32 
33 // #include <gsl/gsl_rng.h>
34 // #include <gsl/gsl_randist.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /**************************************************************************
41  * Gaussian
42  *************************************************************************/
43 
44 // Gaussian PDF info
45 typedef struct
46 {
47  // Mean, covariance and inverse covariance
48  pf_vector_t x;
49  pf_matrix_t cx;
50  // pf_matrix_t cxi;
51  double cxdet;
52 
53  // Decomposed covariance matrix (rotation * diagonal)
54  pf_matrix_t cr;
55  pf_vector_t cd;
56 
57  // A random number generator
58  // gsl_rng *rng;
60 
61 
62 // Create a gaussian pdf
63 pf_pdf_gaussian_t * pf_pdf_gaussian_alloc(pf_vector_t x, pf_matrix_t cx);
64 
65 // Destroy the pdf
66 void pf_pdf_gaussian_free(pf_pdf_gaussian_t * pdf);
67 
68 // Compute the value of the pdf at some point [z].
69 // double pf_pdf_gaussian_value(pf_pdf_gaussian_t *pdf, pf_vector_t z);
70 
71 // Draw randomly from a zero-mean Gaussian distribution, with standard
72 // deviation sigma.
73 // We use the polar form of the Box-Muller transformation, explained here:
74 // http://www.taygeta.com/random/gaussian.html
75 double pf_ran_gaussian(double sigma);
76 
77 // Generate a sample from the pdf.
78 pf_vector_t pf_pdf_gaussian_sample(pf_pdf_gaussian_t * pdf);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif // NAV2_AMCL__PF__PF_PDF_HPP_