14 #include <mrpt/containers/yaml.h> 
   15 #include <mrpt/maps/CSimplePointsMap.h> 
   16 #include <mrpt/math/utils.h>   
   17 #include <mrpt/obs/CObservationRotatingScan.h> 
   18 #include <mrpt/version.h> 
   43     const std::optional<mrpt::poses::CPose3D>& robotPose)
 const 
   46     using namespace mrpt::obs;
 
   48     ASSERTMSG_(
initialized_, 
"initialize() must be called once before using process().");
 
   52     const auto obsClassName = o.GetRuntimeClass()->className;
 
   57     bool processed = 
false;
 
   63     if (
auto oRS = 
dynamic_cast<const CObservationRotatingScan*
>(&o); oRS)
 
   67     if (processed) 
return true;  
 
   70     mrpt::maps::CPointsMap::Ptr outPc;
 
   73         outPc = std::dynamic_pointer_cast<mrpt::maps::CPointsMap>(itLy->second);
 
   80         outPc                            = mrpt::maps::CSimplePointsMap::Create();
 
   84     if (!outPc) outPc = mrpt::maps::CSimplePointsMap::Create();
 
   96     const std::optional<mrpt::poses::CPose3D>& robotPose)
 const 
   98 #if MRPT_VERSION >= 0x020b04 
   99     auto outPc = mrpt::maps::CSimplePointsMap::Create();
 
  101     ASSERT_(!pc.organizedPoints.empty());
 
  103     const auto nRows = pc.rowCount;
 
  104     const auto nCols = pc.columnCount;
 
  106     ASSERT_EQUAL_(nRows, pc.organizedPoints.rows());
 
  107     ASSERT_EQUAL_(nCols, pc.organizedPoints.cols());
 
  109     ASSERT_EQUAL_(nRows, pc.rangeImage.rows());
 
  110     ASSERT_EQUAL_(nCols, pc.rangeImage.cols());
 
  113     for (
size_t r = 0; r < nRows; r++)
 
  116         for (
size_t i = 1; i + 1 < nCols; i++)
 
  119             if (!pc.rangeImage(r, i - 1) || !pc.rangeImage(r, i) || !pc.rangeImage(r, i + 1))
 
  122             const auto& pt_im1 = pc.organizedPoints(r, i - 1);
 
  123             const auto& pt_i   = pc.organizedPoints(r, i);
 
  124             const auto& pt_ip1 = pc.organizedPoints(r, i + 1);
 
  126             const auto v1  = (pt_i - pt_im1);
 
  127             const auto v2  = (pt_ip1 - pt_i);
 
  128             const auto v1n = v1.norm();
 
  129             const auto v2n = v2.norm();
 
  134             const float score = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
 
  140                     outPc->insertPoint(robotPose->composePoint(pc.organizedPoints(r, i)));
 
  142                     outPc->insertPoint(pc.organizedPoints(r, i));
 
  152     THROW_EXCEPTION(
"This class requires MRPT >=v2.11.4");