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: Gary E. Miller
Subject: Re: need help: have issues with gpsd-client under python
Date: Thu, 30 Jun 2022 13:25:27 -0700

Yo Beta!

On Thu, 30 Jun 2022 21:50:52 +0200
Beta Tester <alpha-beta-release@gmx.net> wrote:

> no, the email button isn't working for me

Huh?

> > for some reason some emails arrivey me with a huge delay.
> > this email i still not got yet - not in inbox nor in spam folder.
> > i try to use copy-n-paste from the thread index of the mailing list.

Nothing we can do about nongnu.org email server speed.

> > > You neglect to mention your distribution, your gps decive,
> > > versions of gpsd and python.  
> >
> > distro is RasPi OS Bullseye (newest version and updated).
> > Linux zero1 5.15.32+ #1538 Thu Mar 31 19:37:58 BST 2022 armv6l
> > GNU/Linux Linux zero2 5.15.32+ #1538 Thu Mar 31 19:37:58 BST 2022
> > armv6l GNU/Linux Linux rpi4 5.15.32-v7l+ #1538 SMP Thu Mar 31
> > 19:39:41 BST 2022 armv7l GNU/Linux

Good.

> > gpsd versions tried:
> > gpsd 3.22 from distro
> > gpsd release-3.22, release-3.23, release-3.24, master (3.24.1-dev)
> > compiled from source (on each gpsd-server/-client the same version)

We can only help with 3.24 and 3.24.1~dev

> > Python 3.9.2

Good.

> > > Python sucks at threading, so I hope you dont really mean
> > > threading. The python gpsd module is not tested for threading
> > > either.  
> >
> > unfortunately i am using threadding.Thread(). i also tried
> > multiprocessing.Process(), but that was even more a fail.

You are on your own with threading, you are the fist to try, and
given Pythong "threading" I expect it to be a PITA.

> > is there
> > something else i can use from the console that let me run multiple
> > gps.gps() sessions "parallel" ?

I do not see why you could not open 2 conenctions with gpsd.open(), each
its own class.  AFAIK, the python gps class uses no statics or
shared variables, but not tested.

You could run two copies of one program, one for each client.  Put that
database to good use.

> > > > 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.  
> >  
> > > I think you said later that you had a bad conenction, causing
> > > that?  
> >
> > gotcha, i have a poor WiFi connection.

Nothing we can do about that.  Some use gps2udp to go connectionless.

> > > > 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.  
> >  
> > > Souds like a missing "-n", but later you says you use "-n"  
> >
> > i the tests i used the -n but in the normal use i forgot that
> > option. maybe it was going under may other silly sleep() issues.
> > i will add -n to the normal start as well.

Write a startup shell script, then you will not forget.

> > > > 4. not every time i get a `StopIteration` exception, then the
> > > > gpsd-server goes down while `gps.next()`.  
> >  
> > > gps.next() is not from us.  
> >
> > shall i use gps.read() instead?

Sorry, I forgot that gps.next() was in the gps module.  It just calls
gps.read().  Just a convenience for loops.

> > > what is IFNULL()???  
> >
> > if there is a row already existing with that key, i solve the
> > conflict with looking if there is a NULL in the column, if NULL,
> > then take the new value from the gps record, otherwise keep what is
> > in the column in the database.

That can work, but you are not checking that the new data is valid before
using it to overwrite the NULL.

> > > You are not always checking that items are set before trying to
> > > save them to your DB.  
> >
> > i use the conflict mechanism of the database - add new row is not
> > already exist, if already exist, fill the missing columns.

I'm talking about the other direction.  Data from gps.read() is often
not set.  So you need to check it is valid before using it.  As
per the example code previously discussed.

> > > You are not collecting data per epoch, instead you are over
> > > writing data.  
> >
> > is there a timestamp from which epoch the data is?

Usually.  Some GPS send data without a timestamp when there is no fix.

See "man gpsd_json".

> > > Here you are forgetting the PRN:
> > >    INSERT INTO data_gps_sky_map (host, el, az, ss)  
> >
> > no i don't. it is the heatmap. there is no interest to know which
> > PRN is how strong. i just want to know how is the sky view. if i
> > neef PRN, then i can reconstruct it from the data_gps_sky table.

Throwing away data is not good in the long run.

> > > No one ever, ever, said the timestamps would be unique!
> > >    # DEBUG: detect running crazy (then receiving same timestamp
> > > over and over)  
> >
> > when the timestamp is exact the same for a very long time, then
> > there is something wrong...

Wrong, but not abnormal.

> > that was my thought. anf in gps.gps(),
> > received gives time.time().

time.time() is unrelated to the time in the TPV and SKY messages.  They
are not the current time, they are the times of the measurements.

> > > They are no epmpty, just not what you expected:
> > >    # gpsd 3.24+ send lots of empty SKY records  
> >
> > ya, i am interested in satellites. that list is empty.

Yes, empty, when some SKY data is known, but not the satellite list.

> > > > PS.: i know `gpsplot` exists. i just want to know what is going
> > > > wrong in my application.  
> >  
> > > A lot is wrong.  
> >
> > ya i know now... before i was guessing...

Better to read the doc.

> > PS.: i hope this email will go the right way. the email address is
> > not the usual gpsd-users one.  

Clearly failed.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpJZ7lFSk0ar.pgp
Description: OpenPGP digital signature


reply via email to

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