gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: need help: have issues with gpsd-client under python


From: Jon Schlueter
Subject: Re: need help: have issues with gpsd-client under python
Date: Thu, 30 Jun 2022 08:44:55 -0400

so, one thing to keep in mind is that the number of messages you
receive back in a given second will vary.

I see a LOOP_SLEEP = 0.25
With that it will at most process 4 messages from your GPS per second

try adding a debug message or logging message for what messages are received
https://github.com/beta-tester/python-gpsd-client/blob/main/gps_issue.py#L413

you may be getting other messages than sky or tvp and not updating anything.

On Thu, Jun 30, 2022 at 6:55 AM Beta Tester <alpha-beta-release@gmx.net> wrote:
>
> hi, i have several issues with gpsd under python.
> i have two Raspberry Pi Zero W (rev.1.3) acting as gpsd-server (via WiFi, 
> HOST_1:192.168.1.7 & HOST_2:192.168.1.8) with an GPS device on each connected 
> via serial port on GPIO.
> and i have a Raspberry Pi 4 acting as gpsd-client (via LAN-cable, 
> IP:192.168.1.2) to collect and store gps data from both gpsd-servers.
>
> the gpsd-client is made in python:
> two threads are running `gps.gpd(host=HOST_1)`, `gps.gpd(host=HOST_2)` to 
> collect gps data of interest (`TPV`,`SKY`) and make a copy of it (with 
> transforming nested dictwrapper to dict) and put the data to a queue.
> another thread is taking the data from the queue and store them to a 
> in-memory database first and every 10 minutes it store the data from the 
> in-memory database to a file and clean the in-memory database and it starts a 
> script that uses the data from the database file to publish the data for a 
> local webpage.
>
> everything works well except:
>
> 1. `gps.next()` seems to get crazy from time to time in two ways.
>    case 1: `gps.next()` blocks forever and never returns.
>    case 2: `gpd.next()` returns the same gps record repeatly over and over.
>
> 2. because `gps.next()` or `gps.read()` blocks the thread, is there a way to 
> set a timeout to get back control to the loop?
>    or is there a non-blocking way to see if there are data in `gps.gps()` 
> before entrering the blocking `gps.next()` or `gps.read()`?
>
> 3. when starting with `gps.gps(reconnect=True)`, when does a reconnect 
> happen? i cannot see any difference between reconnect enabled or disabled.
>    e.g., the gpsd-servers powers off and powers on again, 
> gps.gps(reconnect=True) does not come back receiving gps data.
>
> 4. not every time i get a `StopIteration` exception, then the gpsd-server 
> goes down while `gps.next()`.
>
> on all Raspberry Pi's there is the newest RasPiOS Bullseye installed and is 
> full updated.
> on all RPi's i tried the debian distribution of gpsd v3.22 and i compiled 
> gpsd `release-3.22`, `release-3.23`, `release-3.24` and `3.24.1-dev` from 
> source code.
> all RPi's (gpsd-servers/-clients) were always on the same version of gpsd.
> the gpsd v3.24 shows up the issue quicker than v3.23
>
> on the gpsd-server on the RPi ZeroW i run `gpsd -D 5 -G -N -n -s 115200 
> /dev/ttyAMA0 2>&1 | tee /tmp/test-gpsd.txt` as root
>
> do i something wrong in the two gpsd-client threads?
> maybe the RPi Zero W with its single core CPU is too weak to handle a 
> gpsd-client?
>
> the link to the python source code i use, in case someone will watch the code 
> to point me, what i am doing wrong there:
> https://github.com/beta-tester/python-gpsd-client/blob/main/gps_issue.py
>
> PS.: i know `gpsplot` exists. i just want to know what is going wrong in my 
> application.
>
> thank you in advanced.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]