ROS GPS learning notes

YuxiangG
2 min readJul 21, 2022

--

GPS is much more difficult than I expected…

Over the past month, I explored navsat_nmea_driver and mapviz

For the GPS module I am using a Neo-7M with TLS to USB convertor.

navsat_nmea_driver helps convert raw GPS sensor data to a more human readable longitude and latitude.

install the driver using command:

sudo apt-get install ros-noetic-nmea-navsat-driver

install mapviz :

Run mapviz:

roscore

roslaunch mapviz mapviz.launch

Run nmea driver:

rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/ttyUSB0 _baud:=9600

if you use apt to install Mapviz, the launch file should be located under your ROS installation directory.

Here’s my launch file:

<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=”McMaster_U”/> <! — auto →

<rosparam param=”local_xy_origins”>

[{ name: McMaster_U,

latitude: 43.2569989,

longitude: -79.9203296,

altitude: 80,

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”/> <! — adding <remap from=”fix” to=”/navsat/fix”/> will make it listen to the topic from my bag file. →

</node>

<node pkg=”tf” type=”static_transform_publisher” name=”swri_transform” args=”0 0 0 0 0 0 /map /origin 100" />

</launch>

/opt/ros/noetic/share/mapviz/launch

By changing the local_xy_origins from default to my customized address, I was able to display Hamilton’s map in Rviz.

Reference:

--

--