31 #   include <pcl/io/pcd_io.h>    32 #   include <pcl/point_types.h>    60 float CPointsMap::COLOR_3DSCENE_R = 0;
    61 float CPointsMap::COLOR_3DSCENE_G = 0;
    62 float CPointsMap::COLOR_3DSCENE_B = 1;
    67 CPointsMap::CPointsMap() :
    71         m_largestDistanceFromOrigin(0),
    72         m_heightfilter_z_min(-10),
    73         m_heightfilter_z_max(10),
    74         m_heightfilter_enabled(false)
    97         for (
unsigned int i=0;i<
x.size();i++)
   112         if (!f) 
return false;
   114         for (
unsigned int i=0;i<
x.size();i++)
   136         if (!f) 
return false;
   139         char            *ptr,*ptr1,*ptr2,*ptr3;
   148                 if (!fgets(str,
sizeof(str),f)) 
break;
   152                 while (ptr[0] && (ptr[0]==
' ' || ptr[0]==
'\t' || ptr[0]==
'\r' || ptr[0]==
'\n'))
   156                 float   xx = strtod(ptr,&ptr1);
   159                         float   yy = strtod(ptr1,&ptr2);
   168                                         float   zz = strtod(ptr2,&ptr3);
   194         MRPT_TODO(
"Create 3xN array xyz of points coordinates")
   195         const 
char* fields[] = {
"x",
"y",
"z"};
   196         mexplus::MxArray map_struct( mexplus::MxArray::Struct(
sizeof(fields)/
sizeof(fields[0]),fields) );
   198         map_struct.set(
"x", this->
x);
   199         map_struct.set(
"y", this->
y);
   200         map_struct.set(
"z", this->
z);
   201         return map_struct.release();
   254         outPointsCount = 
size();
   256         if (outPointsCount>0)
   273         const size_t    n=
size();
   274         vector<bool>    deletionMask(
n);
   277         for (
size_t i=0;i<
n;i++)
   278                 deletionMask[i] = ( 
z[i]<zMin || 
z[i]>zMax );
   293         vector<bool>    deletionMask;
   296         deletionMask.resize(
n);
   300                 deletionMask[i] = std::sqrt( 
square(
p.x-
x[i]) + 
square(
p.y-
y[i])) > maxRange;
   324         const TPose2D otherMapPose(otherMapPose_.
x(),otherMapPose_.
y(),otherMapPose_.
phi());
   326         const size_t nLocalPoints = otherMap->
size();
   327         const size_t nGlobalPoints = this->
size();
   329         size_t _sumSqrCount = 0;
   330         size_t nOtherMapPointsWithCorrespondence = 0;   
   332         float local_x_min= std::numeric_limits<float>::max(), local_x_max= -std::numeric_limits<float>::max();
   333         float global_x_min=std::numeric_limits<float>::max(), global_x_max= -std::numeric_limits<float>::max();
   334         float local_y_min= std::numeric_limits<float>::max(), local_y_max= -std::numeric_limits<float>::max();
   335         float global_y_min=std::numeric_limits<float>::max(), global_y_max= -std::numeric_limits<float>::max();
   337         double       maxDistForCorrespondenceSquared;
   338         float        x_local, y_local;
   339         unsigned int localIdx;
   341         const float *x_other_it,*y_other_it,*z_other_it; 
   344         correspondences.clear();
   345         correspondences.reserve(nLocalPoints);
   346         extraResults.correspondencesRatio = 0;
   349         _correspondences.reserve(nLocalPoints);
   352         if (!nGlobalPoints) 
return;  
   355         if (!nLocalPoints)  
return;  
   357         const double    sin_phi = sin(otherMapPose.phi);
   358         const double    cos_phi = cos(otherMapPose.phi);
   367         size_t nPackets = nLocalPoints/4;
   368         if ( (nLocalPoints & 0x03)!=0) nPackets++;
   371         size_t nLocalPoints_4align = nLocalPoints;
   372         size_t nExtraPad = 0;
   373         if (0!=(nLocalPoints & 0x03))
   375                 nExtraPad = 4 - (nLocalPoints & 0x03);
   376                 nLocalPoints_4align+=nExtraPad;
   379         Eigen::Array<float,Eigen::Dynamic,1>  x_locals(nLocalPoints_4align), y_locals(nLocalPoints_4align);
   385         if ( otherMap->x.capacity()<nLocalPoints_4align ||
   386                  otherMap->y.capacity()<nLocalPoints_4align )
   389                 const_cast<vector<float>*
>(&otherMap->x)->
reserve(nLocalPoints_4align+16);
   390                 const_cast<vector<float>*
>(&otherMap->y)->
reserve(nLocalPoints_4align+16);
   395                 float *ptr_in_x = 
const_cast<float*
>(&otherMap->x[0]);
   396                 float *ptr_in_y = 
const_cast<float*
>(&otherMap->y[0]);
   397                 for (
size_t k=nExtraPad;k; k--) {
   398                         ptr_in_x[nLocalPoints+k]=0;
   399                         ptr_in_y[nLocalPoints+k]=0;
   403         const __m128 cos_4val = _mm_set1_ps(cos_phi); 
   404         const __m128 sin_4val = _mm_set1_ps(sin_phi);
   405         const __m128 x0_4val = _mm_set1_ps(otherMapPose.x);
   406         const __m128 y0_4val = _mm_set1_ps(otherMapPose.y);
   409         __m128 x_mins = _mm_set1_ps( std::numeric_limits<float>::max() );
   411         __m128 y_mins = x_mins;
   412         __m128 y_maxs = x_maxs;
   414         const float *ptr_in_x = &otherMap->x[0];
   415         const float *ptr_in_y = &otherMap->y[0];
   416         float *ptr_out_x    = &x_locals[0];
   417         float *ptr_out_y    = &y_locals[0];
   419         for( ; nPackets; nPackets--, ptr_in_x+=4, ptr_in_y+=4, ptr_out_x+=4, ptr_out_y+=4 )
   421                 const __m128 xs = _mm_loadu_ps(ptr_in_x); 
   422                 const __m128 ys = _mm_loadu_ps(ptr_in_y);
   424                 const __m128 lxs = _mm_add_ps(x0_4val, _mm_sub_ps( _mm_mul_ps(xs,cos_4val), _mm_mul_ps(ys,sin_4val) ) );
   425                 const __m128 lys = _mm_add_ps(y0_4val, _mm_add_ps( _mm_mul_ps(xs,sin_4val), _mm_mul_ps(ys,cos_4val) ) );
   426                 _mm_store_ps(ptr_out_x, lxs );
   427                 _mm_store_ps(ptr_out_y, lys );
   429                 x_mins = _mm_min_ps(x_mins,lxs);
   430                 x_maxs = _mm_max_ps(x_maxs,lxs);
   431                 y_mins = _mm_min_ps(y_mins,lys);
   432                 y_maxs = _mm_max_ps(y_maxs,lys);
   438         _mm_store_ps(temp_nums, x_mins); local_x_min=
min(
min(temp_nums[0],temp_nums[1]),
min(temp_nums[2],temp_nums[3]));
   439         _mm_store_ps(temp_nums, y_mins); local_y_min=
min(
min(temp_nums[0],temp_nums[1]),
min(temp_nums[2],temp_nums[3]));
   440         _mm_store_ps(temp_nums, x_maxs); local_x_max=max(max(temp_nums[0],temp_nums[1]),max(temp_nums[2],temp_nums[3]));
   441         _mm_store_ps(temp_nums, y_maxs); local_y_max=max(max(temp_nums[0],temp_nums[1]),max(temp_nums[2],temp_nums[3]));
   445         const Eigen::Map<Eigen::Matrix<float,Eigen::Dynamic,1> > x_org( const_cast<float*>(&otherMap->x[0]),otherMap->x.size(),1 );
   446         const Eigen::Map<Eigen::Matrix<float,Eigen::Dynamic,1> > y_org( const_cast<float*>(&otherMap->y[0]),otherMap->y.size(),1 );
   448         Eigen::Array<float,Eigen::Dynamic,1>  x_locals = otherMapPose.x + cos_phi * x_org.array() - sin_phi *  y_org.array() ;
   449         Eigen::Array<float,Eigen::Dynamic,1>  y_locals = otherMapPose.y + sin_phi * x_org.array() + cos_phi *  y_org.array() ;
   451         local_x_min=x_locals.minCoeff();
   452         local_y_min=y_locals.minCoeff();
   453         local_x_max=x_locals.maxCoeff();
   454         local_y_max=y_locals.maxCoeff();
   458         float global_z_min,global_z_max;
   460                 global_x_min,global_x_max,
   461                 global_y_min,global_y_max,
   462                 global_z_min,global_z_max );
   465         if (local_x_min>global_x_max ||
   466                 local_x_max<global_x_min ||
   467                 local_y_min>global_y_max ||
   468                 local_y_max<global_y_min) 
return;       
   473         for ( localIdx=
params.offset_other_map_points,
   474                         x_other_it=&otherMap->x[
params.offset_other_map_points],
   475                         y_other_it=&otherMap->y[
params.offset_other_map_points],
   476                         z_other_it=&otherMap->z[
params.offset_other_map_points];
   477                         localIdx<nLocalPoints;
   478                         x_other_it+=
params.decimation_other_map_points,y_other_it+=
params.decimation_other_map_points,z_other_it+=
params.decimation_other_map_points,localIdx+=
params.decimation_other_map_points )
   481                 x_local = x_locals[localIdx]; 
   482                 y_local = y_locals[localIdx]; 
   491                 float tentativ_err_sq;
   498                 maxDistForCorrespondenceSquared = 
square(
   499                         params.maxAngularDistForCorrespondence * std::sqrt( 
square(
params.angularDistPivotPoint.x-x_local) + 
square(
params.angularDistPivotPoint.y-y_local) ) +
   500                                         params.maxDistForCorrespondence );
   503                 if ( tentativ_err_sq < maxDistForCorrespondenceSquared )
   506                         _correspondences.resize(_correspondences.size()+1);
   510                         p.this_idx = tentativ_this_idx;
   511                         p.this_x = 
x[tentativ_this_idx];
   512                         p.this_y = 
y[tentativ_this_idx];
   513                         p.this_z = 
z[tentativ_this_idx];
   515                         p.other_idx = localIdx;
   516                         p.other_x = *x_other_it;
   517                         p.other_y = *y_other_it;
   518                         p.other_z = *z_other_it;
   520                         p.errorSquareAfterTransformation  = tentativ_err_sq;
   523                         nOtherMapPointsWithCorrespondence++;
   526                         _sumSqrDist+= 
p.errorSquareAfterTransformation;
   536         if (
params.onlyUniqueRobust) {
   537                 ASSERTMSG_(
params.onlyKeepTheClosest, 
"ERROR: onlyKeepTheClosest must be also set to true when onlyUniqueRobust=true.");
   541                 correspondences.swap(_correspondences);
   547                         extraResults.sumSqrDist = _sumSqrDist / 
static_cast<double>(_sumSqrCount);
   548         else    extraResults.sumSqrDist = 0;
   551         extraResults.correspondencesRatio = 
params.decimation_other_map_points*nOtherMapPointsWithCorrespondence / 
static_cast<float>(nLocalPoints);
   561         const size_t N = 
x.size();
   563         const CPose3D   newBase3D(newBase);
   565         for (
size_t i=0;i<N;i++)
   579         const size_t N = 
x.size();
   581         for (
size_t i=0;i<N;i++)
   612         minDistBetweenLaserPoints   ( 0.02f),
   613         addToExistingPointsMap      ( true),
   614         also_interpolate            ( false),
   615         disableDeletion             ( true),
   616         fuseWithExisting            ( false),
   617         isPlanarMap                 ( false),
   618         horizontalTolerance         ( 
DEG2RAD(0.05) ),
   619         maxDistForInterpolatePoints ( 2.0f ),
   620         insertInvalidPoints         ( false)
   631         << minDistBetweenLaserPoints << addToExistingPointsMap << also_interpolate
   632         << disableDeletion << fuseWithExisting << isPlanarMap << horizontalTolerance
   633         << maxDistForInterpolatePoints << insertInvalidPoints; 
   645                         >> minDistBetweenLaserPoints >> addToExistingPointsMap >> also_interpolate
   646                         >> disableDeletion >> fuseWithExisting >> isPlanarMap >> horizontalTolerance
   647                         >> maxDistForInterpolatePoints >> insertInvalidPoints; 
   656     sigma_dist          ( 0.0025 ),
   657         max_corr_distance   ( 1.0 ),
   667         out << sigma_dist << max_corr_distance << decimation;
   678                         in >> sigma_dist >> max_corr_distance >> decimation;
   691         out.
printf(
"\n----------- [CPointsMap::TInsertionOptions] ------------ \n\n");
   710         out.
printf(
"\n----------- [CPointsMap::TLikelihoodOptions] ------------ \n\n");
   722         const string §ion)
   740         const string §ion)
   756         obj->loadFromPointsMap(
this);
   759         obj->enableColorFromZ(
true);
   793                 float   maxDistSq = 0, d;
   794                 for (X=
x.begin(),Y=
y.begin(),Z=
z.begin();X!=
x.end();++X,++Y,++Z)
   797                         maxDistSq = max( d, maxDistSq );
   822                 size_t N = 
x.size() / decimation;
   829                 for (X=
x.begin(),Y=
y.begin(),oX=xs.begin(),oY=ys.begin();oX!=xs.end();X+=decimation,Y+=decimation,++oX,++oY)
   852         float  x1,y1, x2,y2, d1,d2;
   863         if (d12 > 0.20f*0.20f || d12 < 0.03f*0.03f)
   869                 double interp_x, interp_y;
   889         float &min_x,  
float &max_x,
   890         float &min_y,  
float &max_y,
   891         float &min_z,  
float &max_z
   894         const size_t nPoints = 
x.size();
   910                         size_t nPackets = nPoints/4;
   911                         if ( (nPoints & 0x03)!=0) nPackets++;
   914                         size_t nPoints_4align = nPoints;
   915                         size_t nExtraPad = 0;
   916                         if (0!=(nPoints & 0x03))
   918                                 nExtraPad = 4 - (nPoints & 0x03);
   919                                 nPoints_4align+=nExtraPad;
   926                         if ( 
x.capacity()<nPoints_4align ||
   927                                  y.capacity()<nPoints_4align ||
   928                                  z.capacity()<nPoints_4align )
   931                                 const_cast<vector<float>*
>(&
x)->
reserve(nPoints_4align+16);
   932                                 const_cast<vector<float>*
>(&
y)->
reserve(nPoints_4align+16);
   933                                 const_cast<vector<float>*
>(&
z)->
reserve(nPoints_4align+16);
   938                                 float *ptr_in_x = 
const_cast<float*
>(&
x[0]);
   939                                 float *ptr_in_y = 
const_cast<float*
>(&
y[0]);
   940                                 float *ptr_in_z = 
const_cast<float*
>(&
z[0]);
   941                                 for (
size_t k=nExtraPad;k; k--) {
   942                                         ptr_in_x[nPoints+k-1]=0;
   943                                         ptr_in_y[nPoints+k-1]=0;
   944                                         ptr_in_z[nPoints+k-1]=0;
   949                         __m128 x_mins = _mm_set1_ps( std::numeric_limits<float>::max() );
   951                         __m128 y_mins = x_mins, y_maxs = x_maxs;
   952                         __m128 z_mins = x_mins, z_maxs = x_maxs;
   954                         const float *ptr_in_x = &this->
x[0];
   955                         const float *ptr_in_y = &this->
y[0];
   956                         const float *ptr_in_z = &this->
z[0];
   958                         for( ; nPackets; nPackets--, ptr_in_x+=4, ptr_in_y+=4, ptr_in_z+=4 )
   960                                 const __m128 xs = _mm_loadu_ps(ptr_in_x); 
   961                                 x_mins = _mm_min_ps(x_mins,xs); x_maxs = _mm_max_ps(x_maxs,xs);
   963                                 const __m128 ys = _mm_loadu_ps(ptr_in_y);
   964                                 y_mins = _mm_min_ps(y_mins,ys); y_maxs = _mm_max_ps(y_maxs,ys);
   966                                 const __m128 zs = _mm_loadu_ps(ptr_in_z);
   967                                 z_mins = _mm_min_ps(z_mins,zs); z_maxs = _mm_max_ps(z_maxs,zs);
   973                         _mm_store_ps(temp_nums, x_mins); 
m_bb_min_x=
min(
min(temp_nums[0],temp_nums[1]),
min(temp_nums[2],temp_nums[3]));
   974                         _mm_store_ps(temp_nums, y_mins); 
m_bb_min_y=
min(
min(temp_nums[0],temp_nums[1]),
min(temp_nums[2],temp_nums[3]));
   975                         _mm_store_ps(temp_nums, z_mins); 
m_bb_min_z=
min(
min(temp_nums[0],temp_nums[1]),
min(temp_nums[2],temp_nums[3]));
   976                         _mm_store_ps(temp_nums, x_maxs); 
m_bb_max_x=max(max(temp_nums[0],temp_nums[1]),max(temp_nums[2],temp_nums[3]));
   977                         _mm_store_ps(temp_nums, y_maxs); 
m_bb_max_y=max(max(temp_nums[0],temp_nums[1]),max(temp_nums[2],temp_nums[3]));
   978                         _mm_store_ps(temp_nums, z_maxs); 
m_bb_max_z=max(max(temp_nums[0],temp_nums[1]),max(temp_nums[2],temp_nums[3]));
   984                         m_bb_min_z = (std::numeric_limits<float>::max)();
   988                         m_bb_max_z = -(std::numeric_limits<float>::max)();
  1028         const size_t nLocalPoints = otherMap->
size();
  1029         const size_t nGlobalPoints = this->
size();
  1030         float                                   _sumSqrDist=0;
  1031         size_t                                  _sumSqrCount = 0;
  1032         size_t                                  nOtherMapPointsWithCorrespondence = 0;  
  1034         float local_x_min= std::numeric_limits<float>::max(), local_x_max= -std::numeric_limits<float>::max();
  1035         float local_y_min= std::numeric_limits<float>::max(), local_y_max= -std::numeric_limits<float>::max();
  1036         float local_z_min= std::numeric_limits<float>::max(), local_z_max= -std::numeric_limits<float>::max();
  1038         double                                  maxDistForCorrespondenceSquared;
  1042         correspondences.clear();
  1043         correspondences.reserve(nLocalPoints);
  1046         _correspondences.reserve(nLocalPoints);
  1049         if (!nGlobalPoints || !nLocalPoints) 
return;
  1053         vector<float> x_locals(nLocalPoints), y_locals(nLocalPoints), z_locals(nLocalPoints);
  1055         for (
unsigned int localIdx=
params.offset_other_map_points;localIdx<nLocalPoints;localIdx+=
params.decimation_other_map_points)
  1057                 float x_local,y_local,z_local;
  1059                         otherMap->x[localIdx], otherMap->y[localIdx], otherMap->z[localIdx],
  1060                         x_local,y_local,z_local );
  1062                 x_locals[localIdx] = x_local;
  1063                 y_locals[localIdx] = y_local;
  1064                 z_locals[localIdx] = z_local;
  1067                 local_x_min = 
min(local_x_min,x_local);
  1068                 local_x_max = max(local_x_max,x_local);
  1069                 local_y_min = 
min(local_y_min,y_local);
  1070                 local_y_max = max(local_y_max,y_local);
  1071                 local_z_min = 
min(local_z_min,z_local);
  1072                 local_z_max = max(local_z_max,z_local);
  1076         float global_x_min, global_x_max, global_y_min, global_y_max, global_z_min, global_z_max;
  1078                 global_x_min,global_x_max,
  1079                 global_y_min,global_y_max,
  1080                 global_z_min,global_z_max );
  1084         if (local_x_min>global_x_max ||
  1085                 local_x_max<global_x_min ||
  1086                 local_y_min>global_y_max ||
  1087                 local_y_max<global_y_min) 
return;       
  1091         for (
unsigned int localIdx=
params.offset_other_map_points; localIdx<nLocalPoints; localIdx+=
params.decimation_other_map_points)
  1094                 const float x_local = x_locals[localIdx];
  1095                 const float y_local = y_locals[localIdx];
  1096                 const float z_local = z_locals[localIdx];
  1104                         float tentativ_err_sq;
  1106                                 x_local,  y_local, z_local,  
  1111                         maxDistForCorrespondenceSquared = 
square(
  1112                                                 params.maxAngularDistForCorrespondence * 
params.angularDistPivotPoint.distanceTo(
TPoint3D(x_local,y_local,z_local)) +
  1113                                                 params.maxDistForCorrespondence );
  1116                         if ( tentativ_err_sq < maxDistForCorrespondenceSquared )
  1119                                 _correspondences.resize(_correspondences.size()+1);
  1123                                 p.this_idx = tentativ_this_idx;
  1124                                 p.this_x = 
x[tentativ_this_idx];
  1125                                 p.this_y = 
y[tentativ_this_idx];
  1126                                 p.this_z = 
z[tentativ_this_idx];
  1128                                 p.other_idx = localIdx;
  1129                                 p.other_x = otherMap->x[localIdx];
  1130                                 p.other_y = otherMap->y[localIdx];
  1131                                 p.other_z = otherMap->z[localIdx];
  1133                                 p.errorSquareAfterTransformation  = tentativ_err_sq;
  1136                                 nOtherMapPointsWithCorrespondence++;
  1139                                 _sumSqrDist+= 
p.errorSquareAfterTransformation;
  1151         if (
params.onlyUniqueRobust) {
  1152                 ASSERTMSG_(
params.onlyKeepTheClosest, 
"ERROR: onlyKeepTheClosest must be also set to true when onlyUniqueRobust=true.");
  1156                 correspondences.swap(_correspondences);
  1161         extraResults.sumSqrDist = (_sumSqrCount) ? _sumSqrDist / static_cast<double>(_sumSqrCount) : 0;
  1162         extraResults.correspondencesRatio = 
params.decimation_other_map_points*nOtherMapPointsWithCorrespondence / 
static_cast<float>(nLocalPoints);
  1173         for( 
size_t k = 0; k < 
x.size(); k++ )
  1186         double minX,maxX,minY,maxY,minZ,maxZ;
  1187         minX = 
min(corner1.
x,corner2.
x);    maxX = max(corner1.
x,corner2.
x);
  1188         minY = 
min(corner1.
y,corner2.
y);    maxY = max(corner1.
y,corner2.
y);
  1189         minZ = 
min(corner1.
z,corner2.
z);    maxZ = max(corner1.
z,corner2.
z);
  1190         for( 
size_t k = 0; k < 
x.size(); k++ )
  1192                 if( (
x[k] >= minX && 
x[k] <= maxX) &&
  1193             (
y[k] >= minY && 
y[k] <= maxY) &&
  1194             (
z[k] >= minZ && 
z[k] <= maxZ) )
  1205         float                                                                   maxDistForCorrespondence,
  1207         float                                                           &correspondencesRatio )
  1214         const size_t nLocalPoints   = otherMap->
size();
  1215         const size_t nGlobalPoints  = this->
size();
  1216         size_t nOtherMapPointsWithCorrespondence = 0;   
  1219     correspondences.clear();
  1220         correspondences.reserve(nLocalPoints);
  1221         correspondencesRatio = 0;
  1225     _correspondences.reserve(nLocalPoints);
  1228         if (!nGlobalPoints) 
return;  
  1231         if (!nLocalPoints)  
return;  
  1234     float local_x_min, local_x_max, local_y_min, local_y_max, local_z_min, local_z_max;
  1236         local_x_min, local_x_max,
  1237         local_y_min, local_y_max,
  1238         local_z_min, local_z_max );
  1241         float global_x_min, global_x_max, global_y_min, global_y_max, global_z_min, global_z_max;
  1243                 global_x_min,global_x_max,
  1244                 global_y_min,global_y_max,
  1245                 global_z_min,global_z_max );
  1249         if (local_x_min>global_x_max ||
  1250                 local_x_max<global_x_min ||
  1251                 local_y_min>global_y_max ||
  1252                 local_y_max<global_y_min) 
return;       
  1255     std::vector< std::vector<size_t> > vIdx;
  1260         std::vector<size_t> outIdx;
  1261         for (
unsigned int localIdx = 0; localIdx < nLocalPoints; ++localIdx )
  1264                 const float x_local = otherMap->
x[localIdx];
  1265                 const float y_local = otherMap->
y[localIdx];
  1266                 const float z_local = otherMap->
z[localIdx];
  1274                                 x_local,  y_local, z_local,     
  1289                         if ( distanceForThisPoint < maxDistForCorrespondence )
  1292                                 _correspondences.resize(_correspondences.size()+1);
  1296                                 p.this_idx = nOtherMapPointsWithCorrespondence++; 
  1301                                 p.other_idx = localIdx;
  1302                                 p.other_x = otherMap->
x[localIdx];
  1303                                 p.other_y = otherMap->
y[localIdx];
  1304                                 p.other_z = otherMap->
z[localIdx];
  1306                                 p.errorSquareAfterTransformation  = distanceForThisPoint;
  1309                 std::sort(outIdx.begin(),outIdx.end());
  1310                                 vIdx.push_back(outIdx);
  1319     std::map<size_t, std::map<size_t, std::map<size_t, pair<size_t,float> > > > best; 
  1321     for (it = _correspondences.begin(); it != _correspondences.end(); ++it)
  1323         const size_t i0 = vIdx[it->this_idx][0];
  1324         const size_t i1 = vIdx[it->this_idx][1];
  1325         const size_t i2 = vIdx[it->this_idx][2];
  1327         if( best.find(i0) != best.end() &&
  1328             best[i0].find(i1) != best[i0].end() &&
  1329             best[i0][i1].find(i2) != best[i0][i1].end() )   
  1331             if( best[i0][i1][i2].second > it->errorSquareAfterTransformation )
  1333                 best[i0][i1][i2].first  = it->this_idx;
  1334                 best[i0][i1][i2].second = it->errorSquareAfterTransformation;
  1339             best[i0][i1][i2].first  = it->this_idx;
  1340             best[i0][i1][i2].second = it->errorSquareAfterTransformation;
  1344     for (it = _correspondences.begin(); it != _correspondences.end(); ++it)
  1346         const size_t i0 = vIdx[it->this_idx][0];
  1347         const size_t i1 = vIdx[it->this_idx][1];
  1348         const size_t i2 = vIdx[it->this_idx][2];
  1350         if( best[i0][i1][i2].
first == it->this_idx )
  1351             correspondences.push_back(*it);
  1355         correspondencesRatio = nOtherMapPointsWithCorrespondence / 
static_cast<float>(nLocalPoints);
  1386                 const size_t N = scanPoints->
x.size();
  1387                 if (!N || !this->
size() ) 
return -100;
  1389                 const float *xs = &scanPoints->
x[0];
  1390                 const float *ys = &scanPoints->
y[0];
  1391                 const float *zs = &scanPoints->
z[0];
  1393                 float   closest_x,closest_y,closest_z;
  1396                 int nPtsForAverage = 0;
  1403                         const float ccos = cos(takenFrom2D.
phi);
  1404                         const float csin = sin(takenFrom2D.
phi);
  1409                                 const float xg = takenFrom2D.
x + ccos * xs[i] - csin * ys[i];
  1410                                 const float yg = takenFrom2D.
y + csin * xs[i] + ccos * ys[i];
  1414                                         closest_x,closest_y,    
  1421                                 sumSqrDist+= closest_err;
  1437                                         closest_x,closest_y,closest_z,  
  1444                                 sumSqrDist+= closest_err;
  1448                 sumSqrDist /= nPtsForAverage;
  1480         out_map->insertObservation(&obs,NULL);
  1510         return this->
size();
  1533         const size_t nThis = this->
size();
  1534         const size_t nOther = anotherMap.
size();
  1536         const size_t nTot = nThis+nOther;
  1540         for (
size_t i=0,j=nThis;i<nOther;i++, j++)
  1542                 this->
x[j]=anotherMap.
x[i];
  1543                 this->
y[j]=anotherMap.
y[i];
  1544                 this->
z[j]=anotherMap.
z[i];
  1557         pcl::PointCloud<pcl::PointXYZ> cloud;
  1560         return 0 == pcl::io::savePCDFile(filename, cloud, save_as_binary);
  1565         THROW_EXCEPTION(
"Operation not available: MRPT was built without PCL")
  1573         pcl::PointCloud<pcl::PointXYZ> cloud;
  1574         if (0!=pcl::io::loadPCDFile(filename,cloud))
  1582         THROW_EXCEPTION(
"Operation not available: MRPT was built without PCL")
  1596         const size_t n = 
mask.size();
  1599         for (i=0,j=0;i<
n;i++)
  1622         const size_t N_this = 
size();
  1623         const size_t N_other = otherMap->
size();
  1626         this->
resize( N_this + N_other );
  1690                 robotPose2D = 
CPose2D(*robotPose);
  1691                 robotPose3D = (*robotPose);
  1707                 bool    reallyInsertIt;
  1711                 else reallyInsertIt = 
true;
  1715                         std::vector<bool>       checkForDeletion;
  1743                                         const float                     *xs,*ys,*zs;
  1750                                         for (
size_t i=0;i<
n;i++)
  1752                                                 if ( checkForDeletion[i] )              
  1757                                                                 checkForDeletion[i] = 
false;    
  1791                 bool    reallyInsertIt;
  1794                          reallyInsertIt = 
false; 
  1795                 else reallyInsertIt = 
true;
  1856                         const CPose3D sensorPose = robotPose3D + 
CPose3D(it->sensorPose);
  1857                         const double rang = it->sensedDistance;
  1864                         const unsigned int nSteps = 
round(1+arc_len/0.05);
  1868                         for (
double a1=-aper_2;
a1<aper_2;
a1+=Aa)
  1870                                 for (
double a2=-aper_2;
a2<aper_2;
a2+=Aa)
  1872                                         loc.
x = cos(
a1)*cos(
a2)*rang;
  1873                                         loc.
y = cos(
a1)*sin(
a2)*rang;
  1874                                         loc.
z = sin(
a1)*rang;
  1930         float                           minDistForFuse,
  1931         std::vector<bool>       *notFusedPoints)
  1935         const CPose2D           nullPose(0,0,0);
  1940         const size_t nOther = otherMap->
size();
  1947         params.maxAngularDistForCorrespondence = 0;
  1948         params.maxDistForCorrespondence = minDistForFuse;
  1959                 notFusedPoints->clear();
  1960                 notFusedPoints->reserve( 
x.size() + nOther );
  1961                 notFusedPoints->resize( 
x.size(), true );
  1970         for (
size_t i=0;i<nOther;i++)
  1972                 const unsigned long     w_a = otherMap->
getPoint(i,
a);  
  1975                 int                     closestCorr = -1;
  1976                 float           minDist = std::numeric_limits<float>::max();
  1979                         if (corrsIt->other_idx==i)
  1981                                 float   dist = 
square( corrsIt->other_x - corrsIt->this_x ) +
  1982                                                            square( corrsIt->other_y - corrsIt->this_y ) +
  1983                                                            square( corrsIt->other_z - corrsIt->this_z );
  1987                                         closestCorr = corrsIt->this_idx;
  1992                 if (closestCorr!=-1)
  1994                         unsigned long w_b = 
getPoint(closestCorr,
b);
  1998                         const float F = 1.0f/(w_a+w_b);
  2000                         x[closestCorr]=F*(w_a*
a.x+w_b*
b.x);
  2001                         y[closestCorr]=F*(w_a*
a.y+w_b*
b.y);
  2002                         z[closestCorr]=F*(w_a*
a.z+w_b*
b.z);
  2008                                 (*notFusedPoints)[closestCorr] = 
false;
  2014                                 (*notFusedPoints).push_back(
false);
  2037         const size_t nOldPtsCount = this->
size();
  2039         const size_t nNewPtsCount = nOldPtsCount + nScanPts;
  2040         this->
resize(nNewPtsCount);
  2042         const float K = 1.0f / 255;  
  2047               sensorGlobalPose = *robotPose + scan.
sensorPose;
  2053         const double m00 = HM.get_unsafe(0,0), m01 = HM.get_unsafe(0,1), m02 = HM.get_unsafe(0,2), m03 = HM.get_unsafe(0,3);
  2054         const double m10 = HM.get_unsafe(1,0), m11 = HM.get_unsafe(1,1), m12 = HM.get_unsafe(1,2), m13 = HM.get_unsafe(1,3);
  2055         const double m20 = HM.get_unsafe(2,0), m21 = HM.get_unsafe(2,1), m22 = HM.get_unsafe(2,2), m23 = HM.get_unsafe(2,3);
  2058         for (
size_t i=0;i<nScanPts;i++)
  2065                 const double gx = m00*lx + m01*ly + m02*lz + m03;
  2066                 const double gy = m10*lx + m11*ly + m12*lz + m13;
  2067                 const double gz = m20*lx + m21*ly + m22*lz + m23;
 #define ASSERT_EQUAL_(__A, __B)
 
void clear()
Erase all the contents of the map. 
 
virtual void copyFrom(const CPointsMap &obj)=0
Virtual assignment operator, copies as much common data (XYZ, color,...) as possible from the source ...
 
double x() const
Common members of all points & poses classes. 
 
TLikelihoodOptions()
Initilization of default parameters. 
 
void kdTreeNClosestPoint3DWithIdx(float x0, float y0, float z0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_z, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
KD Tree-based search for the N closest points to some given 3D coordinates. 
 
void insertAnotherMap(const CPointsMap *otherMap, const mrpt::poses::CPose3D &otherPose)
Insert the contents of another map into this one with some geometric transformation, without fusing close points. 
 
Parameters for CMetricMap::compute3DMatchingRatio() 
 
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen. 
 
bool save2D_to_text_file(const std::string &file) const
Save to a text file. 
 
bool isPlanarMap
If set to true, only HORIZONTAL (in the XY plane) measurements will be inserted in the map (Default v...
 
virtual void addFrom(const CPointsMap &anotherMap)
Adds all the points from anotherMap to this map, without fusing. 
 
void readFromStream(mrpt::utils::CStream &in)
Binary dump to stream - for usage in derived classes' serialization. 
 
void getPointFast(size_t index, float &x, float &y, float &z) const
Just like getPoint() but without checking out-of-bound index and without returning the point weight...
 
Declares a class derived from "CObservation" that encapsules a single range measurement, and associated parameters. 
 
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL. 
 
A CObservation-derived class for RAW DATA (and optionally, point cloud) of scans from 3D Velodyne LID...
 
static float COLOR_3DSCENE_B
 
void changeCoordinatesReference(const mrpt::poses::CPose2D &b)
Replace each point  by  (pose compounding operator). 
 
#define LOADABLEOPTS_DUMP_VAR_DEG(variableName)
Macro for dumping a variable to a stream, transforming the argument from radians to degrees...
 
#define ASSERT_ABOVE_(__A, __B)
 
float sensorConeApperture
Cone aperture of each ultrasonic beam, in radians. 
 
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
 
void BASE_IMPEXP closestFromPointToLine(const double &Px, const double &Py, const double &x1, const double &y1, const double &x2, const double &y2, double &out_x, double &out_y)
Computes the closest point from a given point to a (infinite) line. 
 
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects ...
 
void OBS_IMPEXP(* ptr_internal_build_points_map_from_scan2D)(const mrpt::obs::CObservation2DRangeScan &obs, mrpt::maps::CMetricMapPtr &out_map, const void *insertOps)
 
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose. 
 
virtual void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::utils::TColorf &pt_color) const MRPT_OVERRIDE
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
 
static float COLOR_3DSCENE_R
The color [0,1] of points when extracted from getAs3DObject (default=blue) 
 
bool isHorizontal(const double tolerance=0) const
Return true if the 6D pose represents a Z axis almost exactly vertical (upwards or downwards)...
 
virtual void setPointAllFieldsFast(const size_t index, const std::vector< float > &point_data)=0
Set all the data fields for one point as a vector: depending on the implementation class this can be ...
 
#define THROW_EXCEPTION(msg)
 
void base_copyFrom(const CPointsMap &obj)
Helper method for ::copyFrom() 
 
#define ASSERT_BELOW_(__A, __B)
 
virtual void setPointFast(size_t index, float x, float y, float z)=0
Changes the coordinates of the given point (0-based index), without checking for out-of-bounds and wi...
 
bool derivedFrom(const TRuntimeClassId *pBaseClass) const
 
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
 
void setAllVertices(const std::vector< double > &x, const std::vector< double > &y)
Set all vertices at once. 
 
virtual bool isEmpty() const MRPT_OVERRIDE
Returns true if the map is empty/no observation has been inserted. 
 
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor. 
 
A wrapper of a TPolygon2D class, implementing CSerializable. 
 
GLuint GLenum GLenum outY
 
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf. 
 
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
 
void insertPoint(float x, float y, float z=0)
Provides a way to insert (append) individual points into the map: the missing fields of child classes...
 
virtual void getPointAllFieldsFast(const size_t index, std::vector< float > &point_data) const =0
Get all the data fields for one point as a vector: depending on the implementation class this can be ...
 
TMapGenericParams genericMapParams
Common params to all maps. 
 
virtual unsigned int getPointWeight(size_t index) const
Gets the point weight, which is ignored in all classes (defaults to 1) but in those which actually st...
 
virtual void reserve(size_t newLength)=0
Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory. 
 
TInsertionOptions()
Initilization of default parameters. 
 
const Scalar * const_iterator
 
static CSimplePointsMapPtr Create()
 
size_t PLY_export_get_vertex_count() const MRPT_OVERRIDE
In a base class, return the number of vertices. 
 
double z
X,Y,Z coordinates. 
 
bool m_boundingBoxIsUpdated
 
void compute3DDistanceToMesh(const mrpt::maps::CMetricMap *otherMap2, const mrpt::poses::CPose3D &otherMapPose, float maxDistForCorrespondence, mrpt::utils::TMatchingPairList &correspondences, float &correspondencesRatio)
Computes the matchings between this and another 3D points map. 
 
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose) MRPT_OVERRIDE
This is a common version of CMetricMap::insertObservation() for point maps (actually, CMetricMap::internal_insertObservation), so derived classes don't need to worry implementing that method unless something special is really necesary. 
 
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream. 
 
GLsizei GLsizei GLuint * obj
 
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot/vehicle frame of reference. 
 
virtual float squareDistanceToClosestCorrespondence(float x0, float y0) const MRPT_OVERRIDE
Returns the square distance from the 2D point (x0,y0) to the closest correspondence in the map...
 
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
 
bool save3D_to_text_file(const std::string &file) const
Save to a text file. 
 
This class allows loading and storing values and vectors of different types from a configuration text...
 
T square(const T x)
Inline function for the square of a number. 
 
float maxDistForCorr
(Default: 0.10f) The minimum distance between 2 non-probabilistic map elements for counting them as a...
 
std::deque< TMeasurement >::const_iterator const_iterator
 
GLuint GLenum GLenum GLenum outZ
 
TPointCloud point_cloud
Optionally, raw data can be converted into a 3D point cloud (local coordinates wrt the sensor...
 
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=NULL, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing  with G and L being 3D points and P this 6D pose...
 
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
 
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
 
A numeric matrix of compile-time fixed size. 
 
This base provides a set of functions for maths stuff. 
 
void internal_build_points_map_from_scan2D(const mrpt::obs::CObservation2DRangeScan &obs, mrpt::maps::CMetricMapPtr &out_map, const void *insertOps)
 
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const
Returns information about the class of an object in runtime. 
 
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
 
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=NULL)=0
Transform the range scan into a set of cartessian coordinated points. 
 
void writeToStream(mrpt::utils::CStream &out) const
Binary dump to stream - for usage in derived classes' serialization. 
 
Lightweight 3D point (float version). 
 
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list. 
 
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler. 
 
bool isPlanarScan(const double tolerance=0) const
Return true if the laser scanner is "horizontal", so it has an absolute value of "pitch" and "roll" l...
 
double sigma_dist
Sigma squared (variance, in meters) of the exponential used to model the likelihood (default= 0...
 
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations. 
 
std::vector< float > z
The point coordinates. 
 
void getAllPoints(VECTOR &xs, VECTOR &ys, VECTOR &zs, size_t decimation=1) const
Returns a copy of the 2D/3D points as a std::vector of float coordinates. 
 
bool PointIntoPolygon(double x, double y) const
Check if a point is inside the polygon. 
 
void generatePointCloud(const TGeneratePointCloudParameters ¶ms=defaultPointCloudParams)
Generates the point cloud into the point cloud data fields in CObservationVelodyneScan::point_cloud w...
 
bool m_largestDistanceFromOriginIsUpdated
Auxiliary variables used in "getLargestDistanceFromOrigin". 
 
void extractCylinder(const mrpt::math::TPoint2D ¢er, const double radius, const double zmin, const double zmax, CPointsMap *outMap)
Extracts the points in the map within a cylinder in 3D defined the provided radius and zmin/zmax valu...
 
This namespace contains representation of robot actions and observations. 
 
virtual void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D object representing the map. 
 
MAPS_IMPEXP float POINTSMAPS_3DOBJECT_POINTSIZE
The size of points when exporting with getAs3DObject() (default=3.0) Affects to: 
 
#define IMPLEMENTS_MEXPLUS_FROM(complete_type)
 
virtual void addFrom_classSpecific(const CPointsMap &anotherMap, const size_t nPreviousPoints)=0
Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific ...
 
virtual void setPointWeight(size_t index, unsigned long w)
Sets the point weight, which is ignored in all classes but those which actually store that field (Not...
 
virtual bool savePCDFile(const std::string &filename, bool save_as_binary) const
Save the point cloud as a PCL PCD file, in either ASCII or binary format (requires MRPT built against...
 
void getPCLPointCloud(POINTCLOUD &cloud) const
Use to convert this MRPT point cloud object into a PCL point cloud object (PointCloud<PointXYZ>). 
 
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const MRPT_OVERRIDE
Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose" In the case of a multi-metric map, this returns the average between the maps. 
 
float getLargestDistanceFromOrigin() const
This method returns the largest distance from the origin to any of the points, such as a sphere cente...
 
float m_largestDistanceFromOrigin
Auxiliary variables used in "getLargestDistanceFromOrigin". 
 
GLsizei const GLchar ** string
 
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
 
void clipOutOfRange(const mrpt::math::TPoint2D &point, float maxRange)
Delete points which are more far than "maxRange" away from the given "point". 
 
void boundingBox(float &min_x, float &max_x, float &min_y, float &max_y, float &min_z, float &max_z) const
Computes the bounding box of all the points, or (0,0 ,0,0, 0,0) if there are no points. 
 
void readFromStream(mrpt::utils::CStream &in)
Binary dump to stream - for usage in derived classes' serialization. 
 
#define CLASS_ID(class_name)
Access to runtime class ID for a defined class name. 
 
void clipOutOfRangeInZ(float zMin, float zMax)
Delete points out of the given "z" axis range have been removed. 
 
unsigned long getPoint(size_t index, float &x, float &y, float &z) const
Access to a given point from map, as a 2D point. 
 
#define MRPT_LOAD_CONFIG_VAR(variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
 
std::vector< uint8_t > intensity
Color [0,255]. 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
 
virtual void resize(size_t newLength)=0
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
 
void mark_as_modified() const
Users normally don't need to call this. 
 
bool load2Dor3D_from_text_file(const std::string &file, const bool is_3D)
2D or 3D generic implementation of load2D_from_text_file and load3D_from_text_file ...
 
bool addToExistingPointsMap
Applicable to "loadFromRangeScan" only! If set to false, the points from the scan are loaded...
 
bool fuseWithExisting
If set to true (default=false), inserted points are "fused" with previously existent ones...
 
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
See CPointsMap::loadFromRangeScan() 
 
TLikelihoodOptions likelihoodOptions
 
virtual double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) MRPT_OVERRIDE
Internal method called by computeObservationLikelihood() 
 
void getPointsBuffer(size_t &outPointsCount, const float *&xs, const float *&ys, const float *&zs) const
Provides a direct access to points buffer, or NULL if there is no points in the map. 
 
void setPoint(size_t index, float x, float y, float z)
Changes a given point from map, with Z defaulting to 0 if not provided. 
 
virtual mxArray * writeToMatlab() const
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. 
 
Declares a virtual base class for all metric maps storage classes. 
 
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
 
A class used to store a 3D pose (a 3D translation + a rotation in 3D). 
 
Declares a class that represents any robot's observation. 
 
#define MRPT_LOAD_CONFIG_VAR_DEGREES(variableName, configFileObject, sectionNameStr)
Loads a double variable, stored as radians but entered in the INI-file as degrees. 
 
virtual void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::utils::TColorf *pt_color=NULL) MRPT_OVERRIDE
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
 
static float COLOR_3DSCENE_G
 
const double & phi() const
Get the phi angle of the 2D pose (in radians) 
 
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
 
void kdtree_mark_as_outdated() const
To be called by child classes when KD tree data changes. 
 
void filterUniqueRobustPairs(const size_t num_elements_this_map, TMatchingPairList &out_filtered_list) const
Creates a filtered list of pairings with those ones which have a single correspondence which coincide...
 
float horizontalTolerance
The tolerance in rads in pitch & roll for a laser scan to be considered horizontal, considered only when isPlanarMap=true (default=0). 
 
A RGB color - floats in the range [0,1]. 
 
virtual bool loadPCDFile(const std::string &filename)
Load the point cloud from a PCL PCD file (requires MRPT built against PCL) 
 
int round(const T value)
Returns the closer integer (int) to x. 
 
virtual ~CPointsMap()
Virtual destructor. 
 
void writeToStream(mrpt::utils::CStream &out) const
Binary dump to stream - for usage in derived classes' serialization. 
 
TInsertionOptions insertionOptions
The options used when inserting observations in the map. 
 
double max_corr_distance
Maximum distance in meters to consider for the numerator divided by "sigma_dist", so that each point ...
 
virtual const mrpt::maps::CSimplePointsMap * getAsSimplePointsMap() const
If the map is a simple points map or it's a multi-metric map that contains EXACTLY one simple points ...
 
TAuxLoadFunctor dummy_loader
 
virtual void determineMatching2D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose2D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const TMatchingParams ¶ms, TMatchingExtraResults &extraResults) const MRPT_OVERRIDE
Computes the matching between this and another 2D point map, which includes finding: ...
 
static CPointCloudPtr Create()
 
size_t kdTreeClosestPoint2D(float x0, float y0, float &out_x, float &out_y, float &out_dist_sqr) const
KD Tree-based search for the closest point (only ONE) to some given 2D coordinates. 
 
virtual void insertPointFast(float x, float y, float z=0)=0
The virtual method for insertPoint() without calling mark_as_modified() 
 
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream. 
 
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list. 
 
uint32_t decimation
Speed up the likelihood computation by considering only one out of N rays (default=10) ...
 
void extractPoints(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, CPointsMap *outMap, const double &R=1, const double &G=1, const double &B=1)
Extracts the points in the map within the area defined by two corners. 
 
Parameters for the determination of matchings between point clouds, etc. 
 
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const
Returns information about the class of an object in runtime. 
 
size_t size() const
Returns the number of stored points in the map. 
 
#define ASSERTMSG_(f, __ERROR_MSG)
 
GLubyte GLubyte GLubyte a
 
bool disableDeletion
If set to false (default=true) points in the same plane as the inserted scan and inside the free spac...
 
GLenum const GLfloat * params
 
void loadFromVelodyneScan(const mrpt::obs::CObservationVelodyneScan &scan, const mrpt::poses::CPose3D *robotPose=NULL)
Like loadFromRangeScan() for Velodyne 3D scans. 
 
double phi
Orientation (rads) 
 
float kdTreeClosestPoint2DsqrError(float x0, float y0) const
Like kdTreeClosestPoint2D, but just return the square error from some point to its closest neighbor...
 
virtual void determineMatching3D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const TMatchingParams ¶ms, TMatchingExtraResults &extraResults) const MRPT_OVERRIDE
Computes the matchings between this and another 3D points map - method used in 3D-ICP. 
 
void kdTreeTwoClosestPoint2D(float x0, float y0, float &out_x1, float &out_y1, float &out_x2, float &out_y2, float &out_dist_sqr1, float &out_dist_sqr2) const
KD Tree-based search for the TWO closest point to some given 2D coordinates. 
 
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
 
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
 
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space. 
 
void fuseWith(CPointsMap *anotherMap, float minDistForFuse=0.02f, std::vector< bool > *notFusedPoints=NULL)
Insert the contents of another map into this one, fusing the previous content with the new one...
 
void applyDeletionMask(const std::vector< bool > &mask)
Remove from the map the points marked in a bool's array as "true". 
 
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling) ...
 
TMeasurementList sensedData
All the measurements. 
 
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form. 
 
size_t kdTreeClosestPoint3D(float x0, float y0, float z0, float &out_x, float &out_y, float &out_z, float &out_dist_sqr) const
KD Tree-based search for the closest point (only ONE) to some given 3D coordinates. 
 
float minDistBetweenLaserPoints
The minimum distance between points (in 3D): If two points are too close, one of them is not inserted...
 
const POINTSMAP * buildAuxPointsMap(const void *options=NULL) const
Returns a cached points map representing this laser scan, building it upon the first call...