From 667cc81367992f5a091967c64ccc1258efd9590d Mon Sep 17 00:00:00 2001 From: andreucm <andreu@beta-robots.com> Date: Wed, 6 Apr 2016 11:32:41 +0200 Subject: [PATCH] Working copy on stabilizing API for line/corner finders --- src/corner_finder.cpp | 11 +++++++++++ src/corner_finder.h | 27 +++++++++++++++++++++++---- src/line_finder_iterative.cpp | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/corner_finder.cpp b/src/corner_finder.cpp index 73ac303..a8c7479 100644 --- a/src/corner_finder.cpp +++ b/src/corner_finder.cpp @@ -13,5 +13,16 @@ CornerFinder::~CornerFinder() } +int CornerFinder::findCorners( const Eigen::MatrixXs & _points, std::list<laserscanutils::CornerPoint> & _corner_list) const +{ + //to be implemented by inherited class + return -1; +} + +int CornerFinder::findCorners( const std::list<laserscanutils::LineSegment> & _lines, std::list<laserscanutils::CornerPoint> & _corner_list) const +{ + //TODO +} + }//namespace diff --git a/src/corner_finder.h b/src/corner_finder.h index a1e7436..c5b4272 100644 --- a/src/corner_finder.h +++ b/src/corner_finder.h @@ -5,6 +5,7 @@ #include "laser_scan_utils.h" //#include "laser_scan.h" #include "corner_point.h" +#include "line_segment.h" //std #include <list> @@ -35,9 +36,9 @@ class CornerFinder **/ ~CornerFinder(); - /** \brief Find corners. Pure virtual. To be implemented by each inherited class + /** \brief Find corners from points. To be implemented by each inherited class. * - * Find corners from a set of scans. + * Find corners from a set of points. * Returns corners as a std::list<CornerPoint> * * \Requires: @@ -47,12 +48,30 @@ class CornerFinder * \param _corner_list set of corners extracted from _points * \return Number of corners extracted, or -1 if some error * + * \note Not pure virtual to allow instantation of this class + * */ virtual int findCorners( const Eigen::MatrixXs & _points, - std::list<laserscanutils::CornerPoint> & _corner_list) const = 0; + std::list<laserscanutils::CornerPoint> & _corner_list) const; // virtual int findCorners(const laserscanutils::LaserScan & _scan, // std::list<laserscanutils::CornerPoint> & _corner_list) = 0; - + + /** \brief Find corners from lines. + * + * Find corners from a set of lines. + * Returns corners as a std::list<CornerPoint> + * + * \Requires: + * \param _lines: List of input lines + * + * \Provides: + * \param _corner_list set of corners extracted from _lines + * \return Number of corners extracted, or -1 if some error + * + */ + virtual int findCorners( const std::list<laserscanutils::LineSegment> & _lines, + std::list<laserscanutils::CornerPoint> & _corner_list) const; + /** \brief Print things * * Print things about this class diff --git a/src/line_finder_iterative.cpp b/src/line_finder_iterative.cpp index bf01292..2e80160 100644 --- a/src/line_finder_iterative.cpp +++ b/src/line_finder_iterative.cpp @@ -57,7 +57,7 @@ unsigned int LineFinderIterative::findLines( const Eigen::MatrixXs & _points, st //split _points into two subsets and call findLines again for each one, if enough points in the subset if ( max_ii >= ilf_params_.min_supports_ ) { - this->findLines(_points.block(0,0,3,max_ii), _line_list); + this->findLines(_points.block(0,0,3,max_ii+1), _line_list); } if ( _points.cols()-max_ii >= ilf_params_.min_supports_ ) { -- GitLab