navigability_map.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 #ifndef _NAVIGABILITY_MAP_H_
28 #define _NAVIGABILITY_MAP_H_
29 
38 #include <stdio.h>
39 #include <ros/ros.h>
40 #include <sensor_msgs/PointCloud2.h>
41 #include <boost/shared_ptr.hpp>
42 #include <iostream>
43 #include <Eigen/Core>
44 
45 #include <algorithm>
46 #include <stdlib.h>
47 #include <math.h>
48 
49 //PCL
50 #include <pcl_ros/transforms.h>
51 #include <pcl/conversions.h>
52 #include <pcl/point_cloud.h>
53 #include <pcl/point_types.h>
54 #include <pcl/features/normal_3d.h>
55 #include <pcl/kdtree/kdtree_flann.h>
56 #include <pcl/io/pcd_io.h>
57 #include <pcl/surface/gp3.h>
58 #include <pcl/filters/passthrough.h>
59 //
60 #include <vector>
61 #include <visualization_msgs/Marker.h>
62 #include <visualization_msgs/MarkerArray.h>
63 
64 #include <colormap/colormap.h>
65 
66 //opencv
67 #include <cv.h> // open cv general include file
68 #include <highgui.h> // open cv GUI include file
69 #include <iostream> // standard C++ I/O
70 
71 using namespace Eigen;
72 using namespace std;
73 
82 class grid_node
83 {
84  public:
85 
87  MatrixXd Matrix_Points;
88 
90  MatrixXd Angles;
91 
93  bool has_normal;
94 
96  double med_angle_X;
97 
99  double med_angle_Y;
100 
102  double med_angle_Z;
103 
106 
108  double Zmed;
109 
112 
114  double Z_confidence;
115 
118 
121 
124 
127 
130 
132  std::vector<double> z_difference_neighbours;
133 
135  std::vector<double> z_confidence_neighbours;
136 
138  std::vector<double> angleX_difference_neighbours;
139 
141  std::vector<double> angleY_difference_neighbours;
142 
144  std::vector<double> angleZ_difference_neighbours;
145 
147  std::vector<double> angleX_confidence_neighbours;
148 
150  std::vector<double> angleY_confidence_neighbours;
151 
153  std::vector<double> angleZ_confidence_neighbours;
154 
156  std::vector<bool> has_fulldata_direction; //N,NE,E,SE,S,SW,W,NW /only for cell fully data
157 
160 
163 
166 
169 
172 
173 
175  {
176 
177  z_accessibility=0;
178 
179  angleX_accessibility=0;
180  angleY_accessibility=0;
181  angleZ_accessibility=0;
182 
183  total_accessibility=0;
184 
185  interpolate_z_data=false;
186  interpolate_normal_data=false;
187  has_normal=false;
188  Z_confidence=0;
189 
190  angle_confidence_x=0;
191  angle_confidence_y=0;
192  angle_confidence_z=0;
193 
194  num_points=0;
195  Zmed=-1000;
196  }
197 
199  {}
200 
201  private:
202 
203 };
204 
205 //stores a pointer to a dynamically allocated object
206 typedef boost::shared_ptr<grid_node> grid_nodePtr;
207 
208 //stores a pointer to a dynamically allocated object
209 typedef Matrix<grid_nodePtr, Dynamic, Dynamic> Grid;
210 
211 
212 
222 {
223  public:
224 
226  pcl::PointCloud<pcl::Normal>::Ptr normals;
227 
229  double Xmin_filter;
230 
232  double Xmax_filter;
233 
235  double Ymin_filter;
236 
238  double Ymax_filter;
239 
241  double Zmax_filter;
242 
244  double Zmin_filter;
245 
248 
251 
254 
257 
260 
262  double Sx;
263 
265  double Sy;
266 
269 
272 
275 
278 
281 
284 
287 
290 
293 
296 
299 
302 
305 
308 
313 
314  std::vector<geometry_msgs::Point> polygon_points;
315  std::vector<geometry_msgs::Point> obstacle_points;
316  std::vector<cv::Point2f> xy_polygon;
317  std::vector<cv::Point2f> obstacle_polygon;
318 
321 
323  {
324  debug_accessibility=1;
325  default_confidence=0.5;
326  fator_confidence_neighbour_limit=1.5;
327 
328  Zmax_heigh_difference=0.1;
329  Standard_Deviation_max=0.2;
330 
331  angleX_max_difference=0.1;
332  angleY_max_difference=0.1;
333  angleZ_max_difference=0.1;
334  Standard_Deviation_anglex_max_confidence=0.2;
335  Standard_Deviation_angley_max_confidence=0.2;
336  Standard_Deviation_anglez_max_confidence=0.2;
337 
338  Radius_neighbors=0.4;
339  K_neighbors=10;
340  Use_Radius_Search=1;
341 
342  Xmin_filter=0;
343  Xmax_filter=22.5;
344  Ymin_filter=-22.5;
345  Ymax_filter=22.5;
346  Zmax_filter=2;
347  Zmin_filter=-15;
348 
349  Sx=0.2;
350  Sy=0.2;
351  colorrange=64;
352  }
353 
355  {}
356 
364  void Filter_PointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud_in,pcl::PointCloud<pcl::PointXYZ>::Ptr &pc_filter);
365 
370  void Normal_Estimation(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud);
371 
376  void inicialize_grid(void);
377 
385  void setGrid_parameter(double max_Xval,double max_Yval);
386 
393  void setGrid_data(pcl::PointCloud<pcl::PointXYZ>& cloud);
394 
395 
400  void calcGrid_data(void);
401 
406  void fill_data_cells(void);
407 
418  std::vector<grid_nodePtr> cell_neighbours(int row_pos, int col_pos, int &empty_neighbours, int &number_neighbours);
419 
424  void set_Cells_accessibility(void);
425 
430  void polygon_groundtruth(void);
431  void getCell_inpolygon(void);
432  void dataCell_inpolygon(void);
433 
434 
435 
436  private:
437 
438 };
439 
440 
441 #endif
int debug_accessibility
Which accessibility map should be draw.
pcl::PointCloud< pcl::Normal >::Ptr normals
PointCloud that contains the normals.
std::vector< geometry_msgs::Point > obstacle_points
int Use_Radius_Search
1 - to use the radius search ; 0 - to use the number of neighbours search
double Ymin_filter
Min distance to be consider in the Y direction of the PointCloud.
double Sx
The X dimension of the cell.
pcl::PointCloud< pcl::PointXYZ >::Ptr pc_filter(new pcl::PointCloud< pcl::PointXYZ >)
double Standard_Deviation_anglez_max_confidence
Normalization constant for the Angle Z confidence value.
MatrixXd Matrix_Cell_inpolygon_rowcol
double angleZ_accessibility
Angle Z accessibility.
std::vector< cv::Point2f > obstacle_polygon
std::vector< double > angleZ_confidence_neighbours
Vector that contais the Angle Z confidence between neighbours to get the accessibility.
std::vector< double > angleY_confidence_neighbours
Vector that contais the Angle Y confidence between neighbours to get the accessibility.
double angleX_max_difference
Threshold for the Angle X difference between cells.
double med_angle_Y
Mean value of the angle Y of the normal in a node.
MatrixXd Matrix_Points
Matrix with points (X,Y,Z) in a node.
double Xmax_filter
Max distance to be consider in the X direction of the PointCloud.
double angleZ_max_difference
Threshold for the Angle Z difference between cells.
std::vector< double > angleY_difference_neighbours
Vector that contais the Angle Y difference between neighbours to get the accessibility.
double Standard_Deviation_max
Normalization constant for the Z confidence value.
double Z_confidence
Z confidence in a node.
double Zmax_heigh_difference
Threshold for the Z difference between cells.
double angle_confidence_y
Angle Y confidence in a node.
double Sy
The Y dimension of the cell.
std::vector< geometry_msgs::Point > polygon_points
double med_angle_Z
Mean value of the angle Z of the normal in a node.
std::vector< bool > has_fulldata_direction
Vector that contais a boolean value if a neighbour contains all data to get the accessibility.
double Radius_neighbors
The radius of the neighbours search to estimate the normals in the PointCloud.
double med_angle_X
Mean value of the angle X of the normal in a node.
int total_col
Total cols of the grid.
double Standard_Deviation_anglex_max_confidence
Normalization constant for the Angle X confidence value.
double total_accessibility
Total accessibility.
double default_confidence
Default confidence for a cell with one point.
double angle_confidence_z
Angle Z confidence in a node.
bool has_normal
If a node has at least one point with normal.
std::vector< cv::Point2f > xy_polygon
double Zmin_filter
Max distance to be consider in the Z direction of the PointCloud.
double Zmed
Z mean value in a node.
double Standard_Deviation_angley_max_confidence
Normalization constant for the Angle Y confidence value.
Grid grid
The two-dimensional grid with the cells.
int K_neighbors
The number of neighbours search to estimate the normals in the PointCloud.
std::vector< double > z_difference_neighbours
Vector that contais the Z difference between neighbours to get the accessibility. ...
std::vector< double > angleX_confidence_neighbours
Vector that contais the Angle X confidence between neighbours to get the accessibility.
double Ymax_filter
Max distance to be consider in the Y direction of the PointCloud.
double Standard_Deviation_Z
Standard Deviation in Z.
double Zmax_filter
Min distance to be consider in the Z direction of the PointCloud.
MatrixXd Matrix_obstacle_inpolygon_rowcol
double angleX_accessibility
Angle X accessibility.
std::vector< double > angleZ_difference_neighbours
Vector that contais the Angle Z difference between neighbours to get the accessibility.
double angleY_accessibility
Angle Y accessibility.
double angleY_max_difference
Threshold for the Angle Y difference between cells.
bool interpolate_normal_data
true if that cell cointains normal data interpolated from the neighbours, false it contains data from...
std::vector< double > angleX_difference_neighbours
Vector that contais the Angle X difference between neighbours to get the accessibility.
double Xmin_filter
Min distance to be consider in the X direction of the PointCloud.
MatrixXd Angles
Matrix with angles for each normal of a point in a node.
bool interpolate_z_data
true if a cell cointains Z data interpolated from the neighbours, false it contains data from the ori...
int CARaxis_col
Center col of the grid.
double z_accessibility
Z accessibility.
std::vector< double > z_confidence_neighbours
Vector that contais the Z confidence between neighbours to get the accessibility. ...
double angle_confidence_x
Angle X confidence in a node.
int total_row
Total rows of the grid.
int num_points
Number of points projected in a node (cell)
double fator_confidence_neighbour_limit
Limit of the max difference between a cell and a neighbour cell.
int colorrange
Color to represent the maps.


navigability_map
Author(s): Diogo Matos
autogenerated on Mon Mar 2 2015 01:32:29