class mrpt::maps::CGasConcentrationGridMap2D
Overview
CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.
There are a number of methods available to build the gas grid-map, depending on the value of “TMapRepresentation maptype” passed in the constructor (see base class mrpt::maps::CRandomFieldGridMap2D).
Update the map with insertIndividualReading() or insertObservation()
See also:
mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CMetricMap, mrpt::containers::CDynamicGrid, The application icp-slam, mrpt::maps::CMultiMetricMap
#include <mrpt/maps/CGasConcentrationGridMap2D.h> class CGasConcentrationGridMap2D: public mrpt::maps::CRandomFieldGridMap2D, public mrpt::config::OptionsCapable { public: // typedefs typedef std::shared_ptr<mrpt::maps ::CGasConcentrationGridMap2D> Ptr; typedef std::shared_ptr<const mrpt::maps ::CGasConcentrationGridMap2D> ConstPtr; typedef std::unique_ptr<mrpt::maps ::CGasConcentrationGridMap2D> UniquePtr; typedef std::unique_ptr<const mrpt::maps ::CGasConcentrationGridMap2D> ConstUniquePtr; // enums enum TMapRepresentation; // structs struct TGaussianCell; struct TGaussianWindTable; struct TInsertionOptions; struct TMapDefinition; struct TMapDefinitionBase; // fields static constexpr const char* className = "mrpt::maps" "::" "CGasConcentrationGridMap2D"; static const size_t m_private_map_register_id = mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister("mrpt::maps::CGasConcentrationGridMap2D,gasGrid" ,& mrpt::maps::CGasConcentrationGridMap2D ::MapDefinition,& mrpt::maps::CGasConcentrationGridMap2D ::internal_CreateFromMapDefinition); mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOptions; TGaussianWindTable LUT; // construction CGasConcentrationGridMap2D( TMapRepresentation mapType = mrAchim, float x_min = -2, float x_max = 2, float y_min = -2, float y_max = 2, float resolution = 0.1f ); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; static std::shared_ptr<mrpt::maps::TMetricMapInitializer> MapDefinition(); static std::shared_ptr<CGasConcentrationGridMap2D> CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def); static std::shared_ptr<mrpt::maps::CMetricMap> internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def); virtual std::map<std::string, mrpt::config::CLoadableOptions*> optionsByName(); virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& outObj) const; virtual void getAs3DObject(mrpt::viz::CSetOfObjects& meanObj, mrpt::viz::CSetOfObjects& varObj) const; mrpt::viz::CSetOfObjects::Ptr getWindAs3DObject() const; void getWindAs3DObject(mrpt::viz::CSetOfObjects::Ptr& windObj) const; virtual void increaseUncertainty(const double STD_increase_value); bool simulateAdvection(double STD_increase_value); void clear(); virtual std::string asString() const; virtual bool isEmpty() const; virtual void saveAsBitmapFile(const std::string& filName) const; virtual void getAsBitmapFile(mrpt::img::CImage& out_img) const; virtual void getAsMatrix(mrpt::math::CMatrixDouble& out_mat) const; void resize( double new_x_min, double new_x_max, double new_y_min, double new_y_max, const TRandomFieldCell& defaultValueNewCells, double additionalMarginMeters = 1.0f ); virtual void setSize( const double x_min, const double x_max, const double y_min, const double y_max, const double resolution, const TRandomFieldCell* fill_value = nullptr ); void setCellsConnectivity(const ConnectivityDescriptor::Ptr& new_connectivity_descriptor); virtual float compute3DMatchingRatio(const mrpt::maps::CMetricMap* otherMap, const mrpt::poses::CPose3D& otherMapPose, const TMatchingRatioParams& params) const; virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const; virtual void saveAsMatlab3DGraph(const std::string& filName) const; TMapRepresentation getMapType(); void insertIndividualReading( const double sensorReading, const mrpt::math::TPoint2D& point, const bool update_map = true, const bool time_invariant = true, const double reading_stddev = .0 ); virtual void predictMeasurement( const double x, const double y, double& out_predict_response, double& out_predict_response_variance, bool do_sensor_normalization, const TGridInterpolationMethod interp_method = gimNearest ); void getMeanAndCov(mrpt::math::CVectorDouble& out_means, mrpt::math::CMatrixDouble& out_cov) const; void getMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD) const; void setMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD); void updateMapEstimation(); };
Inherited Members
public: // typedefs typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; typedef std::shared_ptr<CRandomFieldGridMap2D> Ptr; typedef std::shared_ptr<const CRandomFieldGridMap2D> ConstPtr; // structs struct TMsg; struct ConnectivityDescriptor; struct TInsertionOptionsCommon; struct TObservationGMRF; struct TPriorFactorGMRF; // methods virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); Visualizable& operator = (const Visualizable&); Visualizable& operator = (Visualizable&&); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual bool isEmpty() const = 0; virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const = 0; virtual std::string asString() const = 0; virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& o) const = 0; COutputLogger& operator = (const COutputLogger&); COutputLogger& operator = (COutputLogger&&); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& outObj) const; virtual void getAs3DObject(mrpt::viz::CSetOfObjects& meanObj, mrpt::viz::CSetOfObjects& varObj) const; OptionsCapable& operator = (const OptionsCapable&); OptionsCapable& operator = (OptionsCapable&&); virtual std::map<std::string, mrpt::config::CLoadableOptions*> optionsByName() = 0;
Typedefs
typedef std::shared_ptr<mrpt::maps ::CGasConcentrationGridMap2D> Ptr
A type for the associated smart pointer.
Fields
static const size_t m_private_map_register_id = mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister("mrpt::maps::CGasConcentrationGridMap2D,gasGrid" ,& mrpt::maps::CGasConcentrationGridMap2D ::MapDefinition,& mrpt::maps::CGasConcentrationGridMap2D ::internal_CreateFromMapDefinition)
ID used to initialize class registration (just ignore it)
Construction
CGasConcentrationGridMap2D( TMapRepresentation mapType = mrAchim, float x_min = -2, float x_max = 2, float y_min = -2, float y_max = 2, float resolution = 0.1f )
Constructor.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
static std::shared_ptr<mrpt::maps::TMetricMapInitializer> MapDefinition()
Returns default map definition initializer.
See * mrpt::maps::TMetricMapInitializer
static std::shared_ptr<CGasConcentrationGridMap2D> CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def)
Constructor from a map definition structure: initializes the map and * its parameters accordingly.
virtual std::map<std::string, mrpt::config::CLoadableOptions*> optionsByName()
Maps an options-group name (e.g.
“insertionOptions”) to a pointer to the corresponding, live CLoadableOptions member. Pointers remain valid as long as this is alive, and point directly to the actual option members (no copies), so writes through them (e.g. via loadFromConfigFile()) take effect immediately.
Implementations should list every CLoadableOptions member they define, INCLUDING “creationOptions” if present (so it can be discovered/exported generically); however, callers must use trySetCreationOptions(), not a direct write through this pointer, to safely modify creation options.
virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& outObj) const
Returns a 3D object representing the map.
virtual void getAs3DObject(mrpt::viz::CSetOfObjects& meanObj, mrpt::viz::CSetOfObjects& varObj) const
Returns two 3D objects representing the mean and variance maps.
mrpt::viz::CSetOfObjects::Ptr getWindAs3DObject() const
Returns the 3D object representing the wind grid information.
void getWindAs3DObject(mrpt::viz::CSetOfObjects::Ptr& windObj) const
Deprecated Use getWindAs3DObject() returning Ptr instead.
virtual void increaseUncertainty(const double STD_increase_value)
Increase the kf_std of all cells from the m_map This mehod is usually called by the main_map to simulate loss of confidence in measurements when time passes.
bool simulateAdvection(double STD_increase_value)
Implements the transition model of the gasConcentration map using the information of the wind maps
void clear()
Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both base classes.
virtual std::string asString() const
Returns a short description of the map.
virtual bool isEmpty() const
Returns true if the map is empty/no observation has been inserted (in this class it always return false, unless redefined otherwise in base classes)
virtual void saveAsBitmapFile(const std::string& filName) const
Save the current map as a graphical file (BMP,PNG,…).
The file format will be derived from the file extension (see CImage::saveToFile ) It depends on the map representation model: mrAchim: Each pixel is the ratio \(\sum{\frac{wR}{w}}\) mrKalmanFilter: Each pixel is the mean value of the Gaussian that represents each cell.
See also:
virtual void getAsBitmapFile(mrpt::img::CImage& out_img) const
Returns an image just as described in saveAsBitmapFile.
virtual void getAsMatrix(mrpt::math::CMatrixDouble& out_mat) const
Like saveAsBitmapFile(), but returns the data in matrix form (first row in the matrix is the upper (y_max) part of the map)
Like saveAsBitmapFile(), but returns the data in matrix form.
void resize( double new_x_min, double new_x_max, double new_y_min, double new_y_max, const TRandomFieldCell& defaultValueNewCells, double additionalMarginMeters = 1.0f )
Changes the size of the grid, maintaining previous contents.
See also:
virtual void setSize( const double x_min, const double x_max, const double y_min, const double y_max, const double resolution, const TRandomFieldCell* fill_value = nullptr )
Changes the size of the grid, erasing previous contents.
Parameters:
connectivity_descriptor |
Optional user-supplied object that will visit all grid cells to define their connectivity with neighbors and the strength of existing edges. If present, it overrides all options in insertionOptions |
See also:
void setCellsConnectivity(const ConnectivityDescriptor::Ptr& new_connectivity_descriptor)
Sets a custom object to define the connectivity between cells.
Must call clear() or setSize() afterwards for the changes to take place.
virtual float compute3DMatchingRatio( const mrpt::maps::CMetricMap* otherMap, const mrpt::poses::CPose3D& otherMapPose, const TMatchingRatioParams& params ) const
See docs in base class: in this class this always returns 0.
virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const
The implementation in this class just calls all the corresponding method of the contained metric maps.
virtual void saveAsMatlab3DGraph(const std::string& filName) const
Save a matlab “.m” file which represents as 3D surfaces the mean and a given confidence level for the concentration of each cell.
This method can only be called in a KF map model.
TMapRepresentation getMapType()
Return the type of the random-field grid map, according to parameters passed on construction.
void insertIndividualReading( const double sensorReading, const mrpt::math::TPoint2D& point, const bool update_map = true, const bool time_invariant = true, const double reading_stddev = .0 )
Direct update of the map with a reading in a given position of the map, using the appropriate method according to mapType passed in the constructor.
This is a direct way to update the map, an alternative to the generic insertObservation() method which works with mrpt::obs::CObservation objects.
virtual void predictMeasurement( const double x, const double y, double& out_predict_response, double& out_predict_response_variance, bool do_sensor_normalization, const TGridInterpolationMethod interp_method = gimNearest )
Returns the prediction of the measurement at some (x,y) coordinates, and its certainty (in the form of the expected variance).
void getMeanAndCov(mrpt::math::CVectorDouble& out_means, mrpt::math::CMatrixDouble& out_cov) const
Return the mean and covariance vector of the full Kalman filter estimate (works for all KF-based methods).
void getMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD) const
Return the mean and STD vectors of the full Kalman filter estimate (works for all KF-based methods).
void setMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD)
Load the mean and STD vectors of the full Kalman filter estimate (works for all KF-based methods).
void updateMapEstimation()
Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations.