帶語義模型地圖靜態的導航
前言
- 背景模型是語義地圖,但是ROS-NAV需要一張柵格地圖,所以想辦法轉換一下
- 此外還需要做一張符合P3AT自帶地圖格式的ArMap地圖
- 重新設置ROS-Nav的全局代價地圖配置
參考
ros-mapserver
ArMap Map file format
Resize the static map
setup map yaml file
Aria Docs: Maps
ArMap file formats
學習內容
ROS-MapServer
地圖格式
- 多種文件共同決定地圖數據,YAML文件描述地圖的元數據meta-data,圖形文件與YAML文件同名,圖形文件描述柵格數據
圖像格式
- 一般用灰度圖像來制作地圖,純黑色為致命障礙物,純白色為自由控件,中間灰度值為不確定,但是可以由一個閾值來決定是否將其識別為障礙物,閾值處理由MapServer內部處理
- 判斷灰度像素是否有較高風險使用了如下概率計算公式:occ = (255 - color_avg) / 255.0, where color_avg is the 8-bit value that results from averaging over all channels
- 圖像是通過SDL_Image庫讀入的,該庫支持的文件就是支持的地圖圖像數據,包括bmp, git, jpg, png, tif等
yaml格式
- yaml是一些技術參數
image: testmap.png
# 使用相對或絕對路徑
resolution: 0.1
# 分辨率 0.1m/pixel
origin: [0.0, 0.0, 0.0]
# 圖像的左下角(邊界)在地圖中的坐標
occupied_thresh: 0.65
# 判斷像素格是否為障礙的閾值
free_thresh: 0.196
# 判斷是否為自由空間的閾值
negate: 0
# 一般情況下,黑色為障礙物,白色為自由空間
width: 20 # m Don't forget to create a file with 2000 pixel width
height: 20 # m Don't forget to create a file with 2000 pixel height
global_costmap.yaml
global_costmap:
global_frame: /map
robot_base_frame: /base_link
update_frequency: 3.0
publish_frequency: 0.0 # For a static global map, there is generally no need to continually publish it
static_map: true # This parameter and the next are always set to opposite values. The global map is usually static so we set static_map to true
rolling_window: false # The global map is generally not updated as the robot moves to we set this parameter to false
resolution: 0.01
transform_tolerance: 1.0
map_type: costmap
width: 20 # m Don't forget to create a file with 2000 pixel width
height: 20 # m Don't forget to create a file with 2000 pixel width
命令行
rosrun map_server map_server mymap.yaml
<!-- Run the map server -->
<node name="map_server" pkg="map_server" type="map_server" args="/tmp/my_map_waalre.yaml" />
ArMap
格式
- 因為臨時想到不用將語義模型轉化為ArMap了,所以此處省略
使用Mapper3修改地圖
- 添加forbidden line, forbidden area, home point, home area
ROS-Map 生成
新圖
- CAD顯示,整個環境為 148876mmX117600mm,即148.876mX117.6m
- 則width=148.876; height=117.600
- 建議修正為整數:
- 設置resolution=0.05m/pixel
- 2977.52: 2352
- 圖片像素為2978:2352
- 修正尺寸為:width: 148.9; height: 117.6
新圖分辨率增大
- 設置resolution = 0.1m/pixel
- 1488.76: 1176
- 像素為:1489:1176
老圖sim
- 1417.4cmX1187.9cm; 141.74mX118.79m
- width=141.74; height=118.79
- 修為整數:
- 設置resolution=0.05m/pixel
- 2834.8: 2375.8
- 圖片像素為2835:2376
- 修正尺寸為:width: 141.75 height: 118.8
老圖yaml
image: 4F-sim.png
resolution: 0.050000
origin: [0, 0, 0]
negate: 0
occupied_thresh: 0.65 # 無關緊要
free_thresh: 0.196 # # 無關緊要
width: 141.75
height: 118.8
PS修圖
- LV繪制的語義地圖像素較低,用PS將其放大到指定分辨率
- 工具欄-圖像-圖像大小-指定像素-重定圖像像素:兩次立方較平滑(適用於擴大)
注意:Windows自帶畫圖程序,也可以修改圖片分辨率,但是並沒有將已有像素圖形放大,而是簡單擴展了圖片邊界,使得圖形外圍全部是白色像素
重新配置ROS
global costmap
tf和消息設計
- 為了方便控制map->odom的關系,即進行機器人全局定位,決定不使用fake amcl或者amcl
- 如果要使用amcl或者fake amcl,則需要對ROSARIA進行修改,為其添加move_to接口。
- 使用amcl對於語義繪制的地圖沒有意義,因為其幾何要素過於簡單,使用配准算法還是有問題的,SLAM算法生成的地圖比較起來就好得多,包含的細節都是激光傳感器生成的。
- 最后決定修改ARIA中的publisher,把原來的zs_worldframe改成/map。
- 后來想了想,如果改成/map的話,proxy也有很多有關坐標系的東西也需要改變,應該這么做,把mapserver發送的主題名稱改了,直接改成zsworld_frame.解決OK!
- 先看看fake_amcl在RViz中定位方不方便,暫時把zs_worldframe與odom之間的tf給禁用了,如果定位不方便然后再進行大改代碼。
