CLoopCloserERD_MR_impl.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |                     Mobile Robot Programming Toolkit (MRPT)               |
00003    |                          http://www.mrpt.org/                             |
00004    |                                                                           |
00005    | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file        |
00006    | See: http://www.mrpt.org/Authors - All rights reserved.                   |
00007    | Released under BSD License. See details in http://www.mrpt.org/License    |
00008    +---------------------------------------------------------------------------+ */
00009 
00010 #ifndef CLOOPCLOSERERD_MR_IMPL_H
00011 #define CLOOPCLOSERERD_MR_IMPL_H
00012 
00013 namespace mrpt { namespace graphslam { namespace deciders {
00014 
00015 // Ctors, Dtors
00016 template<class GRAPH_T>
00017 CLoopCloserERD_MR<GRAPH_T>::CLoopCloserERD_MR() {
00018         // CLoopCloser Ctor is automatically called.
00019 
00020         // since this is for MR-SLAM, we do expect more than one node registered
00021         // between successive calls
00022         this->m_override_registered_nodes_check = true;
00023 
00024         this->initializeLoggers("CLoopCloserERD_MR");
00025 }
00026 
00027 template<class GRAPH_T>
00028 void CLoopCloserERD_MR<GRAPH_T>::addBatchOfNodeIDsAndScans(
00029                 const std::map<
00030                         mrpt::utils::TNodeID,
00031                         mrpt::obs::CObservation2DRangeScanPtr>& nodeIDs_to_scans2D) {
00032         mr_parent_t::addBatchOfNodeIDsAndScans(nodeIDs_to_scans2D);
00033 
00034         this->updateMapPartitions(/*full update=*/ true,
00035                         /* is_first_time_node_reg = */ false);
00036 
00037 } // end of addBatchOfNodeIDsAndScans
00038 
00039 template<class GRAPH_T>
00040 void CLoopCloserERD_MR<GRAPH_T>::addScanMatchingEdges(
00041                 mrpt::utils::TNodeID curr_nodeID) {
00042         MRPT_START;
00043 
00044         // Do scan-matching only if I have initially registered curr_nodeID in the
00045         // graph.
00046         bool is_own = this->m_engine->isOwnNodeID(curr_nodeID);
00047         if (is_own) {
00048                 lc_parent_t::addScanMatchingEdges(curr_nodeID);
00049         }
00050 
00051         MRPT_END;
00052 }
00053 
00054 template<class GRAPH_T>
00055 void CLoopCloserERD_MR<GRAPH_T>::fetchNodeIDsForScanMatching(
00056                 const mrpt::utils::TNodeID& curr_nodeID,
00057                 std::set<mrpt::utils::TNodeID>* nodes_set) {
00058         ASSERT_(nodes_set);
00059 
00060         size_t fetched_nodeIDs = 0;
00061         for (int nodeID_i = static_cast<int>(curr_nodeID)-1;
00062                         ((fetched_nodeIDs <= this->m_prev_nodes_for_ICP) &&
00063                          (nodeID_i >= 0));
00064                         --nodeID_i) {
00065                 bool is_own = this->m_engine->isOwnNodeID(nodeID_i);
00066                 if (is_own) {
00067                         nodes_set->insert(nodeID_i);
00068                         fetched_nodeIDs++;
00069                 }
00070         }
00071 }
00072 
00073 
00074 template<class GRAPH_T>
00075 CLoopCloserERD_MR<GRAPH_T>::~CLoopCloserERD_MR() {
00076         // CLoopCloser Dtor is automatically called.
00077 }
00078 
00079 // Member methods implementations
00080 template<class GRAPH_T>
00081 bool CLoopCloserERD_MR<GRAPH_T>::updateState(
00082                 mrpt::obs::CActionCollectionPtr action,
00083                 mrpt::obs::CSensoryFramePtr observations,
00084                 mrpt::obs::CObservationPtr observation ) {
00085 
00086         bool success = lc_parent_t::updateState(action, observations, observation);
00087 
00088         // search for possible edges with the other agent's graph.
00089         // TODO
00090 
00091         return success;
00092 }
00093 
00094 
00095 } } } // end of namespaces
00096 
00097 #endif /* end of include guard: CLOOPCLOSERERD_MR_IMPL_H */


mrpt_graphslam_2d
Author(s): Nikos Koukis
autogenerated on Sun Sep 17 2017 03:02:04