class mrpt::slam::CMetricMapBuilder
Python API: mrpt.slam.CMetricMapBuilder
Overview
This virtual class is the base for SLAM implementations.
See derived classes for more information.
See also:
CMetricMap
#include <mrpt/slam/CMetricMapBuilder.h> class CMetricMapBuilder: public mrpt::system::COutputLogger { public: // structs struct TOptions; // fields TOptions options; // construction CMetricMapBuilder(); // 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 size_t getCurrentlyBuiltMapSize() = 0; virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const = 0; virtual void saveCurrentEstimationToImage(const std::string& file) = 0; void clear(); void enableMapUpdating(bool enable); void loadCurrentMapFromFile(const std::string& fileName); void saveCurrentMapToFile(const std::string& fileName, bool compressGZ = true) const; }; // direct descendants class CMetricMapBuilderICP; class CMetricMapBuilderRBPF;
Inherited Members
public: // structs struct TMsg; // fields bool logging_enable_console_output {true}; bool logging_enable_keep_record {false}; // methods void logStr(const VerbosityLevel level, std::string_view msg_str) const; void logFmt(const VerbosityLevel level, const char* fmt, ...) const; void void logCond(const VerbosityLevel level, bool cond, const std::string& msg_str) const; void setLoggerName(const std::string& name); std::string getLoggerName() const; void setVerbosityLevel(const VerbosityLevel level); void setVerbosityLevelForCallbacks(const VerbosityLevel level); void setMinLoggingLevel(const VerbosityLevel level); VerbosityLevel getMinLoggingLevel() const; VerbosityLevel getMinLoggingLevelForCallbacks() const; bool isLoggingLevelVisible(VerbosityLevel level) const; void getLogAsString(std::string& log_contents) const; std::string getLogAsString() const; void writeLogToFile(const std::optional<std::string>& fname_in = std::nullopt) const; void dumpLogToConsole() const; std::string getLoggerLastMsg() const; void getLoggerLastMsg(std::string& msg_str) const; void loggerReset(); void logRegisterCallback(output_logger_callback_t userFunc); bool logDeregisterCallback(output_logger_callback_t userFunc); COutputLogger& operator = (const COutputLogger&); COutputLogger& operator = (COutputLogger&&); static std::array<mrpt::system::ConsoleForegroundColor, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_colors(); static const std::array<const char*, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_names();
Construction
CMetricMapBuilder()
Constructor.
Methods
virtual void initialize(const mrpt::maps::CSimpleMap& initialMap = mrpt::maps::CSimpleMap(), const mrpt::poses::CPosePDF* x0 = nullptr) = 0
Initialize the method, starting with a known location PDF “x0”(if supplied, set to nullptr to left unmodified) and a given fixed, past map.
virtual mrpt::poses::CPose3DPDF::Ptr getCurrentPoseEstimation() const = 0
Returns a copy of the current best pose estimation as a pose PDF.
virtual void processActionObservation(mrpt::obs::CActionCollection& action, mrpt::obs::CSensoryFrame& observations) = 0
Process a new action and observations pair 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. |
observations |
The set of observations that robot senses at the new pose. |
virtual void getCurrentlyBuiltMap(mrpt::maps::CSimpleMap& out_map) const = 0
Fills “out_map” with the set of “poses”-“sensory-frames”, thus the so far built map.
virtual size_t getCurrentlyBuiltMapSize() = 0
Returns just how many sensory-frames are stored in the currently build map.
virtual const mrpt::maps::CMultiMetricMap& getCurrentlyBuiltMetricMap() const = 0
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 void saveCurrentEstimationToImage(const std::string& file) = 0
A useful method for debugging: the current map (and/or poses) estimation is dumped to an image file.
Parameters:
file |
The output file name |
void clear()
Clear all elements of the maps, and reset localization to (0,0,0deg).
void enableMapUpdating(bool enable)
Enables or disables the map updating (default state is enabled)
void loadCurrentMapFromFile(const std::string& fileName)
Load map (mrpt::maps::CSimpleMap) from a “.simplemap” file.
void saveCurrentMapToFile(const std::string& fileName, bool compressGZ = true) const
Save map (mrpt::maps::CSimpleMap) to a “.simplemap” file.