一、引言
在导航的时候,我们通常需要计算机器人是否与障碍物发生碰撞。然而传统的碰撞检测过于耗费时间,一种合理的做法就是,将动态障碍物使用点、线、多边形表示,然后再来计算机器人模型(机器人用自身的footprint来表示)与障碍物的距离。
costmap-converter的功能,就是提供几种插件,实现将原本的costmap2D障碍物类型转换为基元类型。
二、功能包的插件
关于ros中的插件功能与实现,可以查看这篇博文:link
costmap-converter总共实现如下五种插件:
总共会生成五种插件,所有的class都是继承于BaseCostmapToPolygons:
-
CostmapToPolygonsDBSMCCH
将costmap转换为多边形,使用
DBScan
算法实现聚类,使用Monotone Chain Convex Hull
检测凸多边形。 -
CostmapToLinesDBSMCCH
将costmap转换为line,使用
DBScan
算法实现聚类,使用Monotone Chain Convex Hull
检测。 -
CostmapToLinesDBSRANSAC
使用RANSAC算法生成line -
CostmapToPolygonsDBSConcaveHull
转换为非凸多边形 -
CostmapToDynamicObstacles
检测与追踪动态障碍物
具体对应插件描述的XML文件如下所示:
<library path="lib/libcostmap_converter">
<class type="costmap_converter::CostmapToPolygonsDBSMCCH" base_class_type="costmap_converter::BaseCostmapToPolygons">
<description>
This class converts costmap2d obstacles into a vector of convex polygons.
Clustering is performed with DBScan. Convex polygons are detected using the Monotone Chain Convex Hull algorithm.
</description>
</class>
<class type="costmap_converter::CostmapToLinesDBSMCCH" base_class_type="costmap_converter::BaseCostmapToPolygons">
<description>
This class converts costmap2d obstacles into a vector of lines (represented as polygon msg).
Clustering is performed with DBScan. Clusters are transformed into convex polygons using the Monotone Chain Convex Hull algorithm.
The resulting keypoints are used for possible line candidates.
A line is only defined if there exist a specified number of support points between each keypoint pair.
</description>
</class>
<class type="costmap_converter::CostmapToLinesDBSRANSAC" base_class_type="costmap_converter::BaseCostmapToPolygons">
<description>
This class converts costmap2d obstacles into a vector of lines (represented as polygon msg).
Clustering is performed with DBScan. For each cluster RANSAC is applied sequentally to fit multiple line models.
</description>
</class>
<class type="costmap_converter::CostmapToPolygonsDBSConcaveHull" base_class_type="costmap_converter::BaseCostmapToPolygons">
<description>
This class converts costmap2d obstacles into a vector of non-convex (concave) polygons.
</description>
</class>
<class type="costmap_converter::CostmapToDynamicObstacles" base_class_type="costmap_converter::BaseCostmapToPolygons">
<description>
This class detects and tracks obstacles from a sequence of costmaps.
</description>
</class>
</library>