00001 #ifndef VELODYNEUTILS_POINTS_HPP
00002 #define VELODYNEUTILS_POINTS_HPP
00003
00004 #include <sys/time.h>
00005 #include <sys/types.h>
00006
00007 #include <algorithm>
00008 #include <iostream>
00009
00010 #include <libregionMap.h>
00011 #include <velodyne/velodyneLib.h>
00012
00013 #include <pcl/point_types.h>
00014
00018 struct PointXYZIL {
00019 PCL_ADD_POINT4D;
00020 union {
00021 struct {
00022 uint32_t label;
00023 uint8_t intensity;
00024 };
00025 float data1[4];
00026 };
00027
00028 inline PointXYZIL() {
00029 x = y = z = 0.0f;
00030 data[3] = 1.0f;
00031 intensity = 0;
00032 label = 0;
00033 }
00034 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00035 } EIGEN_ALIGN16;
00036
00037 POINT_CLOUD_REGISTER_POINT_STRUCT(PointXYZIL,
00038 (float, x, x)
00039 (float, y, y)
00040 (float, z, z)
00041 (uint8_t, intensity, intensity)
00042 (uint32_t, label, label))
00043
00044 inline std::ostream& operator<<(std::ostream& s, const PointXYZIL& point) {
00045 s << "(" << point.x << "," << point.y << "," << point.z << "), "
00046 << static_cast<uint32_t>(point.intensity) << ".";
00047 return s;
00048 }
00049
00053 struct NormalPure {
00054 PCL_ADD_NORMAL4D;
00055
00056 inline NormalPure() {
00057 normal_x = normal_y = normal_z = 0.0f;
00058 }
00059 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00060 } EIGEN_ALIGN16;
00061
00062 POINT_CLOUD_REGISTER_POINT_STRUCT(NormalPure,
00063 (float, normal_x, normal_x)
00064 (float, normal_y, normal_y)
00065 (float, normal_z, normal_z))
00066
00067 inline std::ostream& operator<<(std::ostream& s, const NormalPure& point) {
00068 s << "(" << point.normal_x << "," << point.normal_y << "," << point.normal_z
00069 << ").";
00070 return s;
00071 }
00072
00076 struct PointNormalL {
00077 PCL_ADD_POINT4D;
00078 PCL_ADD_NORMAL4D;
00079 union {
00080 struct {
00081 uint32_t label;
00082 };
00083 float data1[4];
00084 };
00085
00086 inline PointNormalL() {
00087 x = y = z = 0.0f;
00088 data[3] = 1.0f;
00089 normal_x = normal_y = normal_z = 0.0f;
00090 label = 0;
00091 }
00092 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00093 } EIGEN_ALIGN16;
00094
00095 POINT_CLOUD_REGISTER_POINT_STRUCT(PointNormalL,
00096 (float, x, x)
00097 (float, y, y)
00098 (float, z, z)
00099 (float, normal_x, normal_x)
00100 (float, normal_y, normal_y)
00101 (float, normal_z, normal_z)
00102 (uint32_t, label, label))
00103
00104 inline std::ostream& operator<<(std::ostream& s, const PointNormalL& point) {
00105 s << "(" << point.x << "," << point.y << "," << point.z << "), ("
00106 << point.normal_x << "," << point.normal_y << "," << point.normal_z
00107 << ").";
00108 return s;
00109 }
00110
00114 struct PointNormalIL {
00115 PCL_ADD_POINT4D;
00116 PCL_ADD_NORMAL4D;
00117 union {
00118 struct {
00119 uint32_t label;
00120 uint8_t intensity;
00121 };
00122 float data1[4];
00123 };
00124
00125 inline PointNormalIL() {
00126 x = y = z = 0.0f;
00127 data[3] = 1.0f;
00128 normal_x = normal_y = normal_z = 0.0f;
00129 intensity = 0;
00130 label = 0;
00131 }
00132 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00133 } EIGEN_ALIGN16;
00134
00135 POINT_CLOUD_REGISTER_POINT_STRUCT(PointNormalIL,
00136 (float, x, x)
00137 (float, y, y)
00138 (float, z, z)
00139 (float, normal_x, normal_x)
00140 (float, normal_y, normal_y)
00141 (float, normal_z, normal_z)
00142 (uint8_t, intensity, intensity)
00143 (uint32_t, label, label))
00144
00145 inline std::ostream& operator<<(std::ostream& s, const PointNormalIL& point) {
00146 s << "(" << point.x << "," << point.y << "," << point.z << "), ("
00147 << point.normal_x << "," << point.normal_y << "," << point.normal_z
00148 << "), " << point.intensity << ".";
00149 return s;
00150 }
00151
00155 struct PointHDL {
00156 PCL_ADD_POINT4D;
00157 union {
00158 struct {
00159 float label;
00160 float intensity;
00161 };
00162 float data1[4];
00163 };
00164 union {
00165 struct {
00166 float line;
00167 float column;
00168 float packet;
00169 float block;
00170 };
00171 float data2[4];
00172 };
00173
00174 inline PointHDL() {
00175 x = y = z = 0.0f;
00176 data[3] = 1.0f;
00177 intensity = 0.0;
00178 line = column = 0.0;
00179 packet = 0.0;
00180 block = static_cast<float>(VELODYNE_UPPER);
00181 label = 0.0;
00182 }
00183 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00184 } EIGEN_ALIGN16;
00185
00186 POINT_CLOUD_REGISTER_POINT_STRUCT(PointHDL,
00187 (float, x, x)
00188 (float, y, y)
00189 (float, z, z)
00190 (float, intensity, intensity)
00191 (float, line, line)
00192 (float, column, column)
00193 (float, packet, packet)
00194 (float, block, block)
00195 (float, label, label))
00196
00197 inline std::ostream& operator<<(std::ostream& s, const PointHDL& point) {
00198 int intensity = static_cast<int>(point.intensity);
00199 int line = static_cast<int>(point.line);
00200 int column = static_cast<int>(point.column);
00201 int packet = static_cast<int>(point.packet);
00202 s << "(" << point.x << "," << point.y << "," << point.z << "), "
00203 << intensity << ", (" << line << "," << column << "), " << packet << ", ";
00204 if (point.block == static_cast<float>(VELODYNE_UPPER))
00205 s << "upper block.";
00206 else
00207 s << "lower block.";
00208 return s;
00209 }
00210
00214 struct PointRegionMap {
00215 PCL_ADD_POINT4D;
00216 union {
00217 struct {
00218
00219 float nbPts;
00220 float meanHDistance;
00221 float minZ;
00222 float maxZ;
00223 float deltaZ;
00224 float meanZ;
00225 float varZ;
00226 float meanDeltaRhoLine;
00227 float varDeltaRhoLine;
00228 float meanDeltaRhoLineSmooth;
00229 float varDeltaRhoLineSmooth;
00230 float nX;
00231 float nY;
00232 float nZ;
00233 float varNX;
00234 float varNY;
00235 float varNZ;
00236 float normVarN;
00237
00238
00239 float hasFeatures;
00240
00241
00242 float label;
00243 };
00244 float features[NB_3D_ATTRIBUTES];
00245 float data1[20];
00246 };
00247
00248 inline PointRegionMap() {
00249 x = y = z = 0.0f;
00250 data[3] = 1.0f;
00251 std::fill(features, features + NB_3D_ATTRIBUTES, 0.0f);
00252 hasFeatures = 0.0f;
00253 label = 0.0f;
00254 }
00255 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00256 } EIGEN_ALIGN16;
00257
00258 POINT_CLOUD_REGISTER_POINT_STRUCT(PointRegionMap,
00259 (float, x, x)
00260 (float, y, y)
00261 (float, z, z)
00262 (float, nbPts, nbPts)
00263 (float, meanHDistance, meanHDistance)
00264 (float, minZ, minZ)
00265 (float, maxZ, maxZ)
00266 (float, deltaZ, deltaZ)
00267 (float, meanZ, meanZ)
00268 (float, varZ, varZ)
00269 (float, nX, nX)
00270 (float, nY, nY)
00271 (float, nZ, nZ)
00272 (float, varNX, varNX)
00273 (float, varNY, varNY)
00274 (float, varNZ, varNZ)
00275 (float, normVarN, normVarN)
00276 (float, hasFeatures, hasFeatures)
00277 (float, label, label))
00278
00279 inline std::ostream& operator<<(std::ostream& s, const PointRegionMap& point) {
00280 s << "(" << point.x << "," << point.y << "," << point.z << "), ";
00281 if (static_cast<bool>(point.hasFeatures))
00282 for (int i = 0; i < NB_3D_ATTRIBUTES; ++i)
00283 s << (i == 0 ? "(" : "") << point.features[i]
00284 << (i < (NB_3D_ATTRIBUTES - 1) ? ", " : "), ");
00285 else
00286 s << "-, ";
00287 s << point.label;
00288 return s;
00289 }
00290
00291 #endif // VELODYNEUTILS_POINTS_HPP