diff --git a/include/laser_scan_utils/loop_closure_base.h b/include/laser_scan_utils/loop_closure_base.h index f509f869f81602860a33740618b35f622266f883..92fe92be01145cc5bf659cca3b5a047a6a207764 100644 --- a/include/laser_scan_utils/loop_closure_base.h +++ b/include/laser_scan_utils/loop_closure_base.h @@ -40,50 +40,52 @@ #include "match_loop_closure_scene.h" #include "scene_base.h" -namespace laserscanutils { - -/** \brief A 2base class for loop closure using falko library - */ -class LoopClosureBase2d +namespace laserscanutils { - private: - public: - /** \brief Constructor - **/ - LoopClosureBase2d(){}; + class LoopClosureBase2d; + typedef std::shared_ptr<LoopClosureBase2d> LoopClosureBase2dPtr; + + /** \brief A 2base class for loop closure using falko library + */ + class LoopClosureBase2d + { + public: + /** \brief Constructor + **/ + LoopClosureBase2d(){}; - /** \brief Destructor - **/ - virtual ~LoopClosureBase2d(){}; + /** \brief Destructor + **/ + virtual ~LoopClosureBase2d(){}; - /** \brief update the scene struct with keypoints and descriptors - **/ - virtual sceneBasePtr extractScene(const LaserScan &scan, const LaserScanParams &scanParams) = 0; + /** \brief update the scene struct with keypoints and descriptors + **/ + virtual sceneBasePtr extractScene(const LaserScan &scan, const LaserScanParams &scanParams) = 0; - /** \brief Create and update a matchLoopClosure struct with the info that is - *produced when matching two given scenes - **/ - virtual MatchLoopClosureScenePtr matchScene(sceneBasePtr _scene1, sceneBasePtr _scene2) = 0; + /** \brief Create and update a matchLoopClosure struct with the info that is + *produced when matching two given scenes + **/ + virtual MatchLoopClosureScenePtr matchScene(sceneBasePtr _scene1, sceneBasePtr _scene2) = 0; - /** \brief It matches a target scene against a list of references scenes in order to find loop - * closures - **/ - virtual std::map<double, MatchLoopClosureScenePtr> findLoopClosure(std::list<std::shared_ptr<SceneBase>> _l_scenes, - const sceneBasePtr _new_scene) - { - std::map<double, MatchLoopClosureScenePtr> matchings; - for (auto ref_scene : _l_scenes) + /** \brief It matches a target scene against a list of references scenes in order to find loop + * closures + **/ + virtual std::map<double, MatchLoopClosureScenePtr> findLoopClosure(std::list<std::shared_ptr<SceneBase>> _l_scenes, + const sceneBasePtr _new_scene) + { + std::map<double, MatchLoopClosureScenePtr> matchings; + for (auto ref_scene : _l_scenes) { auto match = matchScene(ref_scene, _new_scene); - - while (matchings.find(match->score)!=matchings.end()) - match->score+=0.001; + + while (matchings.find(match->score) != matchings.end()) + match->score += 0.001; matchings.emplace(match->score, match); } - return matchings; - } -}; + return matchings; + } + }; } /* namespace laserscanutils */ #endif /* LOOP_CLOSURE_BASE_2D_H_ */