class mrpt::slam::CMetricMapBuilderICP
Overview
A class for very simple 2D SLAM based on ICP.
This is a non-probabilistic pose tracking algorithm. Map are stored as in files as binary dumps of “mrpt::maps::CSimpleMap” objects. The methods are thread-safe.
#include <mrpt/slam/CMetricMapBuilderICP.h> class CMetricMapBuilderICP: public mrpt::slam::CMetricMapBuilder { public: // structs struct TConfigParams; struct TDist; // fields TConfigParams ICP_options; CICP::TConfigParams ICP_params; // construction CMetricMapBuilderICP(); // methods virtual void initialize(const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF* x0 = nullptr); virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const; void setCurrentMapFile(const char* mapFile); virtual void processActionObservation(mrpt::obs::CActionCollection& action, mrpt::obs::CSensoryFrame& in_SF); void processObservation(const mrpt::obs::CObservation::Ptr& obs); virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const; void getCurrentMapPoints(std::vector<float>& x, std::vector<float>& y); virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const; virtual unsigned int getCurrentlyBuiltMapSize(); virtual void saveCurrentEstimationToImage(const std::string& file, bool formatEMF_BMP = true); };
Inherited Members
public: // structs struct TMsg; struct TOptions; // methods virtual void initialize(const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF* x0 = nullptr) = 0; virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const = 0; virtual void processActionObservation(mrpt::obs::CActionCollection& action, mrpt::obs::CSensoryFrame& observations) = 0; virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const = 0; virtual unsigned int getCurrentlyBuiltMapSize() = 0; virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const = 0; virtual void saveCurrentEstimationToImage(const std::string& file, bool formatEMF_BMP = true) = 0; void clear(); void enableMapUpdating(bool enable); void loadCurrentMapFromFile(const std::string& fileName); void saveCurrentMapToFile(const std::string& fileName, bool compressGZ = true) const;
Fields
TConfigParams ICP_options
Options for the ICP-SLAM application.
See also:
CICP::TConfigParams ICP_params
Options for the ICP algorithm itself.
See also:
Construction
CMetricMapBuilderICP()
Default constructor - Upon construction, you can set the parameters in ICP_options, then call “initialize”.
Methods
virtual void initialize(const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF* x0 = nullptr)
Initialize the method, starting with a known location PDF “x0”(if supplied, set to nullptr to left unmodified) and a given fixed, past map.
This method MUST be called if using the default constructor, after loading the configuration into ICP_options. In particular, TConfigParams::mapInitializers
virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const
Returns a copy of the current best pose estimation as a pose PDF.
void setCurrentMapFile(const char* mapFile)
Sets the “current map file”, thus that map will be loaded if it exists or a new one will be created if it does not, and the updated map will be save to that file when destroying the object.
virtual void processActionObservation(mrpt::obs::CActionCollection& action, mrpt::obs::CSensoryFrame& in_SF)
Appends a new action and observations to update this map: See the description of the class at the top of this page to see a more complete description.
Parameters:
action |
The estimation of the incremental pose change in the robot pose. |
in_SF |
The set of observations that robot senses at the new pose. See params in CMetricMapBuilder::options and CMetricMapBuilderICP::ICP_options |
See also:
void processObservation(const mrpt::obs::CObservation::Ptr& obs)
The main method of this class: Process one odometry or sensor observation.
The new entry point of the algorithm (the old one was processActionObservation, which now is a wrapper to this method). See params in CMetricMapBuilder::options and CMetricMapBuilderICP::ICP_options
virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const
Fills “out_map” with the set of “poses”-“sensory-frames”, thus the so far built map.
void getCurrentMapPoints(std::vector<float>& x, std::vector<float>& y)
Returns the 2D points of current local map.
virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const
Returns the map built so far.
NOTE that for efficiency a pointer to the internal object is passed, DO NOT delete nor modify the object in any way, if desired, make a copy of ir with “clone()”.
virtual unsigned int getCurrentlyBuiltMapSize()
Returns just how many sensory-frames are stored in the currently build map.
virtual void saveCurrentEstimationToImage( const std::string& file, bool formatEMF_BMP = true )
A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
Parameters:
file |
The output file name |
formatEMF_BMP |
Output format = true:EMF, false:BMP |