pygpsclient

repository·master·Indexed 21 days ago

https://github.com/semuconsulting/pygpsclient

A multi-platform, open-source GNSS Diagnostic and UBX Configuration GUI application written in Python. It supports protocols including UBX, NMEA, RTCM3, SBF, UNI, QGC, SPARTN, NTRIP, and TTY. The tool allows for testing, diagnosing, and configuring GNSS/GPS receivers via serial (USB/UART), socket (TCP/UDP), and binary files. It includes features for NTRIP client/base station services, RINEX conversion, and specific configuration interfaces for u-blox (Gen 8 and Gen 9+), Quectel, Septentrio, and Unicore devices.

Tokens
12.9K
Snippets
29
Records
63
Agent score
74%

What's inside pygpsclient

  1. Overview of PyGPSClient capabilities

    master

    PyGPSClient is a multi-platform graphical GNSS/GPS testing, diagnostic, and configuration application. It is written in Python and uses the tkinter GUI framework.

    Key Capabilities:

    • Protocol Support: NMEA, UBX (u-blox binary), SBF (Septentrio binary), UNI (Unicore binary), QGC (Quectel binary), RTCM3, SPARTN, NTRIP, and TTY (ASCII text).
    • Data Stream Sources: Serial (USB/UART), Socket (TCP/UDP), binary data streams (terminal or file capture), and binary recordings (e.g., u-center *.ubx files).
    • NTRIP Services: Provides an NTRIP client for both RTCM3 and SPARTN services. It can also serve as an NTRIP base station using RTK-compatible receivers (e.g., u-blox ZED-F9P, Quectel LG/LC Series, Septentrio Mosaic Series, or Unicore UM9** Series).
    • Device Configuration: Supports configuration via proprietary UBX, NMEA, and ASCII TTY protocols for most u-blox, Quectel, Septentrio, Unicore, and Feyman GNSS devices.
    • Data Conversion: Experimental support for RINEX conversion of raw observation, navigation, and meteorology data.
  2. Define User Defined Presets for UBX, NMEA, and TTY

    master

    The UBX, NMEA, and TTY Configuration Dialogs allow you to send custom configuration messages or sequences to a receiver. You can define these in your JSON configuration file under the "ubxpresets_l", "nmeapresets_l", or "ttypresets_l" sections.

    Format Requirements

    Avoid using embedded commas or semicolons in the free-format text description part of the line.

    • UBX: <description>, [<message class>, <message id>, <payload as hexadecimal string>, <msgmode>, ...]
    • NMEA: <description>; [<talker>; <message id>; <payload as comma-separated string>; <msgmode>; ...]
    • TTY: <description>; [<tty command>; ...]

    Key Features

    • Confirmation Pop-ups: If the description contains the term CONFIRM, a confirmation box will appear before the command is sent.
    • Resetting Presets: To restore the initial default set of commands, insert "INIT_PRESETS" at the top of the relevant configuration section.
    • Recording: You can use the Configuration Command Load/Save/Record facility to record commands sent to a receiver and automatically import them into these sections.
  3. Best practices: Global vs Virtual Environments (venv)

    master

    When installing PyGPSClient via pip, you have two choices:

    1. Global Installation: Installs into the user's home environment. This may trigger a Defaulting to user installation because normal site-packages is not writeable warning.
    2. Virtual Environment (venv): Creates a dedicated environment for the application.

    It is highly recommended to use a venv to avoid messing up your global Python installation, to manage different package versions across applications, and to keep dependencies clean.

    Note: Some platforms (like Ubuntu or Homebrew-managed Python) enforce virtual environments via an externally-managed-environment error if you attempt a global install.

  4. Convert Binary Datalogs to RINEX

    master

    The RINEX Conversion Dialog converts raw observation, navigation, and meteorology data from binary datalogs into RINEX format.

    Pre-Requisites

    A binary datalog containing raw observation (UBX RXM-RAWX), navigation (UBX RXM-SFRBX) and/or meteorology (NMEA) data or RTCM3 ephemerides (1019, 1020, 1041-1046) messages. It is recommended to use files with at least 15-30 minutes of continuous data.

    Conversion Steps

    1. Select the binary datalog file using the Folder icon.
    2. Choose the RINEX protocol version (3.05 or 4.02).
    3. Select the output file types: O (observation), N (navigation), or M (meteorology).
    4. Select the datasource for each type (e.g., UBX, RTCM3, NMEA 0183).
    5. (Optional) Filter by GNSS (GPS, GAL, BDS, etc.), Observation codes (1C, 2L, 5I, etc.), or SV codes (G11, E03, C23, etc.).
    6. (Optional) Use the Advanced panel to add metadata for the marker, antenna, receiver, observer, or comments.
    7. Click the Start icon to process. A progress bar will indicate status, and the output filenames (*.rnx) and record counts will be displayed upon completion.
  5. Configure legacy u-blox receivers (Gen 8 or earlier)

    master

    For older u-blox GNSS receivers (Generation 8 or earlier), use the legacy UBX configuration panels.

    Key Features:

    • Protocol Configuration panel (CFG-PRT): Sets baud rate and inbound/outbound protocols across all ports.
    • Solution Rate panel (CFG-RATE): Sets the navigation solution interval in ms (e.g., 1000 for 1/second) and the measurement ratio.
    • Message Rate panel (CFG-MSG): Sets message rates per port for UBX and NMEA messages. The rate is relative to the navigation solution frequency (e.g., a rate of 4 means every 4th navigation solution).
    • UBX Legacy Command configuration panel: Provides structured updates for legacy CFG-* commands. 'X' (byte) type attributes can be entered as integers or hexadecimal strings (e.g., 0x1f1f0000).
    • Version Panel: Displays current hardware/firmware versions (double-left-click to refresh).

    Tip: Clicking anywhere in the background of a panel refreshes the displayed information with the current configuration.

  6. Install PyGPSClient on MacOS

    master

    PyGPSClient does not require Homebrew or MacPorts, but there are specific version recommendations for stability:

    1. Recommended Approach: Use official Python for MacOS installation packages.
    2. Tkinter Version Warning: Avoid the deprecated tkinter (8.5) provided with older MacOS versions.
    3. Tkinter 9.0 Warning: Versions of Python >= 3.14.5 (or Homebrew python-tk >= 3.12) include tkinter 9.0, which may cause UI sluggishness on MacOS Sonoma and Tahoe. It is recommended to use official Python <= 3.14.4 or Homebrew python-tk = 3.11.
    4. Homebrew Alternative: If you use Homebrew to ensure support for sqlite3 extensions, use the python-tk formula:
    brew install python-tk@3.11 libspatialite

    Note: On MacOS, serial ports may appear as /dev/tty* or /dev/cu*.

  7. Connect via TCP/UDP Socket or TLS

    master

    To connect to a network-based GNSS stream:

    1. Enter the server URL and port.
    2. Select the protocol (defaults to TCP).
    3. Click the Connect Socket icon.
    4. For encrypted connections, tick the TLS checkbox. Use the Self Sign checkbox for self-signed TLS certificates (common in test environments).
  8. Use the GPX Track Viewer

    master

    The GPX Track Viewer allows you to visualize GPX files containing trkpt (track point), rtept (route point), or wpt (waypoint) elements.

    Features

    • Map Views: Supports custom offline map images or online MapQuest views (map, sat, or hyb). Note that MapQuest views require a free MapQuest API key.
    • Scaling: Y-axis scales adjust based on your selected units (metric or imperial).
    • Metadata: Displays min, max, average (mean), and median elevation and speed values.
    • Navigation: A location marker indicates the nominal center point of the track.

    To open the viewer, select Menu..Options..GPX Track Viewer. Use the Refresh icon to update the display after resizing, zooming, or changing units.

  9. Enable TLS Encryption for Server/Caster

    master

    PyGPSClient supports encrypted TLS (HTTPS) connections for its server/caster facilities.

    TLS Configuration

    • Private Key/Certificate: Set the location via the PYGNSSUTILS_PEMPATH environment variable. The default is $HOME/pygnssutils.pem.
    • Client Certificate: The TLS Client requires the certificate from this file, which can be set via the PYGNSSUTILS_CRTPATH environment variable. The default is $HOME/pygnssutils.crt.

    Generating a Self-Signed Certificate

    For testing, you can create a self-signed PEM file using openssl:

    openssl req -x509 -newkey rsa:4096 -keyout pygnssutils.pem -out pygnssutils.pem -sha256 -days 3650 -nodes
  10. Install PyGPSClient via pip

    master

    To install PyGPSClient, ensure you have Python >=3.10 and tkinter >=8.6 installed. If the Python binaries folder is in your PATH, you can install the package using pip.

    Quick Installation

    python3 -m pip install --upgrade pygpsclient

    After installation, you can launch the application by running:

    pygpsclient
  11. Prerequisites for PyGPSClient

    master

    Before installing PyGPSClient, ensure your system meets the following requirements:

    • Python Version: Python >= 3.10 (It is highly recommended to use the official installation package from Python.org rather than pre-installed system versions).
    • GUI Library: Tk (tkinter) >= 8.6.
    • Display: Screen resolution >= 640 x 480 (VGA). 1920 x 1080 is ideal.
    • System: A Graphical User Interface (window system/manager) must be available.

    Note on Spatialite: If you require the optional spatialite database recording facility, your Python environment must support loading sqlite3 extensions (compiled with --enable-loadable-sqlite-extensions). This is standard on Windows and Linux but often requires manual configuration on MacOS. You must also have the mod_spatialite module installed and available in your PATH (or LD_LIBRARY_PATH on Linux).

  12. Create a MacOS desktop launcher for PyGPSClient

    master

    To create a MacOS application launcher, use the Automator tool:

    1. Open Automator and create a new "Run Shell Script" application.
    2. Set the Shell to /bin/zsh.
    3. Enter the path to your PyGPSClient executable (e.g., /Users/myuser/pygpsclient/bin/pygpsclient).
    4. Save the application as PyGPSClient.app in your Applications folder.
    5. To assign an icon:
      • Right-click the PyGPSClient entry in the Applications folder and select "Get Info".
      • Locate the pygpsclient.ico file in your site-packages folder (e.g., /Users/myuser/pygpsclient/lib/python3.11/site-packages/pygpsclient/resources/pygpsclient.ico).
      • Drag and drop the icon file onto the default application icon at the top left of the "Get Info" panel.