- Static Map Layer:静态地图层,基本上不变的地图层,通常都是SLAM建立完成的静态地图。
- Obstacle Map Layer:障碍地图层,用于动态的记录传感器感知到的障碍物信息。
- Inflation Layer:膨胀层,在以上两层地图上进行膨胀(向外扩张),以避免机器人的撞上障碍物。
- Other Layers:你还可以通过插件的形式自己实现costmap,目前已有Social Costmap Layer、Range Sensor Layer等开源插件。
costmap_common_params
# 如果机器人是圆的可以直接设置robot_radius参数
robot_radius: 0.2
# 如果机器人不是圆的设置footpoint参数
footprint: [[-0.5, 0.33], [0.5, 0.33], [0.5, -0.33], [-0.5, -0.33]]
# 机器人轮廓边缘
footprint_padding: 0.00
# tf坐标转换时最大容忍的时间
transform_tolerance: 2.0
# 地图类型
map_type: costmap
always_send_full_costmap: true #true
# 障碍地图层 需要开启
obstacle_layer:
enabled: True
# 只能设置为0或1,用来更新地图上的代价值,一般设置为1。
combination_method: 1
# false->地图上只分为致命碰撞区域和自由区域。
# true->地图上分为致命碰撞,自由区域和未知区域。
track_unknown_space: true
# 机器人检测障碍物的最大范围
# 超过该范围的障碍物,并不进行检测,只有靠近到该范围内才把该障碍物当作影响路径规划和移动的障碍物;
obstacle_range: 2.5
# 实时清除代价地图上的障碍物的最大范围,更新可自由移动的空间数据。
# 假如设置该值为3米,那么就意味着在3米内的障碍物,本来开始时是有的,但是本次检测却没有了,那么就需要在代价地图上来更新,将旧障碍物的空间标记为可以自由移动的空间。
raytrace_range: 3.5
# 膨胀半径
inflation_radius: 0.035
# 观察来源
# 设置导航中所使用的传感器,这里可以用逗号形式来区分开很多个传感器,例如激光雷达,碰撞传感器,超声波传感器等。
observation_sources: laser_scan_sensor
# making->是否这个观察用来标记障碍物
# clearing->是否这个观察用来清除空闲空间
laser_scan_sensor: {data_type: LaserScan, topic: volcano/Sick_LMS_291/laser_scan/layer0, marking: true, clearing: true}
# 静态地图层
static_layer:
enabled: true
map_topic: "map"
footpoint:
inflation_radius:
global_costmap_params
# 全局代价地图
global_costmap:
global_frame: map
robot_base_frame: base_link
# 全局代价地图更新频率,一般全局代价地图更新频率设置的比较小
update_frequency: 3.0
# 发布速率
publish_frequency: 2.0
# 配置是否使用map_server提供的地图来初始化,一般全局地图都是静态的,需要设置为true
static_map: true
# 坐标系之间的转换可以忍受的最大延时
transform_tolerance: 1.0
#在global_costmap中使用下面三个插件来融合三个不同图层,分别是static_layer、obstacle_layer和inflation_layer,合成一个master_layer来进行全局路径规划。
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
inflation_layer:
enabled: true
cost_scaling_factor: 10.0 # exponential rate at which the obstacle cost drops off (default: 10)
# 膨胀半径
inflation_radius: 0.50 # max. distance from an obstacle at which costs are incurred for planning paths.
local_costmap_params
local_costmap:
global_frame: map
robot_base_frame: base_link
update_frequency: 3.0
publish_frequency: 2.0
# 局部代价地图需要在机器人移动时检测周围是否有新增的障碍物
static_map: false
# 机器人移动时保证机器人在滚动窗口中心
rolling_window: true
width: 5.0 #滚动窗口宽度
height: 5.0 #滚动窗口高度
# 地图的分辨率,该分辨率可以从加载的地图相对应的配置文件中获取到
resolution: 0.02
transform_tolerance: 2.0
# 在局部代价地图中,不需要静态地图层,因为我们使用滚动窗口来不断的扫描障碍物,所以就需要融合两层地图(inflation_layer和obstacle_layer)即可,融合后的地图用于进行局部路径规划
plugins:
#- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
inflation_layer:
enabled: true
cost_scaling_factor: 10.0 # exponential rate at which the obstacle cost drops off (default: 10)
inflation_radius: 0.035 # max. distance from an obstacle at which costs are incurred for planning paths.
Reference:https://www.cnblogs.com/flyinggod/p/12742889.html