Python library not giving position data consistently

Setup:

  • Sparkfun product #GPS-21305, ZED-F9R Pi Hat
  • Dual-band antenna
  • Raspberry Pi 3B
  • Raspberry Pi OS Bookworm (2024-03)
  • Python 3.11.2

Expected behavior:

  1. Install ublox_gps module on MCU.
  2. Run example script geo_coords_ex1.py
  3. Geographic coordinates plus compass heading are shown in terminal.

Actual behavior:

  1. Install dependencies as listed above.
  2. Run script repeatedly and wait for it to finish.
  3. See no values (but instead an error “geo has no attribute ‘lat’” or similar) in terminal most times, but some times there are coordinate and heading values.

Troubleshooting:

  • Run the script back-to-back multiple times. The rate of return for values seems to be ~20%.
  • Wait for the board to warm up (~4 minutes) before running the script. No change noted.
  • Modify the “timeout” value on port initialization. No change noted from 0.1 to 10 in steps of 1.
  • Modify the baud rate: 9600, 38400, and 115200 in both board and script. No change noted.
  • Move the antenna and board around. No change noted.
  • Move the antenna and board to a different location. Various places were attempted, no change was noted.
  • Check the board in U-Center. All values are present, reasonable, and updating at 1 Hz in U-Center.
  • Check UART settings in U-Center. The UART1 port was confirmed to be open and sending data out. It was configured to send UBX messages out.

Request:
Did I miss a setup step or adjustment that keeps the example #1 for the Python library from functioning all the time, every time? What should I check or do next?

You most likely have a python pkg issue similar to this python - Geoviews Attribute error: module 'geoviews' has no attribute 'output' - Geographic Information Systems Stack Exchange and that a usable variable is being passed (un-assign any ‘none’ location/at settings and ensure you are testing outside with a clear view of the sky)

Also ensure you have a working qwiic python pkg installed too…finally, it might help to run an older/different OS on a 3B+, especially if you end up needing to run other older/deprecated pkgs

Thank you for the response, @TS-Russell. Actions and follow-up have been made.

The “sparkfun-qwiic-i2c” and “sparkfun-qwiic” packages have now been installed on Raspberry Pi OS 11, Bullseye, on a Pi 3B (not B+).

Checking the piwheels project, this seems to be the latest version. However, the Release table on that site showed a failed build for all Pi OS versions of package version 1.1.5, so the package was reinstalled with version 1.1.4 (the next package version with successful builds.)

Follow-up:

  • The link given above Geoviews seemed to point to a root issue of a python package not being installed at its most recent version. Was this intended? The version of “sparkfun-ublox-gps” installed was 1.1.5.
  • After the reinstall of the “sparkfun-ublox-gps” package version 1.1.4, the “geo_coords_ex.py” script gets hung up on the “geo = gps.geo_coords()” line. The method is called, but it never returns and the script cannot advance. I suspect an infinite loop but have no way to check that guess. U-Center confirms that data is still being sent out over the UART1 port to the Pi Hat. Is this an expected behavior of v1.1.4 to wait until there is a message to return? Do I need to match to a specific version of the Qwiic packages?
  • For the suggestion of “un-assign any ‘none’ location/at settings,” where would I check that/those settings?