Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
pf_vector.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: Vector functions
23  * Author: Andrew Howard
24  * Date: 10 Dec 2002
25  * CVS: $Id: pf_vector.h 6345 2008-04-17 01:36:39Z gerkey $
26  *************************************************************************/
27 
28 #ifndef NAV2_AMCL__PF__PF_VECTOR_HPP_
29 #define NAV2_AMCL__PF__PF_VECTOR_HPP_
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include <stdio.h>
36 
37 // The basic vector
38 typedef struct
39 {
40  double v[3];
41 } pf_vector_t;
42 
43 
44 // The basic matrix
45 typedef struct
46 {
47  double m[3][3];
48 } pf_matrix_t;
49 
50 
51 // Return a zero vector
52 pf_vector_t pf_vector_zero(void);
53 
54 // Check for NAN or INF in any component
55 // int pf_vector_finite(pf_vector_t a);
56 
57 // Print a vector
58 // void pf_vector_fprintf(pf_vector_t s, FILE * file, const char * fmt);
59 
60 // Simple vector addition
61 // pf_vector_t pf_vector_add(pf_vector_t a, pf_vector_t b);
62 
63 // Simple vector subtraction
64 pf_vector_t pf_vector_sub(pf_vector_t a, pf_vector_t b);
65 
66 // Transform from local to global coords (a + b)
67 pf_vector_t pf_vector_coord_add(pf_vector_t a, pf_vector_t b);
68 
69 // Transform from global to local coords (a - b)
70 // pf_vector_t pf_vector_coord_sub(pf_vector_t a, pf_vector_t b);
71 
72 
73 // Return a zero matrix
74 pf_matrix_t pf_matrix_zero(void);
75 
76 // Check for NAN or INF in any component
77 // int pf_matrix_finite(pf_matrix_t a);
78 
79 // Print a matrix
80 // void pf_matrix_fprintf(pf_matrix_t s, FILE * file, const char * fmt);
81 
82 // Compute the matrix inverse. Will also return the determinant,
83 // which should be checked for underflow (indicated singular matrix).
84 // pf_matrix_t pf_matrix_inverse(pf_matrix_t a, double *det);
85 
86 // Decompose a covariance matrix [a] into a rotation matrix [r] and a
87 // diagonal matrix [d] such that a = r * d * r^T.
88 void pf_matrix_unitary(pf_matrix_t * r, pf_matrix_t * d, pf_matrix_t a);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif // NAV2_AMCL__PF__PF_VECTOR_HPP_