Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes
mrpt::maps::CRandomFieldGridMap3D Class Reference

Detailed Description

CRandomFieldGridMap3D represents a 3D regular grid where each voxel is associated one real-valued property which is to be estimated by this class.

This class implements a Gaussian Markov Random Field (GMRF) estimator, with each voxel being connected to its 6 immediate neighbors (Up, down, left, right, front, back).

Note that this class does not derive from mrpt::maps::CMetricMap since the estimated values do not have sensor-especific semantics, i.e. the grid can be used to estimate temperature, gas concentration, etc.

Usage:

Custom connectivity patterns can be defined with setVoxelsConnectivity().

See also
mrpt::maps::CRandomFieldGridMap3D
Note
[New in MRPT 1.5.0]

Definition at line 78 of file CRandomFieldGridMap3D.h.

#include <mrpt/maps/CRandomFieldGridMap3D.h>

Inheritance diagram for mrpt::maps::CRandomFieldGridMap3D:
Inheritance graph

Classes

struct  ConnectivityDescriptor
 Base class for user-supplied objects capable of describing voxels connectivity, used to build prior factors of the MRF graph. More...
 
struct  TInsertionOptions
 Parameters common to any derived class. More...
 
struct  TObservationGMRF
 
struct  TPriorFactorGMRF
 

Public Types

enum  TVoxelInterpolationMethod { gimNearest = 0, gimBilinear }
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
 CRandomFieldGridMap3D (double x_min=-2, double x_max=2, double y_min=-2, double y_max=2, double z_min=-2, double z_max=2, double voxel_size=0.5, bool call_initialize_now=true)
 Constructor. More...
 
void clear () override
 Erases all added observations and start again with an empty gridmap. More...
 
bool saveAsCSV (const std::string &filName_mean, const std::string &filName_stddev=std::string()) const
 Save the current estimated mean values to a CSV file (compatible with Paraview) with fields x y z mean_value. More...
 
bool saveAsVtkStructuredGrid (const std::string &fil) const
 Save the current estimated grid to a VTK file (.vts) as a "structured grid". More...
 
virtual void resize (double new_x_min, double new_x_max, double new_y_min, double new_y_max, double new_z_min, double new_z_max, const TRandomFieldVoxel &defaultValueNewvoxels, double additionalMarginMeters=2.0) override
 Changes the size of the grid, maintaining previous contents. More...
 
virtual void setSize (const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max, const double resolution_xy, const double resolution_z=-1.0, const TRandomFieldVoxel *fill_value=nullptr) override
 Changes the size of the grid, erasing previous contents.If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy More...
 
void setVoxelsConnectivity (const ConnectivityDescriptor::Ptr &new_connectivity_descriptor)
 Sets a custom object to define the connectivity between voxels. More...
 
bool insertIndividualReading (const double sensorReading, const double sensorVariance, const mrpt::math::TPoint3D &point, const TVoxelInterpolationMethod method, const bool update_map)
 Direct update of the map with a reading in a given position of the map. More...
 
void updateMapEstimation ()
 Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations, using parameters in insertionOptions. More...
 
void getAsVtkStructuredGrid (vtkStructuredGrid *output, const std::string &label_mean=std::string("mean"), const std::string &label_stddev=std::string("stddev")) const
 Returns the 3D grid contents as an VTK grid. More...
 
virtual void resize (double new_x_min, double new_x_max, double new_y_min, double new_y_max, double new_z_min, double new_z_max, const TRandomFieldVoxel &defaultValueNewCells, double additionalMarginMeters=2.0)
 Changes the size of the grid, maintaining previous contents. More...
 
virtual void setSize (const double x_min, const double x_max, const double y_min, const double y_max, const double z_min, const double z_max, const double resolution_xy, const double resolution_z_=-1.0, const TRandomFieldVoxel *fill_value=nullptr)
 Changes the size of the grid, ERASING all previous contents. More...
 
void fill (const TRandomFieldVoxel &value)
 Fills all the cells with the same value. More...
 
size_t cellAbsIndexFromCXCYCZ (const int cx, const int cy, const int cz) const
 Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension). More...
 
TRandomFieldVoxelcellByPos (double x, double y, double z)
 Returns a pointer to the contents of a voxel given by its coordinates, or nullptr if it is out of the map extensions. More...
 
const TRandomFieldVoxelcellByPos (double x, double y, double z) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
TRandomFieldVoxelcellByIndex (unsigned int cx, unsigned int cy, unsigned int cz)
 Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions. More...
 
const TRandomFieldVoxelcellByIndex (unsigned int cx, unsigned int cy, unsigned int cz) const
 Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions. More...
 
size_t getSizeX () const
 
size_t getSizeY () const
 
size_t getSizeZ () const
 
size_t getVoxelCount () const
 
double getXMin () const
 
double getXMax () const
 
double getYMin () const
 
double getYMax () const
 
double getZMin () const
 
double getZMax () const
 
double getResolutionXY () const
 
double getResolutionZ () const
 
int x2idx (double x) const
 Transform a coordinate values into voxel indexes. More...
 
int y2idx (double y) const
 
int z2idx (double z) const
 
double idx2x (int cx) const
 Transform a voxel index into a coordinate value of the voxel central point. More...
 
double idx2y (int cy) const
 
double idx2z (int cz) const
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Public Attributes

TInsertionOptions insertionOptions
 

Static Public Attributes

static bool ENABLE_GMRF_PROFILER
 [default:false] Enables a profiler to show a performance report at application end. More...
 
static const size_t INVALID_VOXEL_IDX
 
static mrpt::system::TConsoleColor logging_levels_to_colors [NUMBER_OF_VERBOSITY_LEVELS]
 Map from VerbosityLevels to their corresponding mrpt::system::TConsoleColor. More...
 
static std::string logging_levels_to_names [NUMBER_OF_VERBOSITY_LEVELS]
 Map from VerbosityLevels to their corresponding names. More...
 

Protected Member Functions

void internal_initialize (bool erase_prev_contents=true)
 Internal: called called after each change of resolution, size, etc. More...
 
std::vector< TRandomFieldVoxel > & m_map_castaway_const () const
 Used only from logically const method that really need to modify the object. More...
 
void dyngridcommon_writeToStream (ARCHIVE &out) const
 Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More...
 
void dyngridcommon_readFromStream (ARCHIVE &in)
 Serialization of all parameters, except the contents of each voxel (responsability of the derived class) More...
 
CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 

Protected Attributes

ConnectivityDescriptor::Ptr m_gmrf_connectivity
 Empty: default. More...
 
mrpt::graphs::ScalarFactorGraph m_gmrf
 
std::vector< std::deque< TObservationGMRF > > m_mrf_factors_activeObs
 Vector with the active observations and their respective Information, for each map cell. More...
 
std::deque< TPriorFactorGMRFm_mrf_factors_priors
 Vector with the precomputed priors for each GMRF model. More...
 
std::vector< TRandomFieldVoxelm_map
 The cells. More...
 
double m_x_min
 
double m_x_max
 
double m_y_min
 
double m_y_max
 
double m_z_min
 
double m_z_max
 
double m_resolution_xy
 
double m_resolution_z
 
size_t m_size_x
 
size_t m_size_y
 
size_t m_size_z
 
size_t m_size_x_times_y
 
VerbosityLevel m_min_verbosity_level
 Provided messages with VerbosityLevel smaller than this value shall be ignored. More...
 

Private Types

using BASE = mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >
 

Private Member Functions

std::string generateStringFromFormat (const char *fmt, va_list argp) const
 Helper method for generating a std::string instance from printf-like arguments. More...
 

Private Attributes

std::string m_logger_name
 
std::deque< TMsgm_history
 
std::deque< output_logger_callback_t > m_listCallbacks
 

RTTI stuff


using Ptr = std::shared_ptr< CRandomFieldGridMap3D >
 
using ConstPtr = std::shared_ptr< const CRandomFieldGridMap3D >
 
using UniquePtr = std::unique_ptr< CRandomFieldGridMap3D >
 
using ConstUniquePtr = std::unique_ptr< const CRandomFieldGridMap3D >
 
static mrpt::rtti::CLASSINIT _init_CRandomFieldGridMap3D
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CRandomFieldGridMap3D"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::rtti::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Logging methods

bool logging_enable_console_output
 [Default=true] Set it to false in case you don't want the logged messages to be dumped to the output automatically. More...
 
bool logging_enable_keep_record
 [Default=false] Enables storing all messages into an internal list. More...
 
void logStr (const VerbosityLevel level, const std::string &msg_str) const
 Main method to add the specified message string to the logger. More...
 
void logFmt (const VerbosityLevel level, const char *fmt,...) const MRPT_printf_format_check(3
 Alternative logging method, which mimics the printf behavior. More...
 
void void logCond (const VerbosityLevel level, bool cond, const std::string &msg_str) const
 Log the given message only if the condition is satisfied. More...
 
void setLoggerName (const std::string &name)
 Set the name of the COutputLogger instance. More...
 
std::string getLoggerName () const
 Return the name of the COutputLogger instance. More...
 
void setMinLoggingLevel (const VerbosityLevel level)
 Set the minimum logging level for which the incoming logs are going to be taken into account. More...
 
void setVerbosityLevel (const VerbosityLevel level)
 alias of setMinLoggingLevel() More...
 
VerbosityLevel getMinLoggingLevel () const
 
bool isLoggingLevelVisible (VerbosityLevel level) const
 
void getLogAsString (std::string &log_contents) const
 Fill the provided string with the contents of the logger's history in std::string representation. More...
 
std::string getLogAsString () const
 Get the history of COutputLogger instance in a string representation. More...
 
void writeLogToFile (const std::string *fname_in=NULL) const
 Write the contents of the COutputLogger instance to an external file. More...
 
void dumpLogToConsole () const
 Dump the current contents of the COutputLogger instance in the terminal window. More...
 
std::string getLoggerLastMsg () const
 Return the last Tmsg instance registered in the logger history. More...
 
void getLoggerLastMsg (std::string &msg_str) const
 Fill inputtted string with the contents of the last message in history. More...
 
void loggerReset ()
 Reset the contents of the logger instance. More...
 
void logRegisterCallback (output_logger_callback_t userFunc)
 
bool logDeregisterCallback (output_logger_callback_t userFunc)
 

Member Typedef Documentation

◆ BASE

Definition at line 83 of file CRandomFieldGridMap3D.h.

◆ ConstPtr

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ ConstUniquePtr

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ UniquePtr

Definition at line 85 of file CRandomFieldGridMap3D.h.

Member Enumeration Documentation

◆ TVoxelInterpolationMethod

Enumerator
gimNearest 
gimBilinear 

Definition at line 202 of file CRandomFieldGridMap3D.h.

Constructor & Destructor Documentation

◆ CRandomFieldGridMap3D()

CRandomFieldGridMap3D::CRandomFieldGridMap3D ( double  x_min = -2,
double  x_max = 2,
double  y_min = -2,
double  y_max = 2,
double  z_min = -2,
double  z_max = 2,
double  voxel_size = 0.5,
bool  call_initialize_now = true 
)

Constructor.

If you set call_initialize_now to false, the object will be initialized immediately (without the heavy initialization of the GMRF), but you then must call setSize() or clear() later to properly initialize the object before using it to insert observations.

Definition at line 39 of file CRandomFieldGridMap3D.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::TRuntimeClassId* mrpt::maps::CRandomFieldGridMap3D::_GetBaseClass ( )
staticprotected

◆ cellAbsIndexFromCXCYCZ()

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ ( const int  cx,
const int  cy,
const int  cz 
) const
inlineinherited

Gets the absolute index of a voxel in the linear container m_map[] from its cx,cy,cz indices, or -1 if out of map bounds (in any dimension).

See also
x2idx(), y2idx(), z2idx()

Definition at line 232 of file CDynamicGrid3D.h.

◆ cellByIndex() [1/2]

TRandomFieldVoxel * mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex ( unsigned int  cx,
unsigned int  cy,
unsigned int  cz 
)
inlineinherited

Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions.

Definition at line 266 of file CDynamicGrid3D.h.

◆ cellByIndex() [2/2]

const TRandomFieldVoxel * mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByIndex ( unsigned int  cx,
unsigned int  cy,
unsigned int  cz 
) const
inlineinherited

Returns a pointer to the contents of a voxel given by its voxel indexes, or nullptr if it is out of the map extensions.

Definition at line 276 of file CDynamicGrid3D.h.

◆ cellByPos() [1/2]

TRandomFieldVoxel * mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos ( double  x,
double  y,
double  z 
)
inlineinherited

Returns a pointer to the contents of a voxel given by its coordinates, or nullptr if it is out of the map extensions.

Definition at line 247 of file CDynamicGrid3D.h.

◆ cellByPos() [2/2]

const TRandomFieldVoxel * mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellByPos ( double  x,
double  y,
double  z 
) const
inlineinherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 255 of file CDynamicGrid3D.h.

◆ clear()

void CRandomFieldGridMap3D::clear ( )
overridevirtual

Erases all added observations and start again with an empty gridmap.

Reimplemented from mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >.

Definition at line 83 of file CRandomFieldGridMap3D.cpp.

References mrpt::containers::CDynamicGrid3D< T >::clear().

◆ clone()

virtual mrpt::rtti::CObject* mrpt::maps::CRandomFieldGridMap3D::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::maps::CRandomFieldGridMap3D::Create ( Args &&...  args)
inlinestatic

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ CreateObject()

static mrpt::rtti::CObject* mrpt::maps::CRandomFieldGridMap3D::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::maps::CRandomFieldGridMap3D::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ dumpLogToConsole()

void COutputLogger::dumpLogToConsole ( ) const
inherited

Dump the current contents of the COutputLogger instance in the terminal window.

See also
writeToFile

Definition at line 179 of file COutputLogger.cpp.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 169 of file CObject.h.

References mrpt::rtti::CObject::clone().

Referenced by mrpt::obs::CRawlog::addActions(), and mrpt::obs::CRawlog::addObservations().

◆ dyngridcommon_readFromStream()

void mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream ( ARCHIVE &  in)
inlineprotectedinherited

Serialization of all parameters, except the contents of each voxel (responsability of the derived class)

Definition at line 338 of file CDynamicGrid3D.h.

◆ dyngridcommon_writeToStream()

void mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_writeToStream ( ARCHIVE &  out) const
inlineprotectedinherited

Serialization of all parameters, except the contents of each voxel (responsability of the derived class)

Definition at line 327 of file CDynamicGrid3D.h.

◆ fill()

void mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::fill ( const TRandomFieldVoxel &  value)
inlineinherited

Fills all the cells with the same value.

Definition at line 220 of file CDynamicGrid3D.h.

◆ generateStringFromFormat()

std::string COutputLogger::generateStringFromFormat ( const char *  fmt,
va_list  argp 
) const
privateinherited

Helper method for generating a std::string instance from printf-like arguments.

Definition at line 99 of file COutputLogger.cpp.

References mrpt::system::os::vsnprintf().

◆ getAsVtkStructuredGrid()

void CRandomFieldGridMap3D::getAsVtkStructuredGrid ( vtkStructuredGrid *  output,
const std::string label_mean = std::string("mean"),
const std::string label_stddev = std::string("stddev") 
) const

◆ getClassName()

static constexpr auto mrpt::maps::CRandomFieldGridMap3D::getClassName ( )
inlinestaticconstexpr

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ getLogAsString() [1/2]

std::string COutputLogger::getLogAsString ( ) const
inherited

Get the history of COutputLogger instance in a string representation.

Definition at line 148 of file COutputLogger.cpp.

Referenced by mrpt::graphslam::deciders::CICPCriteriaNRD< GRAPH_T >::getDescriptiveReport().

◆ getLogAsString() [2/2]

void COutputLogger::getLogAsString ( std::string log_contents) const
inherited

Fill the provided string with the contents of the logger's history in std::string representation.

Definition at line 143 of file COutputLogger.cpp.

◆ getLoggerLastMsg() [1/2]

std::string COutputLogger::getLoggerLastMsg ( ) const
inherited

Return the last Tmsg instance registered in the logger history.

Definition at line 184 of file COutputLogger.cpp.

References mrpt::system::COutputLogger::TMsg::getAsString().

◆ getLoggerLastMsg() [2/2]

void COutputLogger::getLoggerLastMsg ( std::string msg_str) const
inherited

Fill inputtted string with the contents of the last message in history.

Definition at line 190 of file COutputLogger.cpp.

◆ getLoggerName()

std::string COutputLogger::getLoggerName ( ) const
inherited

Return the name of the COutputLogger instance.

See also
setLoggerName

Definition at line 132 of file COutputLogger.cpp.

Referenced by mrpt::system::COutputLogger::TMsg::TMsg().

◆ getMinLoggingLevel()

VerbosityLevel mrpt::system::COutputLogger::getMinLoggingLevel ( ) const
inlineinherited

◆ getResolutionXY()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionXY
inlineinherited

Definition at line 294 of file CDynamicGrid3D.h.

◆ getResolutionZ()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getResolutionZ
inlineinherited

Definition at line 295 of file CDynamicGrid3D.h.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::maps::CRandomFieldGridMap3D::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::maps::CRandomFieldGridMap3D::GetRuntimeClassIdStatic ( )
static

◆ getSizeX()

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeX
inlineinherited

Definition at line 284 of file CDynamicGrid3D.h.

◆ getSizeY()

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeY
inlineinherited

Definition at line 285 of file CDynamicGrid3D.h.

◆ getSizeZ()

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getSizeZ
inlineinherited

Definition at line 286 of file CDynamicGrid3D.h.

◆ getVoxelCount()

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getVoxelCount
inlineinherited

Definition at line 287 of file CDynamicGrid3D.h.

◆ getXMax()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getXMax
inlineinherited

Definition at line 289 of file CDynamicGrid3D.h.

◆ getXMin()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getXMin
inlineinherited

Definition at line 288 of file CDynamicGrid3D.h.

◆ getYMax()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getYMax
inlineinherited

Definition at line 291 of file CDynamicGrid3D.h.

◆ getYMin()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getYMin
inlineinherited

Definition at line 290 of file CDynamicGrid3D.h.

◆ getZMax()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getZMax
inlineinherited

Definition at line 293 of file CDynamicGrid3D.h.

◆ getZMin()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::getZMin
inlineinherited

Definition at line 292 of file CDynamicGrid3D.h.

◆ idx2x()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2x ( int  cx) const
inlineinherited

Transform a voxel index into a coordinate value of the voxel central point.

Definition at line 312 of file CDynamicGrid3D.h.

◆ idx2y()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2y ( int  cy) const
inlineinherited

Definition at line 313 of file CDynamicGrid3D.h.

◆ idx2z()

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2z ( int  cz) const
inlineinherited

Definition at line 314 of file CDynamicGrid3D.h.

◆ insertIndividualReading()

bool CRandomFieldGridMap3D::insertIndividualReading ( const double  sensorReading,
const double  sensorVariance,
const mrpt::math::TPoint3D point,
const TVoxelInterpolationMethod  method,
const bool  update_map 
)

Direct update of the map with a reading in a given position of the map.

Returns
false if point is out of the grid extension.
Parameters
[in]sensorReading[in] The value observed in the (x,y,z) position
[in]sensorVariance[in] The variance of the sensor observation
[in]point[in] The (x,y,z) location
[in]method[in] Voxel interpolation method: how many voxels will be affected by the reading
[in]update_map[in] Run a global map update after inserting this observation (algorithm-dependant)

Definition at line 340 of file CRandomFieldGridMap3D.cpp.

References mrpt::graphs::ScalarFactorGraph::addConstraint(), ASSERT_ABOVE_, ASSERTMSG_, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::cellAbsIndexFromCXCYCZ(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::INVALID_VOXEL_IDX, mrpt::maps::CRandomFieldGridMap3D::TObservationGMRF::Lambda, m_gmrf, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map, m_mrf_factors_activeObs, MRPT_END, MRPT_START, mrpt::graphs::ScalarFactorGraph::UnaryFactorVirtualBase::node_id, mrpt::maps::CRandomFieldGridMap3D::TObservationGMRF::obsValue, updateMapEstimation(), mrpt::math::TPoint3D::x, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::x2idx(), mrpt::math::TPoint3D::y, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::y2idx(), mrpt::math::TPoint3D::z, and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::z2idx().

Referenced by TEST().

◆ internal_initialize()

void CRandomFieldGridMap3D::internal_initialize ( bool  erase_prev_contents = true)
protected

◆ isLoggingLevelVisible()

bool mrpt::system::COutputLogger::isLoggingLevelVisible ( VerbosityLevel  level) const
inlineinherited

◆ logCond()

void COutputLogger::logCond ( const VerbosityLevel  level,
bool  cond,
const std::string msg_str 
) const
inherited

Log the given message only if the condition is satisfied.

See also
log, logFmt

Definition at line 120 of file COutputLogger.cpp.

◆ logDeregisterCallback()

bool COutputLogger::logDeregisterCallback ( output_logger_callback_t  userFunc)
inherited
Returns
true if an entry was found and deleted.

Definition at line 287 of file COutputLogger.cpp.

References getAddress().

◆ logFmt()

void COutputLogger::logFmt ( const VerbosityLevel  level,
const char *  fmt,
  ... 
) const
inherited

◆ loggerReset()

void COutputLogger::loggerReset ( )
inherited

Reset the contents of the logger instance.

Called upon construction.

Definition at line 195 of file COutputLogger.cpp.

References mrpt::system::LVL_INFO.

◆ logRegisterCallback()

void COutputLogger::logRegisterCallback ( output_logger_callback_t  userFunc)
inherited

Definition at line 274 of file COutputLogger.cpp.

◆ logStr()

void COutputLogger::logStr ( const VerbosityLevel  level,
const std::string msg_str 
) const
inherited

◆ m_map_castaway_const()

std::vector<TRandomFieldVoxel >& mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map_castaway_const
inlineprotectedinherited

Used only from logically const method that really need to modify the object.

Definition at line 320 of file CDynamicGrid3D.h.

◆ operator delete() [1/3]

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void memory,
void ptr 
)
inlinenoexcept

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator delete() [2/3]

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void ptr)
inlinenoexcept

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator delete() [3/3]

void mrpt::maps::CRandomFieldGridMap3D::operator delete ( void ptr,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator delete[]()

void mrpt::maps::CRandomFieldGridMap3D::operator delete[] ( void ptr)
inlinenoexcept

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator new() [1/3]

void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size)
inline

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator new() [2/3]

void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator new() [3/3]

static void* mrpt::maps::CRandomFieldGridMap3D::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ operator new[]()

void* mrpt::maps::CRandomFieldGridMap3D::operator new[] ( size_t  size)
inline

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ resize() [1/2]

virtual void mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize ( double  new_x_min,
double  new_x_max,
double  new_y_min,
double  new_y_max,
double  new_z_min,
double  new_z_max,
const TRandomFieldVoxel &  defaultValueNewCells,
double  additionalMarginMeters = 2.0 
)
inlinevirtualinherited

Changes the size of the grid, maintaining previous contents.

See also
setSize

Definition at line 45 of file CDynamicGrid3D.h.

◆ resize() [2/2]

void CRandomFieldGridMap3D::resize ( double  new_x_min,
double  new_x_max,
double  new_y_min,
double  new_y_max,
double  new_z_min,
double  new_z_max,
const TRandomFieldVoxel defaultValueNewvoxels,
double  additionalMarginMeters = 2.0 
)
overridevirtual

Changes the size of the grid, maintaining previous contents.

See also
setSize

Definition at line 67 of file CRandomFieldGridMap3D.cpp.

References MRPT_END, MRPT_START, and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::resize().

Referenced by TEST().

◆ saveAsCSV()

bool mrpt::maps::CRandomFieldGridMap3D::saveAsCSV ( const std::string filName_mean,
const std::string filName_stddev = std::string() 
) const

Save the current estimated mean values to a CSV file (compatible with Paraview) with fields x y z mean_value.

Optionally, std deviations can be also saved to another file with fields x y z stddev_value, if filName_stddev is provided.

Returns
false on error writing to file
See also
saveAsVtkStructuredGrid

Definition at line 254 of file CRandomFieldGridMap3D.cpp.

References mrpt::format(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2x(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2y(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::idx2z(), mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x, and mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_y.

Referenced by TEST().

◆ saveAsVtkStructuredGrid()

bool CRandomFieldGridMap3D::saveAsVtkStructuredGrid ( const std::string fil) const

Save the current estimated grid to a VTK file (.vts) as a "structured grid".

See also
saveAsCSV

Definition at line 223 of file CRandomFieldGridMap3D.cpp.

References getAsVtkStructuredGrid(), MRPT_END, MRPT_START, and THROW_EXCEPTION.

Referenced by TEST().

◆ serializeFrom()

void CRandomFieldGridMap3D::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 408 of file CRandomFieldGridMap3D.cpp.

References ASSERT_EQUAL_, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::dyngridcommon_readFromStream(), mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_lambdaPrior, mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_skip_variance, insertionOptions, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map, and MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

◆ serializeGetVersion()

uint8_t CRandomFieldGridMap3D::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 381 of file CRandomFieldGridMap3D.cpp.

◆ serializeTo()

void CRandomFieldGridMap3D::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

◆ setLoggerName()

void COutputLogger::setLoggerName ( const std::string name)
inherited

◆ setMinLoggingLevel()

void COutputLogger::setMinLoggingLevel ( const VerbosityLevel  level)
inherited

Set the minimum logging level for which the incoming logs are going to be taken into account.

String messages with specified VerbosityLevel smaller than the min, will not be outputted to the screen and neither will a record of them be stored in by the COutputLogger instance

Definition at line 133 of file COutputLogger.cpp.

Referenced by mrpt::maps::CRandomFieldGridMap2D::enableVerbose(), mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), mrpt::hwdrivers::CHokuyoURG::initialize(), and mrpt::graphslam::deciders::CICPCriteriaNRD< GRAPH_T >::loadParams().

◆ setSize() [1/2]

void CRandomFieldGridMap3D::setSize ( const double  x_min,
const double  x_max,
const double  y_min,
const double  y_max,
const double  z_min,
const double  z_max,
const double  resolution_xy,
const double  resolution_z = -1.0,
const TRandomFieldVoxel fill_value = nullptr 
)
overridevirtual

Changes the size of the grid, erasing previous contents.If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy

Changes the size of the grid, erasing previous contents.

See also
resize.

Definition at line 51 of file CRandomFieldGridMap3D.cpp.

References MRPT_END, MRPT_START, and setSize().

Referenced by TEST().

◆ setSize() [2/2]

virtual void mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::setSize ( const double  x_min,
const double  x_max,
const double  y_min,
const double  y_max,
const double  z_min,
const double  z_max,
const double  resolution_xy,
const double  resolution_z_ = -1.0,
const TRandomFieldVoxel *  fill_value = nullptr 
)
inlinevirtualinherited

Changes the size of the grid, ERASING all previous contents.

If fill_value is left as nullptr, the contents of cells may be undefined (some will remain with their old values, the new ones will have the default voxel value, but the location of old values may change wrt their old places). If fill_value is not nullptr, it is assured that all cells will have a copy of that value after resizing. If resolution_z<0, the same resolution will be used for all dimensions x,y,z as given in resolution_xy

See also
resize, fill

Definition at line 172 of file CDynamicGrid3D.h.

◆ setVerbosityLevel()

void COutputLogger::setVerbosityLevel ( const VerbosityLevel  level)
inherited

◆ setVoxelsConnectivity()

void mrpt::maps::CRandomFieldGridMap3D::setVoxelsConnectivity ( const ConnectivityDescriptor::Ptr new_connectivity_descriptor)

Sets a custom object to define the connectivity between voxels.

Must call clear() or setSize() afterwards for the changes to take place.

Definition at line 334 of file CRandomFieldGridMap3D.cpp.

References m_gmrf_connectivity.

◆ updateMapEstimation()

void CRandomFieldGridMap3D::updateMapEstimation ( )

Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations, using parameters in insertionOptions.

Definition at line 310 of file CRandomFieldGridMap3D.cpp.

References ASSERT_, ASSERTMSG_, mrpt::maps::CRandomFieldGridMap3D::TInsertionOptions::GMRF_skip_variance, insertionOptions, m_gmrf, mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map, m_mrf_factors_activeObs, and mrpt::graphs::ScalarFactorGraph::updateEstimation().

Referenced by insertIndividualReading(), and TEST().

◆ writeLogToFile()

void COutputLogger::writeLogToFile ( const std::string fname_in = NULL) const
inherited

Write the contents of the COutputLogger instance to an external file.

Upon call to this method, COutputLogger dumps the contents of all the logged commands so far to the specified external file. By default the filename is set to ${LOGGERNAME}.log except if the fname parameter is provided

See also
dumpToConsole, getAsString

Definition at line 154 of file COutputLogger.cpp.

References ASSERTMSG_, and mrpt::format().

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 70 of file CSerializable.h.

◆ x2idx()

int mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::x2idx ( double  x) const
inlineinherited

Transform a coordinate values into voxel indexes.

Definition at line 297 of file CDynamicGrid3D.h.

◆ y2idx()

int mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::y2idx ( double  y) const
inlineinherited

Definition at line 301 of file CDynamicGrid3D.h.

◆ z2idx()

int mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::z2idx ( double  z) const
inlineinherited

Definition at line 305 of file CDynamicGrid3D.h.

Member Data Documentation

◆ _init_CRandomFieldGridMap3D

mrpt::rtti::CLASSINIT mrpt::maps::CRandomFieldGridMap3D::_init_CRandomFieldGridMap3D
staticprotected

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ className

constexpr const char* mrpt::maps::CRandomFieldGridMap3D::className = "CRandomFieldGridMap3D"
staticconstexpr

Definition at line 85 of file CRandomFieldGridMap3D.h.

◆ ENABLE_GMRF_PROFILER

bool mrpt::maps::CRandomFieldGridMap3D::ENABLE_GMRF_PROFILER
static

[default:false] Enables a profiler to show a performance report at application end.

Definition at line 89 of file CRandomFieldGridMap3D.h.

◆ insertionOptions

TInsertionOptions mrpt::maps::CRandomFieldGridMap3D::insertionOptions

◆ INVALID_VOXEL_IDX

const size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::INVALID_VOXEL_IDX
staticinherited

Definition at line 227 of file CDynamicGrid3D.h.

◆ logging_enable_console_output

bool mrpt::system::COutputLogger::logging_enable_console_output
inherited

[Default=true] Set it to false in case you don't want the logged messages to be dumped to the output automatically.

Definition at line 239 of file system/COutputLogger.h.

◆ logging_enable_keep_record

bool mrpt::system::COutputLogger::logging_enable_keep_record
inherited

[Default=false] Enables storing all messages into an internal list.

See also
writeLogToFile, getLogAsString

Definition at line 242 of file system/COutputLogger.h.

◆ logging_levels_to_colors

mrpt::system::TConsoleColor COutputLogger::logging_levels_to_colors
staticinherited
Initial value:

Map from VerbosityLevels to their corresponding mrpt::system::TConsoleColor.

Implementation file for the COutputLogger header class.

Handy for coloring the input based on the verbosity of the message

Definition at line 124 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::TMsg::dumpToConsole().

◆ logging_levels_to_names

std::string COutputLogger::logging_levels_to_names
staticinherited
Initial value:
=
{
"DEBUG",
"INFO ",
"WARN ",
"ERROR"
}

Map from VerbosityLevels to their corresponding names.

Handy for printing the current message VerbosityLevel along with the actual content

Definition at line 129 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::TMsg::getAsString().

◆ m_gmrf

mrpt::graphs::ScalarFactorGraph mrpt::maps::CRandomFieldGridMap3D::m_gmrf
protected

Definition at line 244 of file CRandomFieldGridMap3D.h.

Referenced by insertIndividualReading(), and updateMapEstimation().

◆ m_gmrf_connectivity

ConnectivityDescriptor::Ptr mrpt::maps::CRandomFieldGridMap3D::m_gmrf_connectivity
protected

Empty: default.

Definition at line 242 of file CRandomFieldGridMap3D.h.

Referenced by setVoxelsConnectivity().

◆ m_history

std::deque<TMsg> mrpt::system::COutputLogger::m_history
mutableprivateinherited

Definition at line 312 of file system/COutputLogger.h.

◆ m_listCallbacks

std::deque<output_logger_callback_t> mrpt::system::COutputLogger::m_listCallbacks
privateinherited

Definition at line 314 of file system/COutputLogger.h.

◆ m_logger_name

std::string mrpt::system::COutputLogger::m_logger_name
privateinherited

Definition at line 310 of file system/COutputLogger.h.

◆ m_map

std::vector<TRandomFieldVoxel > mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_map
mutableprotectedinherited

The cells.

Definition at line 317 of file CDynamicGrid3D.h.

◆ m_min_verbosity_level

VerbosityLevel mrpt::system::COutputLogger::m_min_verbosity_level
protectedinherited

Provided messages with VerbosityLevel smaller than this value shall be ignored.

Definition at line 252 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::getMinLoggingLevel(), and mrpt::system::COutputLogger::isLoggingLevelVisible().

◆ m_mrf_factors_activeObs

std::vector<std::deque<TObservationGMRF> > mrpt::maps::CRandomFieldGridMap3D::m_mrf_factors_activeObs
protected

Vector with the active observations and their respective Information, for each map cell.

Definition at line 288 of file CRandomFieldGridMap3D.h.

Referenced by insertIndividualReading(), and updateMapEstimation().

◆ m_mrf_factors_priors

std::deque<TPriorFactorGMRF> mrpt::maps::CRandomFieldGridMap3D::m_mrf_factors_priors
protected

Vector with the precomputed priors for each GMRF model.

Definition at line 290 of file CRandomFieldGridMap3D.h.

◆ m_resolution_xy

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_resolution_xy
protectedinherited

Definition at line 322 of file CDynamicGrid3D.h.

◆ m_resolution_z

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_resolution_z
protectedinherited

Definition at line 322 of file CDynamicGrid3D.h.

◆ m_size_x

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x
protectedinherited

Definition at line 323 of file CDynamicGrid3D.h.

◆ m_size_x_times_y

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_x_times_y
protectedinherited

Definition at line 323 of file CDynamicGrid3D.h.

◆ m_size_y

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_y
protectedinherited

Definition at line 323 of file CDynamicGrid3D.h.

◆ m_size_z

size_t mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_size_z
protectedinherited

Definition at line 323 of file CDynamicGrid3D.h.

◆ m_x_max

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_x_max
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ m_x_min

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_x_min
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ m_y_max

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_y_max
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ m_y_min

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_y_min
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ m_z_max

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_z_max
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ m_z_min

double mrpt::containers::CDynamicGrid3D< TRandomFieldVoxel >::m_z_min
protectedinherited

Definition at line 321 of file CDynamicGrid3D.h.

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::maps::CRandomFieldGridMap3D::runtimeClassId
staticprotected

Definition at line 85 of file CRandomFieldGridMap3D.h.

mrpt::system::COutputLogger::logStr
void logStr(const VerbosityLevel level, const std::string &msg_str) const
Main method to add the specified message string to the logger.
Definition: COutputLogger.cpp:61
mrpt::system::CONCOL_GREEN
@ CONCOL_GREEN
Definition: os.h:179
mrpt::system::CONCOL_BLUE
@ CONCOL_BLUE
Definition: os.h:178
mrpt::system::CONCOL_RED
@ CONCOL_RED
Definition: os.h:180
mrpt::system::COutputLogger::logFmt
void logFmt(const VerbosityLevel level, const char *fmt,...) const MRPT_printf_format_check(3
Alternative logging method, which mimics the printf behavior.
Definition: COutputLogger.cpp:80
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::system::CONCOL_NORMAL
@ CONCOL_NORMAL
Definition: os.h:177



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST