pointcloud_sanity_check.cpp
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------
2  * A repertory of multi primitive-to-primitive (MP2P) ICP algorithms in C++
3  * Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria
4  * See LICENSE for license information.
5  * ------------------------------------------------------------------------- */
6 
15 #include <mrpt/core/exceptions.h>
16 #include <mrpt/maps/CPointsMapXYZI.h>
17 #include <mrpt/maps/CPointsMapXYZIRT.h>
18 
20  const mrpt::maps::CPointsMap& pc, bool printWarnings)
21 {
22  bool ok = true;
23  const size_t n = pc.size();
24 
25  if (auto* pcIRT = dynamic_cast<const mrpt::maps::CPointsMapXYZIRT*>(&pc);
26  pcIRT)
27  {
28  if (pcIRT->hasIntensityField() &&
29  pcIRT->getPointsBufferRef_intensity()->size() != n)
30  {
31  ASSERT_EQUAL_(pcIRT->getPointsBufferRef_intensity()->size(), n);
32  ok = false;
33  if (printWarnings)
34  std::cerr << "[mp2p_icp] WARNING: Intensity channel has "
35  "incorrect length."
36  << std::endl;
37  }
38  if (pcIRT->hasRingField() &&
39  pcIRT->getPointsBufferRef_ring()->size() != n)
40  {
41  ok = false;
42  if (printWarnings)
43  std::cerr << "[mp2p_icp] WARNING: Ring channel has "
44  "incorrect length."
45  << std::endl;
46  }
47  if (pcIRT->hasTimeField() &&
48  pcIRT->getPointsBufferRef_timestamp()->size() != n)
49  {
50  ok = false;
51  if (printWarnings)
52  std::cerr << "[mp2p_icp] WARNING: Timestamp channel has "
53  "incorrect length."
54  << std::endl;
55  }
56  }
57  else if (auto* pcI = dynamic_cast<const mrpt::maps::CPointsMapXYZI*>(&pc);
58  pcI)
59  {
60  if (pcI->getPointsBufferRef_intensity() &&
61  pcI->getPointsBufferRef_intensity()->size() != n)
62  {
63  ok = false;
64  if (printWarnings)
65  std::cerr << "[mp2p_icp] WARNING: Intensity channel has "
66  "incorrect length."
67  << std::endl;
68  }
69  }
70  return ok;
71 }
mp2p_icp::pointcloud_sanity_check
bool pointcloud_sanity_check(const mrpt::maps::CPointsMap &pc, bool printWarnings=true)
Definition: pointcloud_sanity_check.cpp:19
pointcloud_sanity_check.h
Checks for consistent length of field vectors.
ok
ROSCPP_DECL bool ok()


mp2p_icp
Author(s): Jose-Luis Blanco-Claraco
autogenerated on Tue Jul 2 2024 02:47:25