40 CPointsMapXYZI::TMapDefinition::TMapDefinition() = 
default;
    42 void CPointsMapXYZI::TMapDefinition::loadFromConfigFile_map_specific(
    45     insertionOpts.loadFromConfigFile(
    46         source, sectionNamePrefix + 
string(
"_insertOpts"));
    47     likelihoodOpts.loadFromConfigFile(
    48         source, sectionNamePrefix + 
string(
"_likelihoodOpts"));
    51 void CPointsMapXYZI::TMapDefinition::dumpToTextStream_map_specific(
    52     std::ostream& 
out)
 const    54     this->insertionOpts.dumpToTextStream(
out);
    55     this->likelihoodOpts.dumpToTextStream(
out);
    75     m_y.reserve(newLength);
    76     m_z.reserve(newLength);
    77     m_intensity.reserve(newLength);
    85     m_x.resize(newLength, 0);
    86     m_y.resize(newLength, 0);
    87     m_z.resize(newLength, 0);
    88     m_intensity.resize(newLength, 1);
    95 void CPointsMapXYZI::setSize(
size_t newLength)
    97     m_x.assign(newLength, 0);
    98     m_y.assign(newLength, 0);
    99     m_z.assign(newLength, 0);
   100     m_intensity.assign(newLength, 0);
   107     CPointsMap::base_copyFrom(obj);
   113 uint8_t CPointsMapXYZI::serializeGetVersion()
 const { 
return 0; }
   116     uint32_t n = m_x.size();
   123         out.WriteBufferFixEndianness(&m_x[0], n);
   124         out.WriteBufferFixEndianness(&m_y[0], n);
   125         out.WriteBufferFixEndianness(&m_z[0], n);
   126         out.WriteBufferFixEndianness(&m_intensity[0], n);
   128     insertionOptions.writeToStream(
out);
   129     likelihoodOptions.writeToStream(
out);
   132 void CPointsMapXYZI::serializeFrom(
   152             insertionOptions.readFromStream(in);
   153             likelihoodOptions.readFromStream(in);
   161 void CPointsMapXYZI::internal_clear()
   170 void CPointsMapXYZI::setPointRGB(
   171     size_t index, 
float x, 
float y, 
float z, 
float R, 
float G, 
float B)
   177     m_intensity[index] = 
R;
   181 void CPointsMapXYZI::setPointIntensity(
size_t index, 
float I)
   184     this->m_intensity[index] = I;
   188 void CPointsMapXYZI::insertPointFast(
float x, 
float y, 
float z)
   193     m_intensity.push_back(0);
   197 void CPointsMapXYZI::insertPointRGB(
   198     float x, 
float y, 
float z, 
float R_intensity, 
float G_ignored,
   204     m_intensity.push_back(R_intensity);
   208 void CPointsMapXYZI::getAs3DObject(
   213     if (!genericMapParams.enableSaveAs3DObject) 
return;
   217     obj->loadFromPointsMap(
this);
   218     obj->setColor(1, 1, 1, 1.0);
   219     obj->setPointSize(this->renderOptions.point_size);
   224 void CPointsMapXYZI::getPointRGB(
   225     size_t index, 
float& x, 
float& y, 
float& z, 
float& 
R, 
float& 
G,
   233     R = 
G = B = m_intensity[index];
   236 float CPointsMapXYZI::getPointIntensity(
size_t index)
 const   239     return m_intensity[index];
   242 bool CPointsMapXYZI::saveXYZI_to_text_file(
const std::string& file)
 const   245     if (!f) 
return false;
   246     for (
unsigned int i = 0; i < m_x.size(); i++)
   247         os::fprintf(f, 
"%f %f %f %f\n", m_x[i], m_y[i], m_z[i], m_intensity[i]);
   252 bool CPointsMapXYZI::loadXYZI_from_text_file(
const std::string& file)
   262     if (!f.is_open()) 
return false;
   267         std::getline(f, line);
   269         std::stringstream ss(line);
   272         if (!(ss >> x >> y >> z >> i))
   277         insertPointFast(x, y, z);
   278         m_intensity.push_back(i);
   289 void CPointsMapXYZI::addFrom_classSpecific(
   290     const CPointsMap& anotherMap, 
const size_t nPreviousPoints)
   292     const size_t nOther = anotherMap.
size();
   295     const auto* anotheMap_col =
   300         for (
size_t i = 0, j = nPreviousPoints; i < nOther; i++, j++)
   327         [[maybe_unused]] 
const float gy, [[maybe_unused]] 
const float gz,
   357         [[maybe_unused]] 
const float gy, [[maybe_unused]] 
const float gz,
   369         const float pI = 1.0f;
   384 void CPointsMapXYZI::loadFromRangeScan(
   388         CPointsMapXYZI>::templ_loadFromRangeScan(*
this, rangeScan, robotPose);
   392 void CPointsMapXYZI::loadFromRangeScan(
   396         CPointsMapXYZI>::templ_loadFromRangeScan(*
this, rangeScan, robotPose);
   400 void CPointsMapXYZI::PLY_import_set_vertex_count(
const size_t N)
   405 void CPointsMapXYZI::PLY_import_set_vertex(
   410             idx, pt.
x, pt.
y, pt.
z, pt_color->
R, pt_color->
G, pt_color->
B);
   412         this->setPoint(idx, pt.
x, pt.
y, pt.
z);
   415 void CPointsMapXYZI::PLY_export_get_vertex(
   424     pt_color.
R = pt_color.
G = pt_color.
B = m_intensity[idx];
   427 bool CPointsMapXYZI::loadFromKittiVelodyneFile(
const std::string& filename)
   437             if (f_gz.
open(filename)) f = &f_gz;
   441             if (f_normal.
open(filename)) f = &f_normal;
   445                 "Could not open thefile: `%s`", filename.c_str());
   448         this->reserve(10000);
   452             constexpr std::size_t nToRead = 
sizeof(float) * 4;
   454             std::size_t nRead = f->
Read(&xyzi, nToRead);
   457             else if (nRead == nToRead)
   459                 m_x.push_back(xyzi[0]);
   460                 m_y.push_back(xyzi[1]);
   461                 m_z.push_back(xyzi[2]);
   462                 m_intensity.push_back(xyzi[3]);
   465                 throw std::runtime_error(
   466                     "Unexpected EOF at the middle of a XYZI record "   467                     "(truncated or corrupted file?)");
   469         this->mark_as_modified();
   472     catch (
const std::exception& e)
   474         std::cerr << 
"[loadFromKittiVelodyneFile] " << e.what() << std::endl;
   479 bool CPointsMapXYZI::saveToKittiVelodyneFile(
const std::string& filename)
 const   485         for (
size_t i = 0; i < m_x.size(); i++)
   487             const float xyzi[4] = {m_x[i], m_y[i], m_z[i], m_intensity[i]};
   488             const auto toWrite = 
sizeof(float) * 4;
   489             std::size_t nWr = f.
Write(&xyzi, toWrite);
   494     catch (
const std::exception& e)
   496         std::cerr << 
"[saveToKittiVelodyneFile] " << e.what() << std::endl;
 
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
 
static Ptr Create(Args &&... args)
 
#define THROW_EXCEPTION(msg)
 
int void fclose(FILE *f)
An OS-independent version of fclose. 
 
mrpt::maps::CPointsMap::TLikelihoodOptions likelihoodOpts
 
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files. 
 
mrpt::aligned_std_vector< float > m_intensity
The intensity/reflectance data. 
 
virtual size_t Read(void *Buffer, size_t Count)=0
Introduces a pure virtual method responsible for reading from the stream. 
 
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
 
static void internal_loadFromRangeScan3D_postOneRange(CPointsMapXYZI &me, mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...
 
static void internal_loadFromRangeScan3D_init(CPointsMapXYZI &me, mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called only on...
 
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
 
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations. 
 
static void internal_loadFromRangeScan2D_init(CPointsMapXYZI &me, mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called only on...
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
 
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. 
 
static void internal_loadFromRangeScan2D_prepareOneRange(CPointsMapXYZI &me, [[maybe_unused]] const float gx, [[maybe_unused]] const float gy, [[maybe_unused]] const float gz, mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...
 
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure. 
 
This namespace contains representation of robot actions and observations. 
 
static void internal_loadFromRangeScan2D_postPushBack(CPointsMapXYZI &me, mrpt::maps::CPointsMap::TLaserRange2DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called after e...
 
std::string extractFileExtension(const std::string &filePath, bool ignore_gz=false)
Extract the extension of a filename. 
 
static void internal_loadFromRangeScan3D_postPushBack(CPointsMapXYZI &me, mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called after e...
 
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
 
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf. 
 
A map of 3D points with reflectance/intensity (float). 
 
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...
 
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
 
An RGBA color - floats in the range [0,1]. 
 
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream. 
 
Helper struct used for internal_loadFromRangeScan3D_prepareOneRange() 
 
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen. 
 
mrpt::maps::CPointsMap::TInsertionOptions insertionOpts
 
Saves data to a file and transparently compress the data using the given compression level...
 
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
 
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. 
 
void clear()
Clear the contents of this container. 
 
Helper struct used for internal_loadFromRangeScan2D_prepareOneRange() 
 
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. 
 
static void internal_loadFromRangeScan3D_prepareOneRange(CPointsMapXYZI &me, [[maybe_unused]] const float gx, [[maybe_unused]] const float gy, [[maybe_unused]] const float gz, mrpt::maps::CPointsMap::TLaserRange3DInsertContext &lric)
Helper method fot the generic implementation of CPointsMap::loadFromRangeScan(), to be called once pe...