yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
GPS Module📖
1.GPS module information
  • GPS module information
2.MCU course
Arduino course
  • 1.Test course
  • 2.Parse course
Jetson nano course
  • Parses location information
RaspberryPi course
  • Parses location information
STM32
  • GPS parsing output
3.ROS course
  • 3.0 Instructions for use
  • 3.1 Preparing the GPS module for use
  • 3.2 Draw GPS track
  • 3.3 Fusion of IMU and GPS data
  • 3.4 GPS and Move_Base Navigation
Download
  • Datasheet
  • Code
  • PC software
  • ROS_VM
  • 3D_Model_File
Download ZIP

Welcome to GPS Module repository

3.1 Preparing the GPS module for use

Read GPS module data

This function is to obtain longitude, latitude and altitude data by reading GPS module data and parsing GPS data through the terminal.

1. Read GPS data through the terminal

terminal input:

roslaunch nmea_navsat_driver nmea_serial_driver.launch

image-20220616144805709

Then we look at the topic data, the terminal input:

xxxxxxxxxx
rostopic list

image-20220616144931422

Regarding the data on these topics of GPS, here is an explanation.

topictypeDescription
/extend_fixgps_common/GPSFixGPSFix messages contain GPS satellite status and positioning information
/fixsensor_msgs/NavSatFixGPS location information
/time_referencesensor_msgs/TimeReferencdGPS time information
/velgeometry_msgs/TwistStampedGPS speed information

For each topic message type, please refer to the official website URL,

gps_common/GPSFix Documentation (ros.org)

sensor_msgs/NavSatFix Documentation (ros.org)

sensor_msgs/TimeReference Documentation (ros.org)

geometry_msgs/TwistStamped Documentation (ros.org)

We can print out these topic messages on the terminal, and what we get is the GPS data. Take printing /fix as an example, the terminal input

xxxxxxxxxx
rostopic echo /fix

The terminal will print out the following data,

image-20220616151122053

Among them, latitude, longitude, altitude represent latitude, longitude and altitude respectively.

2、Read the latitude, longitude and altitude of GPS data

terminal runs,

xxxxxxxxxx
roslaunch nmea_navsat_driver nmea_serial_driver.launch
rosrun nmea_navsat_driver read_lat_long.py 

image-20220616150450647

The data printed by the terminal is the latitude, longitude and altitude of the current GPS module, look at the source code, read_lat_long.py

​x
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from sensor_msgs.msg import NavSatFix

def GPSCallback(msg):
    rospy.loginfo("latitude:%0.6f, longitude:%0.6f,altitude:%0.6f", msg.latitude, msg.latitude,msg.altitude)    
def GPS_subscriber():
    rospy.init_node('GPS_subscriber', anonymous=True)# ROS节点初始化
    rospy.Subscriber("/fix", NavSatFix, GPSCallback)
    rospy.spin()# 循环等待回调函数
if __name__ == '__main__': 
    GPS_subscriber()

The program subscribes to the data of the /fix topic, then parses it in the callback function, and finally prints it to the terminal.

 

Instructions for use
Draw GPS track

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文