代价地图的转换
简介:本部分关于怎样把代价地图转换插件应用到转换占据栅格costmap2d到几何形状来优化(测试阶段)
teb_local_planner包支持costmap_converter插件,这些插件将占据栅格costmap_2d转换为几何形状的障碍物。
默认情况下,占据栅格为点装的障碍物。如果地图分辨率很高,则就需要大量的计算,这可能会在计算拓扑结构中系统不稳定性(取决于障碍物的数量)。另一方面,障碍的转换也需要花费时间。然而,转换时间非常依赖于选择的算法,可以在分开的线程执行。就目前而言,代价地图的转换是实验阶段,就有效性和导航质量的最好配置而言在将来决定。
通过设置参数costmap_converter_plugin插件来激活,可以通过下面代码查看可用的插件:
rospack plugins --attrib=plugin costmap_converter
也可以指定参数costmap_converter_spin_thread以及costmap_converter_rate。
必须在启动代码之前加载插件。障碍物的可视化使用teb_markers。
1.例子参数文件
以下文件costmap_converter_params.yaml描述了怎样设置参数根据机器人导航配置里面;

TebLocalPlannerROS: ## Costmap converter plugin costmap_converter_plugin: "costmap_converter::CostmapToPolygonsDBSMCCH" #costmap_converter_plugin: "costmap_converter::CostmapToLinesDBSRANSAC" #costmap_converter_plugin: "costmap_converter::CostmapToLinesDBSMCCH" #costmap_converter_plugin: "costmap_converter::CostmapToPolygonsDBSConcaveHull" #costmap_converter_plugin: "" # deactivate plugin costmap_converter_spin_thread: True costmap_converter_rate: 5 ## Configure plugins (namespace move_base/TebLocalPlannerROS/PLUGINNAME) ## The parameters must be added for each plugin separately costmap_converter/CostmapToLinesDBSRANSAC: cluster_max_distance: 0.4 cluster_min_pts: 2 ransac_inlier_distance: 0.15 ransac_min_inliers: 10 ransac_no_iterations: 2000 ransac_remainig_outliers: 3 ransac_convert_outlier_pts: True ransac_filter_remaining_outlier_pts: False convex_hull_min_pt_separation: 0.1
现在可以把参数加载到move base空间。将上面文件加载到导航launch文件里面
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen"> <!-- Load all costmap_2d and planner parameters here --> <param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" /> <!-- LOAD COSTMAP_CONVERTER PARAMETERS HERE --> <rosparam file="$(find my_robot_name_2dnav)/costmap_converter_params.yaml" command="load" /> </node>
2.完整例子

You can find an example setup with the stage simulator in the teb_local_planner_tutorials package. Install the teb_local_planner_tutorials package Inspect the parameter/config files Launch the diff_drive setup: roslaunch teb_local_planner_tutorials robot_diff_drive_in_stage_costmap_conversion.launch Modify parameters using rosrun rqt_reconfigure rqt_reconfigure or by adapting the files. Switch different costmap conversion algorithms in costmap_converter_params.yaml