Visualize the GNSS messages in Mapviz, ROS

Liu,Xiao
3 min readMay 19, 2020

--

Mapviz is a package similar to RVIZ focused on visualization 2D data. In my last article, I visualize the GNSS messages in RVIZ. Now I will talk about how to achieve it with Mapviz.

1.Download the data

DATA: https:// advdataset2019.wixsite.com /urbanloco

Thanks to MSC lab published this dataset. This is a public dataset for non-commercial but academic use. And in this article, I will use the first data named BayBride.

The info of the data.

And the Topic which publishes GNSS message is /navsat/fix. The format is sensor_msgs/NavSatFix.

2.Install Mapviz

ROS wiki:http://wiki.ros.org/mapviz

Github:https://github.com/swri-robotics/mapviz

By the way, the maintainer of Mapviz is very nice. I have asked a question on github. And he replied to me in ten minutes.

You can install by apt:

sudo apt-get install ros-$ROS_DISTRO-mapviz ros-$ROS_DISTRO-mapviz-plugins ros-$ROS_DISTRO-tile-map ros-$ROS_DISTRO-multires-image

Or you can build from source. I recommend you build from source. Because this package was updated to 1.3.0 a few days ago. And the mapviz in ROS apt repository is not the latest version.

3.Set the launch file

This is a very important step.

<launch><node pkg="mapviz" type="mapviz" name="mapviz" required="true"/><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="auto"/><rosparam param="local_xy_origins">[{ name: swri,latitude: 29.45196669,longitude: -98.61370577,altitude: 233.719,heading: 0.0},{ name: back_40,latitude: 29.447507,longitude: -98.629367,altitude: 200.0,heading: 0.0}]</rosparam><remap from="fix" to="/navsat/fix"/></node>  <node pkg="tf" type="static_transform_publisher" name="swri_transform" args="0 0 0 0 0 0 /map /origin 100"  /></launch>

a. The initialize_origin.py node takes in a GPS coordinate and uses that to connect the WGS84 coordinate system to ROS TF tree; setting <param name=”local_xy_origin” value=”auto”/> will make it use the first GPS message it gets instead of using one of the pre-defined origins.

b. adding <remap from=”fix” to=”/navsat/fix”/> will make it listen to the topic from my bag file.

4. visual the data in Mapviz

You should launch Mapviz with

roslaunch mapviz mapviz.launch

If you use

rosrun mapviz mapviz

It may cause some bugs in Mapviz.

If you want to reset the Mapviz, try this

sudo rm ~/.mapviz.config.

You should set Mapviz like this.

Notice that: The sequence of plugins in your panel is vital. Because Mapviz draws its plugins in the order that they are listed in the plugin panel. If navsat is listed first, it will draw that first, and then it will draw the tile_map over that, so you would not be able to see any fixes.

It seems more accurate than rviz_satellite in RVIZ.

Well done. I will try to set my vehicle in the center of the window next week.

--

--

Liu,Xiao

B.Eng in Automation; B.S in Data Science; Harbin Institute of Technology