25 "mrpt::maps::CHeightGridMap2D_MRF,dem_mrf",
28 MRPT_TODO(
"Improvement: Rewrite to avoid union -> variant");
36 const std::string& sectionNamePrefix)
39 const std::string sSectCreation =
40 sectionNamePrefix + string(
"_creationOpts");
42 run_map_estimation_at_ctor,
bool, source, sSectCreation);
49 sSectCreation,
"mapType", mapType);
51 insertionOpts.loadFromConfigFile(
52 source, sectionNamePrefix +
string(
"_insertOpts"));
56 std::ostream&
out)
const 70 this->insertionOpts.dumpToTextStream(
out);
91 double y_max,
double resolution,
bool run_first_map_estimation_now)
95 m_rfgm_run_update_upon_clear = run_first_map_estimation_now;
103 const double x,
const double y,
const double z,
107 if (!cell)
return false;
108 this->insertIndividualReading(
117 const size_t cx,
const size_t cy,
double& z_out)
const 129 const double x,
const double y,
double& z_out)
const 151 return dem_internal_insertObservation(obs, robotPose);
168 dyngridcommon_writeToStream(
out);
175 n =
static_cast<uint32_t
>(m_map.size());
179 #if MRPT_IS_BIG_ENDIAN 180 for (uint32_t i = 0; i < n; i++)
182 out << m_map[i].kf_mean << m_map[i].dm_mean << m_map[i].dmv_var_mean;
186 out.WriteBuffer(&m_map[0],
sizeof(m_map[0]) * m_map.size());
190 out << uint8_t(m_mapType) << m_cov << m_stackedCov;
192 out << insertionOptions.sigma << insertionOptions.cutoffRadius
193 << insertionOptions.R_min << insertionOptions.R_max
194 << insertionOptions.KF_covSigma << insertionOptions.KF_initialCellStd
195 << insertionOptions.KF_observationModelNoise
196 << insertionOptions.KF_defaultCellMeanValue
197 << insertionOptions.KF_W_size;
199 out << m_average_normreadings_mean << m_average_normreadings_var
200 << uint64_t(m_average_normreadings_count);
202 out << genericMapParams;
212 dyngridcommon_readFromStream(in);
224 #if MRPT_IS_BIG_ENDIAN 225 for (uint32_t i = 0; i < n; i++)
226 in >> m_map[i].kf_mean >> m_map[i].dm_mean >>
227 m_map[i].dmv_var_mean;
230 in.
ReadBuffer(&m_map[0],
sizeof(m_map[0]) * m_map.size());
238 in >> m_cov >> m_stackedCov;
240 in >> insertionOptions.sigma >> insertionOptions.cutoffRadius >>
241 insertionOptions.R_min >> insertionOptions.R_max >>
242 insertionOptions.KF_covSigma >>
243 insertionOptions.KF_initialCellStd >>
244 insertionOptions.KF_observationModelNoise >>
245 insertionOptions.KF_defaultCellMeanValue >>
246 insertionOptions.KF_W_size;
251 in >> m_average_normreadings_mean >>
252 m_average_normreadings_var >> N;
253 m_average_normreadings_count = N;
256 in >> genericMapParams;
258 m_hasToRecoverMeanAndCov =
true;
271 std::ostream&
out)
const 273 out <<
"\n----------- [CHeightGridMap2D_MRF::TInsertionOptions] " 276 out <<
"[TInsertionOptions.Common] ------------ \n\n";
277 internal_dumpToTextStream_common(
290 internal_loadFromConfigFile_common(
iniFile, section);
303 if (!genericMapParams.enableSaveAs3DObject)
return;
316 if (!genericMapParams.enableSaveAs3DObject)
return;
void clear()
Erase all the contents of the map.
bool run_map_estimation_at_ctor
Runs map estimation at start up (Default:true)
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
Extra params for insertIndividualPoint()
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
#define THROW_EXCEPTION(msg)
std::string std::string format(std::string_view fmt, ARGS &&... args)
MRPT_TODO("Improvement: Rewrite to avoid union -> variant")
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
mrpt::maps::CHeightGridMap2D_MRF::TMapRepresentation mapType
The kind of map representation (see CHeightGridMap2D_MRF::CHeightGridMap2D_MRF)
void loadFromConfigFile_map_specific(const mrpt::config::CConfigFileBase &source, const std::string §ionNamePrefix) override
Load all map-specific params.
mrpt::vision::TStereoCalibParams params
TMapRepresentation
The type of map representation to be used, see CRandomFieldGridMap2D for a discussion.
CHeightGridMap2D_MRF represents digital-elevation-model over a 2D area, with uncertainty, based on a Markov-Random-Field (MRF) estimator.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map (mean)
void dumpToTextStream_map_specific(std::ostream &out) const override
ENUMTYPE read_enum(const std::string §ion, const std::string &name, const ENUMTYPE &defaultValue, bool failIfNotFound=false) const
Reads an "enum" value, where the value in the config file can be either a numerical value or the symb...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
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.
double kf_mean
[KF-methods only] The mean value of this cell
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
The contents of each cell in a CRandomFieldGridMap2D map.
double min_x
See CHeightGridMap2D_MRF::CHeightGridMap2D_MRF.
TInsertionOptions()
Default values loader.
size_t dem_get_size_y() const override
This namespace contains representation of robot actions and observations.
string iniFile(myDataDir+string("benchmark-options.ini"))
size_t dem_get_size_x() const override
void dem_update_map() override
Ensure that all observations are reflected in the map estimate.
bool insertIndividualPoint(const double x, const double y, const double z, const CHeightGridMap2D_Base::TPointInsertParams ¶ms=CHeightGridMap2D_Base::TPointInsertParams()) override
Update the DEM with one new point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
bool dem_get_z_by_cell(const size_t cx, const size_t cy, double &z_out) const override
Get cell 'z' by (cx,cy) cell indices.
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
#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...
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
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.
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
Virtual base class for "archives": classes abstracting I/O streams.
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
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
Declares a class that represents any robot's observation.
mrpt::maps::CHeightGridMap2D_MRF::TInsertionOptions insertionOpts
Observations insertion options.
void internal_clear() override
Erase all the contents of the map.
void internal_clear() override
Internal method called by clear()
size_t ReadBuffer(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer.
bool dem_get_z(const double x, const double y, double &z_out) const override
Get cell 'z' (x,y) by metric coordinates.
double dem_get_resolution() const override
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.