39 void CHMTSLAM::generateLogFiles(
unsigned int nIteration)
53 std::lock_guard<std::mutex> lock(m_LMHs_cs);
59 string filLocalAreas =
format(
60 "%s/LSLAM_3D/mostLikelyLMH_LSLAM_%05u.3Dscene",
61 m_options.LOG_OUTPUT_DIR.c_str(), nIteration);
63 mrpt::make_aligned_shared<COpenGLScene>();
68 for (it = m_LMHs.begin(); it != m_LMHs.end(); it++)
72 bestLMH = &it->second;
74 else if (it->second.m_log_w > bestLMH->
m_log_w)
76 bestLMH = &it->second;
81 bestHypoID = bestLMH->
m_ID;
84 std::lock_guard<std::mutex> lockerLMH(
90 mrpt::make_aligned_shared<opengl::CSetOfObjects>();
91 maps3D->setName(
"metric-maps");
93 ->
d->metricMaps.getAs3DObject(maps3D);
94 sceneLSLAM->insert(maps3D);
98 mrpt::make_aligned_shared<opengl::CSetOfObjects>();
99 LSLAM_3D->setName(
"LSLAM_3D");
101 sceneLSLAM->insert(LSLAM_3D);
103 sceneLSLAM->enableFollowCamera(
true);
113 string filSSO =
format(
"%s/ASSO/mostLikelyLMH_ASSO_%05u.3Dscene", m_options.LOG_OUTPUT_DIR.c_str(), nIteration );
117 sceneSSO.insert(sso3D);
124 if (A.getColCount()>0)
127 A.saveToTextFile(
format(
"%s/ASSO/mostLikelyLMH_ASSO_%05u.txt", m_options.LOG_OUTPUT_DIR.c_str(), nIteration ) );
128 CImage(A,
true).
saveToFile(
format(
"%s/ASSO/mostLikelyLMH_ASSO_%05u.png", m_options.LOG_OUTPUT_DIR.c_str(), nIteration ) );
143 if ((CNT++ % 20) == 0)
147 "%s/HMTSLAM_state/state_%05u.hmtslam",
148 m_options.LOG_OUTPUT_DIR.c_str(), nIteration));
159 if ((CNT++ % 5) == 0)
161 std::lock_guard<std::mutex> lockerLMH(bestLMH->
threadLocks.m_lock);
170 std::lock_guard<std::mutex> lock(m_map_cs);
172 "[LOG] HMT-map: " << m_map.nodeCount() <<
" nodes/ " 173 << m_map.arcCount() <<
" arcs");
177 m_map.getFirstNode()->getID(),
185 "%s/HMAP_3D/mostLikelyHMT_MAP_%05u.3Dscene",
186 m_options.LOG_OUTPUT_DIR.c_str(), nIteration));
197 format(
"%s/log_MemoryUsage.txt", m_options.LOG_OUTPUT_DIR.c_str())
202 os::fprintf(f,
"%u\t%f\n", nIteration, memUsage / (1024.0 * 1024.0));
206 double t_log = tictac.Tac();
void getAdjacencyMatrix(MATRIX &outMatrix) const
Return a copy of the internal adjacency matrix.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
THypothesisID m_ID
The unique ID of the hypothesis (Used for accessing mrpt::slam::CHierarchicalMHMap).
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
int void fclose(FILE *f)
An OS-independent version of fclose.
A class for storing images as grayscale or RGB bitmaps.
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
void getAs3DScene(mrpt::opengl::CSetOfObjects::Ptr &objs) const
Returns a 3D representation of the the current robot pose, all the poses in the auxiliary graph...
const CParticleData * getMostLikelyParticle() const
Returns the particle with the highest weight.
double m_log_w
Log-weight of this hypothesis.
const Scalar * const_iterator
std::string formatTimeInterval(const double timeSeconds)
Returns a formated string with the given time difference (passed as the number of seconds)...
void Tic()
Starts the stopwatch.
Helper types for STL containers with Eigen memory allocators.
mrpt::slam::CIncrementalMapPartitioner partitioner
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
std::map< uint32_t, TPoseID > idx2pose
For the poses in "partitioner".
This class implements a high-performance stopwatch.
std::shared_ptr< CSetOfObjects > Ptr
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void getAs3DScene(mrpt::opengl::CSetOfObjects::Ptr &objs, const std::map< uint32_t, int64_t > *renameIndexes=NULL) const
Return a 3D representation of the current state: poses & links between them.
This class is used in HMT-SLAM to represent each of the Local Metric Hypotheses (LMHs).
std::mutex lock
CS to access the entire struct.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
struct mrpt::hmtslam::CLocalMetricHypothesis::TRobotPosesPartitioning m_robotPosesGraph
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
#define MRPT_LOG_INFO_STREAM(__CONTENTS)
#define CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level...
unsigned long getMemoryUsage()
Returns the memory occupied by this process, in bytes.
std::shared_ptr< COpenGLScene > Ptr
The namespace for 3D scene representation and rendering.
mrpt::utils::copy_ptr< T > d
The data associated with this particle.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
bool saveToFile(const std::string &fileName, int jpeg_quality=95) const
Save the image to a file, whose format is determined from the extension (internally uses OpenCV)...
void updateAreaFromLMH(const CHMHMapNode::TNodeID areaID, bool eraseSFsFromLMH=false)
The corresponding node in the HMT map is updated with the robot poses & SFs in the LMH: the poses are ref...
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
CLSLAMParticleDataParticles m_poseParticles
TNodeIDSet m_neighbors
The list of all areas sourronding the current one (this includes the current area itself)...