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 width: 6.0 height: 6.0 resolution: 0.025 origin_x: 0.0 origin_y: 0.0
其中,global_frame即是依賴的坐標系的配置,默認是“odom”,但推薦改為“map”,因為可以方便的用於各種自定義的運算。