ground_segmentation 1.0
Ground segmentation in pointcloud
Loading...
Searching...
No Matches
ground_detection_types.hpp
Go to the documentation of this file.
1
9#pragma once
10
11#include <pcl/common/transforms.h>
12#include <pcl/common/centroid.h>
13#include <pcl/segmentation/sac_segmentation.h>
14#include <pcl/filters/extract_indices.h>
15#include <pcl/common/common.h>
16#include <pcl/kdtree/kdtree_flann.h>
17#include <pcl/features/normal_3d.h>
18
19#include <Eigen/Dense>
20#include <vector>
21#include <cmath>
22#include <map>
23#include <queue>
24
25namespace ground_segmentation
26{
27
36struct Point
37{
38 double x;
39 double y;
40 double z;
41};
42
60
76
94template<typename PointT>
96{
97 int x;
98 int y;
99 int z;
105 Eigen::Vector4d centroid;
106 pcl::PointIndices::Ptr inliers;
107 Eigen::Matrix3d eigenvectors;
108 Eigen::Vector3d eigenvalues;
110 typename pcl::PointCloud<PointT>::Ptr points;
111
113 double slope;
114
116 Eigen::Vector3d normal;
117
119 : points(new pcl::PointCloud<PointT>),
120 inliers(new pcl::PointIndices)
121 {
122 x = 0;
123 y = 0;
124 z = 0;
125 in_queue = false;
126 expanded = false;
127 explored = false;
128 slope = std::numeric_limits<double>::quiet_NaN();
129 }
130};
131
145{
146 Index3D(int x, int y, int z)
147 : x(x), y(y), z(z) {}
149 {
150 x = std::numeric_limits<int>::min();
151 y = std::numeric_limits<int>::min();
152 z = std::numeric_limits<int>::min();
153 }
154 int x, y, z;
156 {
157 size_t operator()(Index3D const & ind) const
158 {
159 size_t xx = ind.x, yy = ind.y, zz = ind.z;
160 // distribute bits equally over 64bits
161 return (xx) ^ (yy << 21) ^ ((zz << 42) | (zz >> 22));
162 }
163 };
164 bool operator==(const Index3D & oth) const
165 {
166 return (x == oth.x) & (y == oth.y) & (z == oth.z); // use non-lazy `&` to avoid branching
167 }
168
169 Index3D operator+(Index3D const & obj) const
170 {
171 return Index3D(x + obj.x, y + obj.y, z + obj.z);
172 }
173};
174
188{
189 double cellSizeX; // meters
190 double cellSizeY; // meters
191 double cellSizeZ; // meters
192
193 double slopeThresholdDegrees; //degrees
194 double groundInlierThreshold; // meters
195 double centroidSearchRadius; // meters
196 double distToGround; // meters
197 double maxGroundHeightDeviation; // meters
198
200
202 {
203 cellSizeX = 2;
204 cellSizeY = 2;
205 cellSizeZ = 10;
210 distToGround = 0.0;
212 }
213};
214} //namespace ground_segmentation
TerrainType
Semantic classification label assigned to a grid cell.
PrimitiveType
Geometric primitive classification based on local PCA.
Represents one discretized 3D voxel in the spatial grid.
pcl::PointCloud< PointT >::Ptr points
Configuration parameters controlling segmentation behavior.
Integer 3D grid index used as key in hash map.
bool operator==(const Index3D &oth) const
Index3D operator+(Index3D const &obj) const
Simple 3D point representation (double precision).