27 "mrpt::maps::CWeightedPointsMap,weightedPointsMap",
30 CWeightedPointsMap::TMapDefinition::TMapDefinition() =
default;
31 void CWeightedPointsMap::TMapDefinition::loadFromConfigFile_map_specific(
33 const std::string& sectionNamePrefix)
35 insertionOpts.loadFromConfigFile(
36 source, sectionNamePrefix +
string(
"_insertOpts"));
37 likelihoodOpts.loadFromConfigFile(
38 source, sectionNamePrefix +
string(
"_likelihoodOpts"));
41 void CWeightedPointsMap::TMapDefinition::dumpToTextStream_map_specific(
42 std::ostream&
out)
const 44 this->insertionOpts.dumpToTextStream(
out);
45 this->likelihoodOpts.dumpToTextStream(
out);
65 m_y.reserve(newLength);
66 m_z.reserve(newLength);
67 pointWeight.reserve(newLength);
75 m_x.resize(newLength, 0);
76 m_y.resize(newLength, 0);
77 m_z.resize(newLength, 0);
78 pointWeight.resize(newLength, 1);
84 void CWeightedPointsMap::setSize(
size_t newLength)
86 m_x.assign(newLength, 0);
87 m_y.assign(newLength, 0);
88 m_z.assign(newLength, 0);
89 pointWeight.assign(newLength, 1);
92 void CWeightedPointsMap::insertPointFast(
float x,
float y,
float z)
97 this->pointWeight.push_back(1);
101 void CWeightedPointsMap::impl_copyFrom(
const CPointsMap& obj)
104 CPointsMap::base_copyFrom(obj);
116 void CWeightedPointsMap::addFrom_classSpecific(
117 const CPointsMap& anotherMap,
const size_t nPreviousPoints)
119 const size_t nOther = anotherMap.
size();
122 const auto* anotheMap_w =
127 for (
size_t i = 0, j = nPreviousPoints; i < nOther; i++, j++)
132 uint8_t CWeightedPointsMap::serializeGetVersion()
const {
return 2; }
135 uint32_t n = m_x.size();
142 out.WriteBufferFixEndianness(&m_x[0], n);
143 out.WriteBufferFixEndianness(&m_y[0], n);
144 out.WriteBufferFixEndianness(&m_z[0], n);
145 out.WriteBufferFixEndianness(&pointWeight[0], n);
148 out << genericMapParams;
149 insertionOptions.writeToStream(
151 likelihoodOptions.writeToStream(
out);
154 void CWeightedPointsMap::serializeFrom(
182 in >> genericMapParams;
185 bool disableSaveAs3DObject;
186 in >> disableSaveAs3DObject;
187 genericMapParams.enableSaveAs3DObject =
188 !disableSaveAs3DObject;
191 insertionOptions.readFromStream(in);
198 in >> insertionOptions.minDistBetweenLaserPoints >>
199 insertionOptions.addToExistingPointsMap >>
200 insertionOptions.also_interpolate >>
201 insertionOptions.disableDeletion >>
202 insertionOptions.fuseWithExisting >>
203 insertionOptions.isPlanarMap >>
204 insertionOptions.maxDistForInterpolatePoints;
206 bool disableSaveAs3DObject;
207 in >> disableSaveAs3DObject;
208 genericMapParams.enableSaveAs3DObject =
209 !disableSaveAs3DObject;
211 in >> insertionOptions.horizontalTolerance;
214 likelihoodOptions.readFromStream(in);
225 void CWeightedPointsMap::internal_clear()
257 [[maybe_unused]]
const float gx, [[maybe_unused]]
const float gy,
258 [[maybe_unused]]
const float gz,
288 [[maybe_unused]]
const float gx, [[maybe_unused]]
const float gy,
289 [[maybe_unused]]
const float gz,
316 void CWeightedPointsMap::loadFromRangeScan(
324 void CWeightedPointsMap::loadFromRangeScan(
336 void CWeightedPointsMap::PLY_import_set_vertex_count(
const size_t N)
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
static void internal_loadFromRangeScan3D_prepareOneRange([[maybe_unused]] CWeightedPointsMap &me, [[maybe_unused]] const float gx, [[maybe_unused]] const float gy, [[maybe_unused]] const float gz, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...
static void internal_loadFromRangeScan2D_postPushBack(CWeightedPointsMap &me, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called after e...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void reserve(size_t newLength) override
Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
mrpt::maps::CPointsMap::TInsertionOptions insertionOpts
Observations insertion options.
static void internal_loadFromRangeScan3D_postPushBack(CWeightedPointsMap &me, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called after e...
static void internal_loadFromRangeScan2D_init([[maybe_unused]] CWeightedPointsMap &me, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called only on...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
With this struct options are provided to the observation insertion process.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
static void internal_loadFromRangeScan3D_postOneRange([[maybe_unused]] CWeightedPointsMap &me, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...
This class allows loading and storing values and vectors of different types from a configuration text...
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
static void internal_loadFromRangeScan2D_prepareOneRange([[maybe_unused]] CWeightedPointsMap &me, [[maybe_unused]] const float gx, [[maybe_unused]] const float gy, [[maybe_unused]] const float gz, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...
static void templ_loadFromRangeScan(Derived &obj, const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
mrpt::maps::CPointsMap::TLikelihoodOptions likelihoodOpts
Probabilistic observation likelihood options.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Virtual base class for "archives": classes abstracting I/O streams.
void vector_strong_clear(VECTOR_T &v)
Like calling a std::vector<>'s clear() method, but really forcing deallocating the memory...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
Declares a virtual base class for all metric maps storage classes.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
mrpt::aligned_std_vector< uint32_t > pointWeight
The points weights.
Helper struct used for internal_loadFromRangeScan3D_prepareOneRange()
static void internal_loadFromRangeScan3D_init([[maybe_unused]] CWeightedPointsMap &me, [[maybe_unused]] mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called only on...
size_t ReadBufferFixEndianness(T *ptr, size_t ElementCount)
Reads a sequence of elemental datatypes, taking care of reordering their bytes from the MRPT stream s...
size_t size() const
Save the point cloud as a PCL PCD file, in either ASCII or binary format.
Helper struct used for internal_loadFromRangeScan2D_prepareOneRange()