sparkfun / Qwiic_Ublox_Gps_Py

https://qwiic-ublox-gps-py.readthedocs.io/en/latest/index.html
Other
69 stars 41 forks source link
gps library python sparkfun

Qwiic_Ublox_Gps_Py

follow on Twitter

SparkFun GPS-RTK2 - ZED-F9P (GPS-15136) SparkFun GPS-RTK - NEO-M8P-2 (GPS-15005) SparkFun ZOE-M8Q Breakout (GPS-15193) SparkFun SAM-M8Q Breakout (GPS-15210)
SparkFun GPS-RTK Dead Reckoning - ZED-F9R (GPS-21305) SparkFun GPS-RTK Dead Reckoning Phat- ZED-F9R (GPS-16475) SparkFun GPS Dead Reckoning - NEO-M9N (GPS-15733)

This is a Python module for the SparkFun GPS products based on u-blox GPS modules.

This package is included in the overall SparkFun qwiic Python Package. While the module itself does not use I2C, it may none the less join the ranks when the Raspberry Pi has better support for clock stretching. None the less, a Qwiic connector has been included onboard so the GPS module can be used with our along side SparkFun's Qwiic products.

Contents

Supported Platforms

The u-blox gps Python package currently supports the following platforms:

Documentation

The SparkFun u-blox gps module documentation is hosted at ReadTheDocs

Installation

PyPi Installation

This repository is hosted on PyPi as the sparkfun-ublox_gps package. On systems that support PyPi installation via pip, this library is installed using the following commands

For all users (note: the user must have sudo privileges):

sudo pip install sparkfun-ublox-gps

For the current user:

sudo pip install sparkfun-ublox-gps

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line:

python setup.py install

To build a package for use with pip:

python setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.

cd dist
pip install sparkfun_ublox_gps-<version>.tar.gz

Example Use


from ublox_gps import UbloxGps
import serial
# Can also use SPI here - import spidev
# I2C is not supported

port = serial.Serial('/dev/serial0', baudrate=38400, timeout=1)
gps = UbloxGps(port)

def run():

  try: 
    print("Listenting for UBX Messages.")
    while True:
      try: 
        coords = gps.geo_coords()
        print(coords.lon, coords.lat)
      except (ValueError, IOError) as err:
        print(err)

  finally:
    port.close()

if __name__ == '__main__':
  run()

Examples Directory


Attribution


This code is dependent on the work by daylomople and the awesome parsing capabilities of ubxtranslator.

To Do