51 int64_t CHMTSLAM::m_nextAreaLabel = 0;
52 TPoseID CHMTSLAM::m_nextPoseID = 0;
59 : m_inputQueue_cs(
"inputQueue_cs"),
103 MRPT_LOG_DEBUG(
"[CHMTSLAM::destructor] Waiting for threads end...\n");
127 catch(std::exception &e)
226 CSensoryFramePtr sf = CSensoryFrame::Create();
319 stds_Q_no_odo[2] =
RAD2DEG(stds_Q_no_odo[2]);
320 source.read_vector(section,
"stds_Q_no_odo", stds_Q_no_odo, stds_Q_no_odo );
321 ASSERT_(stds_Q_no_odo.size()==3)
323 stds_Q_no_odo[2] =
DEG2RAD(stds_Q_no_odo[2]);
325 std::string sTLC_detectors =
source.read_string(section,
"TLC_detectors",
"",
true );
329 std::cout <<
"TLC_detectors: " << TLC_detectors.size() << std::endl;
332 AA_options.loadFromConfigFile(
source,section);
340 out.
printf(
"\n----------- [CHMTSLAM::TOptions] ------------ \n\n");
355 AA_options.dumpToTextStream(out);
356 pf_options.dumpToTextStream(out);
357 KLD_params.dumpToTextStream(out);
358 defaultMapsInitializers.dumpToTextStream(out);
359 TLC_grid_options.dumpToTextStream(out);
360 TLC_fabmap_options.dumpToTextStream(out);
395 CSerializablePtr
obj;
417 LMH_hyps.insert( newHypothID );
432 firstAreaID = firstArea->getID();
434 firstArea->m_hypotheses = LMH_hyps;
437 firstArea->m_nodeType.setType(
"Area" );
456 newLMH.
m_ID = newHypothID;
584 return it->second(
this);
#define MRPT_LOAD_CONFIG_VAR_CAST_NO_DEFAULT(variableName, variableType, variableTypeCast, configFileObject, sectionNameStr)
#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...
#define MRPT_LOAD_CONFIG_VAR_DEGREES(variableName, configFileObject, sectionNameStr)
Loads a double variable, stored as radians but entered in the INI-file as degrees.
#define LOADABLEOPTS_DUMP_VAR_DEG(variableName)
Macro for dumping a variable to a stream, transforming the argument from radians to degrees.
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
#define MRPT_LOG_WARN(_STRING)
#define MRPT_LOG_DEBUG(_STRING)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
#define NODE_ANNOTATION_METRIC_MAPS
#define NODE_ANNOTATION_REF_POSEID
#define COMMON_TOPOLOG_HYP
static CHMHMapNodePtr Create()
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
utils::CMessageQueue m_LSLAM_queue
LSLAM thread input queue, messages of type CHMTSLAM::TMessageLSLAMfromAA.
void clearInputQueue()
Empty the input queue.
bool loadState(mrpt::utils::CStream &in)
Load the state of the whole HMT-SLAM framework from some binary stream (e.g.
void initializeEmptyMap()
Initializes the whole HMT-SLAM framework, reseting to an empty map (It also clears the logs directory...
mrpt::hmtslam::CHMTSLAM::TOptions m_options
static THypothesisID m_nextHypID
bool m_terminationFlag_LSLAM
Threads termination flags:
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
mrpt::utils::CSerializablePtr getNextObjectFromInputQueue()
Used from the LSLAM thread to retrieve the next object from the queue.
mrpt::system::TThreadHandle m_hThread_TBI
static std::string generateUniqueAreaLabel()
Generates a new and unique area textual label (currently this generates "0","1",.....
void pushAction(const mrpt::obs::CActionCollectionPtr &acts)
Here the user can enter an action into the system (will go to the SLAM process).
std::queue< mrpt::utils::CSerializablePtr > m_inputQueue
The queue of pending actions/observations supplied by the user waiting for being processed.
CHierarchicalMHMap m_map
The hiearchical, multi-hypothesis graph-based map.
static int64_t m_nextAreaLabel
bool m_terminateThreads
Termination flag for signaling all threads to terminate.
aligned_containers< THypothesisID, CLocalMetricHypothesis >::map_t m_LMHs
The list of LMHs at each instant.
void loadOptions(const std::string &configFile)
Loads the options from a config file.
synch::CCriticalSection m_map_cs
Critical section for accessing m_map.
void thread_TBI()
The function for the "TBI" thread.
mrpt::system::TThreadHandle m_hThread_3D_viewer
CTopLCDetectorBase * loopClosureDetector_factory(const std::string &name)
The class factory for topological loop closure detectors.
synch::CCriticalSection m_inputQueue_cs
Critical section for accessing m_inputQueue.
mrpt::system::TThreadHandle m_hThread_LSLAM
Threads handles.
bool saveState(mrpt::utils::CStream &out) const
Save the state of the whole HMT-SLAM framework to some binary stream (e.g.
friend class CLSLAM_RBPF_2DLASER
void thread_3D_viewer()
The function for the "3D viewer" thread.
synch::CCriticalSection m_LMHs_cs
Critical section for accessing m_LMHs.
bool isInputQueueEmpty()
Returns true if the input queue is empty (Note that the queue must not be empty to the user to enqueu...
void thread_LSLAM()
The function for the "Local SLAM" thread.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
std::map< std::string, TLopLCDetectorFactory > m_registeredLCDetectors
virtual ~CHMTSLAM()
Destructor.
void registerLoopClosureDetector(const std::string &name, CTopLCDetectorBase *(*ptrCreateObject)(CHMTSLAM *))
Must be invoked before calling initializeEmptyMap, so LC objects can be created.
bool m_terminationFlag_TBI
CLSLAMAlgorithmBase * m_LSLAM_method
An instance of a local SLAM method, to be applied to each LMH - initialized by "initializeEmptyMap" o...
void pushObservations(const mrpt::obs::CSensoryFramePtr &sf)
Here the user can enter observations into the system (will go to the SLAM process).
bool m_terminationFlag_3D_viewer
size_t inputQueueSize()
Returns the number of objects waiting for processing in the input queue.
bool abortedDueToErrors()
Return true if an exception has been caught in any thread leading to the end of the mapping applicati...
static TPoseID generatePoseID()
Generates a new and unique pose ID.
static THypothesisID generateHypothesisID()
Generates a new and unique hypothesis ID.
static TPoseID m_nextPoseID
synch::CCriticalSection m_topLCdets_cs
The critical section for accessing m_topLCdets.
void getAs3DScene(mrpt::opengl::COpenGLScene &outScene)
Gets a 3D representation of the current state of the whole mapping framework.
void pushObservation(const mrpt::obs::CObservationPtr &obs)
Here the user can enter an observation into the system (will go to the SLAM process).
std::deque< CTopLCDetectorBase * > m_topLCdets
The list of LC modules in operation - initialized by "initializeEmptyMap" or "loadState".
void clear()
Erase all the contents of map (It delete all nodes/arcs objects)
This class is used in HMT-SLAM to represent each of the Local Metric Hypotheses (LMHs).
double m_log_w
Log-weight of this hypothesis.
THypothesisID m_ID
The unique ID of the hypothesis (Used for accessing mrpt::slam::CHierarchicalMHMap).
mrpt::utils::safe_ptr< CHMTSLAM > m_parent
For quick access to our parent object.
void clearRobotPoses()
Rebuild the auxiliary metric maps in "m_robotPosesGraph" from the observations "m_SFs" and their esti...
TNodeIDSet m_neighbors
The list of all areas sourronding the current one (this includes the current area itself).
TPoseID m_currentRobotPose
The current robot pose (its global unique ID) for this hypothesis.
static CTopLCDetectorBase * createNewInstance(CHMTSLAM *hmtslam)
A class factory, to be implemented in derived classes.
static CTopLCDetectorBase * createNewInstance(CHMTSLAM *hmtslam)
A class factory, to be implemented in derived classes.
The virtual base class for Topological Loop-closure Detectors; used in HMT-SLAM.
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ionName) MRPT_OVERRIDE
Loads the configuration for the set of internal maps from a textual definition in an INI-like file.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
This class allows loading and storing values and vectors of different types from a configuration text...
This class allows loading and storing values and vectors of different types from "....
void dumpToConsole() const
Just like dumpToTextStream() but sending the text to the console (std::cout)
The virtual base class which provides a unified interface for all persistent objects in MRPT.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
void clear()
Clear the queue of messages, freeing memory as required.
const Scalar * const_iterator
GLsizei GLsizei GLuint * obj
GLuint const GLchar * name
GLsizei const GLchar ** string
GLsizei GLsizei GLchar * source
bool BASE_IMPEXP deleteFilesInDirectory(const std::string &s, bool deleteDirectoryAsWell=false)
Delete all the files in a given directory (nothing done if directory does not exists,...
bool BASE_IMPEXP createDirectory(const std::string &dirName)
Creates a directory.
bool BASE_IMPEXP fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
TThreadHandle createThreadFromObjectMethod(CLASS *obj, void(CLASS::*func)(PARAM), PARAM param)
Creates a new thread running a non-static method (so it will have access to "this") from another meth...
void BASE_IMPEXP joinThread(TThreadHandle &threadHandle)
Waits until the given thread ends.
void BASE_IMPEXP tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) MRPT_NO_THROWS
Tokenizes a string according to a set of delimiting characters.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
class HMTSLAM_IMPEXP CHMTSLAM
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
uint64_t TPoseID
An integer number uniquely identifying each robot pose stored in HMT-SLAM.
This namespace contains representation of robot actions and observations.
The namespace for 3D scene representation and rendering.
mrpt::maps::CMultiMetricMap CMultiMetricMap
Backward compatible typedef.
mrpt::maps::CMultiMetricMapPtr CMultiMetricMapPtr
Backward compatible typedef.
This namespace provides multitask, synchronization utilities.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
mrpt::math::CVectorFloat stds_Q_no_odo
A 3-length vector with the std.
CTopLCDetector_FabMap::TOptions TLC_fabmap_options
Options passed to this TLC constructor.
mrpt::slam::TKLDParams KLD_params
CTopLCDetector_GridMatching::TOptions TLC_grid_options
Options passed to this TLC constructor.
float VIEW3D_AREA_SPHERES_HEIGHT
[VIEW3D] The height of the areas' spheres.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
int random_seed
0 means randomize, use any other value to have repetitive experiments.
TOptions()
Initialization of default params.
int LOG_FREQUENCY
[LOGGING] One SLAM iteration out of "LOGGING_logFrequency", a log file will be generated.
mrpt::maps::TSetOfMetricMapInitializers defaultMapsInitializers
The default set of maps to be created in each particle.
TLSlamMethod SLAM_METHOD
[LSLAM] The method to use for local SLAM
mrpt::slam::CIncrementalMapPartitioner::TOptions AA_options
[AA] The options for the partitioning algorithm
bayes::CParticleFilter::TParticleFilterOptions pf_options
These params are used from every LMH object.
float VIEW3D_AREA_SPHERES_RADIUS
[VIEW3D] The radius of the areas' spheres.
vector_string TLC_detectors
A list of topological loop-closure detectors to use: can be one or more from this list: 'gridmaps': O...
float SLAM_MIN_DIST_BETWEEN_OBS
[LSLAM] Minimum distance (and heading) difference between observations inserted in the map.
float MIN_ODOMETRY_STD_XY
[LSLAM] Minimum uncertainty (1 sigma, meters) in x and y for odometry increments (Default=0)
float MIN_ODOMETRY_STD_PHI
[LSLAM] Minimum uncertainty (1 sigma, rads) in phi for odometry increments (Default=0)
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
std::string LOG_OUTPUT_DIR
[LOGGING] If it is not an empty string (""), a directory with that name will be created and log files...
float SLAM_MIN_HEADING_BETWEEN_OBS
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.