local costmap是一个依赖于其他坐标系存在的坐标系统,它并不维护自己的坐标系,而是在另一个坐标系中设定坐标原点,然后记下自己的宽与高。它使用数据结构nav_msgs/OccupancyGrid来记录:
std_msgs/Header header uint32 seq time stamp string frame_id nav_msgs/MapMetaData info time map_load_time float32 resolution uint32 width uint32 height geometry_msgs/Pose origin geometry_msgs/Point position float64 x float64 y float64 z geometry_msgs/Quaternion orientation float64 x float64 y float64 z float64 w int8[] data
值得注意的是,对于local costmap,这个数据结构中的position坐标指的是costmap的右下角的点在配置的frame中的坐标。
配置的示例如下:
local_costmap: #We'll publish the voxel grid used by this costmap publish_voxel_map: true #Set the global and robot frames for the costmap global_frame: odom robot_base_frame: base_link #Set the update and publish frequency of the costmap update_frequency: 5.0 publish_frequency: 2.0 #We'll configure this costmap to be a rolling window... meaning it is always #centered at the robot static_map: false rolling_window: true 6.0 height: 6.0 resolution: 0.025 origin_x: 0.0 origin_y: 0.0
其中,global_frame即是依赖的坐标系的配置,默认是“odom”,但推荐改为“map”,因为可以方便的用于各种自定义的运算。