MbICP.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 /*************************************************************************************/
28 /* */
29 /* File: MbICP.h */
30 /* Authors: Luis Montesano and Javier Minguez */
31 /* Modified: 1/3/2006 */
32 /* */
33 /* This library implements the: */
34 /* */
35 /* */
36 /* J. Minguez, L. Montesano, and F. Lamiraux, "Metric-based iterative */
37 /* closest point scan matching for sensor displacement estimation," IEEE */
38 /* Transactions on Robotics, vol. 22, no. 5, pp. 1047 \u2013 1054, 2006. */
39 /*************************************************************************************/
40 /*
41  * This program is free software; you can redistribute it and/or modify
42  * it under the terms of the GNU General Public License as published by
43  * the Free Software Foundation; either version 2 of the License, or
44  * (at your option) any later version.
45  *
46  * This program is distributed in the hope that it will be useful,
47  * but WITHOUT ANY WARRANTY; without even the implied warranty of
48  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49  * GNU General Public License for more details.
50  *
51  * You should have received a copy of the GNU General Public License
52  * along with this program; if not, write to the Free Software
53  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
54  *
55  */
56 
57 /*****************************************************************************/
58 //
59 // EVERYTHING IN THE INTERNATIONAL SYSTEM (METERS AND RADIANS)
60 //
61 /*****************************************************************************/
62 
68 #ifndef MbICP
69 #define MbICP
70 #include "TData.h"
71 #include <stdlib.h>
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 // ----------------------------------------------------------------------------
78 // DEFINES
79 // ----------------------------------------------------------------------------
80 
81 /*
82 #define MAXLASERPOINTS 361
83 */
84 
85 // ----------------------------------------------------------------------------
86 // GENERIC TYPES
87 // ----------------------------------------------------------------------------
88 
89 /*typedef struct {
90  float x;
91  float y;
92 }Tpf;
93 
94 typedef struct {
95  float r;
96  float t;
97 }Tpfp;
98 
99 typedef struct {
100  int x;
101  int y;
102 }Tpi;
103 
104 typedef struct {
105  float x;
106  float y;
107  float tita;
108 }Tsc;
109 */
110 
111 // ----------------------------------------------------------------------------
112 // SPECIFIC TYPES
113 // ----------------------------------------------------------------------------
114 
115 
116 // ----------------------------------------------------------------------------
117 // GLOBAL FUNCTIONS
118 // ----------------------------------------------------------------------------
119 
120 
121 // ************************
122 // Function that initializes the SM parameters
123 // ************************
124 
125 /* void InitScanMatching(float Bw, float Br,
126  float L, int laserStep,float MaxDistInter, float filtrado,
127  int MaxIter, float error_th, float exo, float eyo, float etitao, int IterSmoothConv); */
128 // in:::
129 
130  /* --------------------- */
131  /* --- Thresold parameters */
132  /* --------------------- */
133  /* Bw: maximum angle diference between points of different scans */
134  /* Points with greater Bw cannot be correspondent (eliminate spurius asoc.) */
135  /* This is a speed up parameter */
136  //float Bw;
137 
138  /* Br: maximum distance difference between points of different scans */
139  /* Points with greater Br cannot be correspondent (eliminate spurius asoc.) */
140  //float Br;
141 
142  /* --------------------- */
143  /* --- Inner parameters */
144  /* --------------------- */
145  /* L: value of the metric */
146  /* When L tends to infinity you are using the standart ICP */
147  /* When L tends to 0 you use the metric (more importance to rotation) */
148  //float L;
149 
150  /* laserStep: selects points of each scan with an step laserStep */
151  /* When laserStep=1 uses all the points of the scans */
152  /* When laserStep=2 uses one each two ... */
153  /* This is an speed up parameter */
154  //int laserStep;
155 
156  /* ProjectionFilter: */
157  /* Eliminate the points that cannot be seen given the two scans (see Lu&Millios 97) */
158  /* It works well for angles < 45 \circ*/
159  /* 1 : activates the filter */
160  /* 0 : desactivates the filter */
161  // int ProjectionFilter;
162 
163  /* MaxDistInter: maximum distance to interpolate between points in the ref scan */
164  /* Consecutive points with less Euclidean distance than MaxDistInter are considered to be a segment */
165  //float MaxDistInter;
166 
167  /* filter: in [0,1] sets the % of asociations NOT considered spurious */
168  /* E.g. if filter=0.9 you use 90% of the associations */
169  /* The associations are ordered by distance and the (1-filter) with greater distance are not used */
170  /* This type of filtering is called "trimmed-ICP" */
171  //float filter;
172 
173  /* AsocError: in [0,1] */
174  /* One way to check if the algorithm diverges if to supervise if the number of associatios goes below a thresold */
175  /* When the number of associations is below AsocError, the main function will return error in associations step */
176  // float AsocError;
177 
178  /* --------------------- */
179  /* --- Exit parameters */
180  /* --------------------- */
181  /* MaxIter: sets the maximum number of iterations for the algorithm to exit */
182  /* The more iterations, the more chance you give the algorithm to be more accurate */
183  //int MaxIter;
184 
185  /* errorRatio: in [0,1] sets the maximum error ratio between iterations to exit */
186  /* In iteration K, let be errorK the residual of the minimization */
187  /* Error_th=(errorK-1/errorK). When error_th tends to 1 more precise is the solution of the scan matching */
188  //float error_th;
189 
190  /* errx_out,erry_out, errt_out: minimum error of the asociations to exit */
191  /* In each iteration, the error is the residual of the minimization in each component */
192  /* The condition is (errorKx<errx_out && errorKx<erry_out && errorKx<errt_out) */
193  /* When errorK tends to 0 the more precise is the solution of the scan matching */
194  //float errx_out,erry_out, errt_out;
195 
196  /* IterSmoothConv: number of consecutive iterations that satisfity the error criteria (the two above criteria) */
197  /* (error_th) OR (errorx_out && errory_out && errt_out) */
198  /* With this parameter >1 avoids random solutions and estabilices the algorithm */
199  //int IterSmoothConv;
200 
201 
202 
204  float max_laser_range,
205  float Bw,
206  float Br,
207  float L,
208  int laserStep,
209  float MaxDistInter,
210  float filter,
211  int ProjectionFilter,
212  float AsocError,
213  int MaxIter,
214  float errorRatio,
215  float errx_out,
216  float erry_out,
217  float errt_out,
218  int IterSmoothConv);
219 
220 // -------------------------------------------------------------
221 
222 // ************************
223 // Function that does the scan matching
224 // ************************
225 
226 /* int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1,
227  Tsc *sensorMotion, Tsc *solution); */
228 
229 // in:::
230 // laserK: is the reference scan in polar coordinates (max. num points is MAXLASERPOINTS)
231 // laserK1: is the new scan in polar coordinates (max. num points is MAXLASERPOINTS)
232 // sensorMotion: initial SENSOR motion estimation from location K to location K1
233 // solution: SENSOR motion solution from location K to location K1
234 // out:::
235 // 1 : Everything OK in less that the Maximum number of iterations
236 // 2 : Everything OK but reached the Maximum number of iterations
237 // -1: Failure in the association step
238 // -2: Failure in the minimization step
239 
240 // int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1, Tsc *sensorMotion, Tsc *solution,int*numIter);
241 int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1, Tsc *sensorMotion, Tsc *solution);
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 
248 #endif
Types used in the MbICP algorithm.
Definition: TData.h:84
Tsc solution
void Init_MbICP_ScanMatching(float max_laser_range, float Bw, float Br, float L, int laserStep, float MaxDistInter, float filter, int ProjectionFilter, float AsocError, int MaxIter, float errorRatio, float errx_out, float erry_out, float errt_out, int IterSmoothConv)
Definition: MbICP.c:168
int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1, Tsc *sensorMotion, Tsc *solution)
Definition: MbICP.c:208
Definition: TData.h:74
Tsc sensorMotion


lidar_egomotion
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:32:10