文章目录
前言
在mapviz中加载地图瓦片,可以用于目视多传感器融合定位结果的好坏。
安装
mkdir -p ~/mapviz_ws/src
cd ~/mapviz_ws/src
git clone https://github.com/swri-robotics/mapviz.git
cd ..
rosdep install --from-paths src --ignore-src
catkin_make
echo "source ~/mapviz_ws/devel/setup.bash" >> ~/.bashrc
获取第一帧的经纬度
修改配置并运行节点
<launch>
<node pkg="mapviz" type="mapviz" name="mapviz"></node>
<node pkg="swri_transform_util" type="initialize_origin.py" name="initialize_origin" >
<param name="local_xy_frame" value="/map"/>
<param name="local_xy_origin" value="swri"/>
<rosparam param="local_xy_origins">
[{ name: swri,
latitude: 31.xxx,
longitude: 121.xxxx,
altitude: 3.61199951171875,
heading: 0.0},
{ name: back_40,
latitude: 31.xxx,
longitude: 121.xxxx,
altitude: 3.61199951171875,
heading: 0.0}]
</rosparam>
<remap from="fix" to="/gps/fix" />
</node>
<node pkg="tf" type="static_transform_publisher" name="swri_transform" args="0 0 0 0 0 0 /map /origin 100" />
</launch>
运行节点
roslaunch mapviz mapviz.launch
添加展示
依次添加tile_map和navsat
申请天地图地图影像瓦片接口
直接给出url
http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={level}&TILEROW={y}&TILECOL={x}&tk=1cfe06711bc22d31762c8884d41d68f0
最终效果
本地地图服务
Q&&A
Q: Failed to load file: /home/greenfield/.mapviz_config
A: sudo apt-get update && sudo apt-get upgrade
参考https://github.com/swri-robotics/mapviz/issues/592