32 void CHMTSLAM::thread_TBI()
38 if (
obj->m_options.random_seed)
52 while ( !
obj->m_terminateThreads )
59 time_t timCreat,timExit;
double timCPU=0;
61 obj->logFmt(mrpt::utils::LVL_DEBUG,
"[thread_TBI] Thread finished. CPU time used:%.06f secs \n",timCPU);
62 obj->m_terminationFlag_TBI =
true;
65 catch(std::exception &e)
67 obj->m_terminationFlag_TBI =
true;
71 obj->logFmt(mrpt::utils::LVL_ERROR,
"%s", e.what() );
74 obj->m_terminateThreads =
true;
80 obj->m_terminationFlag_TBI =
true;
82 obj->logFmt(mrpt::utils::LVL_ERROR,
83 "\n---------------------- EXCEPTION CAUGHT! ---------------------\n" 84 " In CHierarchicalMappingFramework::thread_TBI. Unexpected runtime error!!\n");
89 obj->m_terminateThreads =
true;
120 msg->hypothesisID = LMH_ID;
121 msg->cur_area = areaID;
124 const CHMHMapNodePtr currentArea =
obj->m_map.getNodeByID( areaID );
127 obj->logFmt(mrpt::utils::LVL_DEBUG,
"[TBI] Request for area id=%i\n",(
int)areaID);
143 if (
a->first==areaID)
continue;
146 if (
a->second->m_hypotheses.has(LMH_ID))
149 if (
a->second->isNeighbor( areaID, LMH_ID) )
161 double match =
obj->m_map.computeOverlapProbabilityBetweenNodes(
166 obj->logFmt(mrpt::utils::LVL_DEBUG,
"[TBI] %i-%i -> overlap prob=%f\n",(
int)areaID,(
int)
a->first,match);
184 std::set<CHMHMapNode::TNodeID> lstNodesToErase;
198 const CHMHMapNodePtr refArea =
obj->m_map.getNodeByID( candidate->first );
202 CPose3DPDFPtr pdf = (*it)->computeTopologicalObservationModel(
209 candidate->second.log_lik += this_log_lik;
215 CPose3DPDFSOGPtr SOG = CPose3DPDFSOGPtr( pdf );
219 candidate->second.delta_new_cur.appendFrom( *SOG );
221 lstNodesToErase.insert(candidate->first);
230 msg->loopClosureData.erase(*it);
232 obj->logFmt(mrpt::utils::LVL_DEBUG,
"[TBI_main] Done. %u candidates found.\n",(
unsigned int)msg->loopClosureData.size() );
A namespace of pseudo-random numbers genrators of diferent distributions.
This class provides simple critical sections functionality.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
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).
unsigned long BASE_IMPEXP getCurrentThreadId() MRPT_NO_THROWS
Returns the ID of the current thread.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
void randomize(const uint32_t seed)
Initialize the PRNG from the given random seed.
Declares a class that represents a Probability Density function (PDF) of a 3D(6D) pose ...
const Scalar * const_iterator
mrpt::poses::CPose3DPDFSOG delta_new_cur
Depending on the loop-closure engine, an guess of the relative pose of "area_new" relative to "cur_ar...
GLsizei GLsizei GLuint * obj
An implementation of Hybrid Metric Topological SLAM (HMT-SLAM).
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
void BASE_IMPEXP getCurrentThreadTimes(time_t &creationTime, time_t &exitTime, double &cpuTime)
Returns the creation and exit times of the current thread and its CPU time consumed.
TNodeList::iterator iterator
void BASE_IMPEXP sleep(int time_ms) MRPT_NO_THROWS
An OS-independent method for sending the current thread to "sleep" for a given period of time...
This class implements a high-performance stopwatch.
mrpt::utils::safe_ptr< CHMTSLAM > m_parent
For quick access to our parent object.
This class is used in HMT-SLAM to represent each of the Local Metric Hypotheses (LMHs).
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double log_lik
Log likelihood for this loop-closure.
void clear()
Clear all the gaussian modes.
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
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...
GLubyte GLubyte GLubyte a
TNodeIDSet m_neighbors
The list of all areas sourronding the current one (this includes the current area itself)...
mrpt::utils::TNodeID TNodeID
The type of the IDs of nodes.
stlplus::smart_ptr< TMessageLSLAMfromTBI > TMessageLSLAMfromTBIPtr