gpsd-users
[Top][All Lists]
Advanced

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

gpsd Example2.py


From: Dirk Beer
Subject: gpsd Example2.py
Date: Tue, 20 Sep 2022 12:46:23 +0000

I'm learning how to use gpsd in python, and I'm wondering about discrepancies in the examples I see. Can you point me in the right direction?

Specifically, Example2.py shows something like:

    session = gps.gps(mode=gps.WATCH_ENABLE)
    while 0 == session.read():
        print(session.fix.xxx)
 
But https://gpsd.io/libgps.html shows:

    session = gps.gps(host="localhost", port="2947")
    session.stream(flags=gps.WATCH_JSON)
    for report in session:
        process(report)
    del session

For me, Example2.py doesn't work, it shows repeated identical lat, longs (but I suppose this could be a problem on my end).

I'm wondering, which approach is the right way to do things?

(I'm using 3.24, gpsd started with sudo /usr/local/sbin/gpsd /dev/ttyACM0 -F /var/run/gpsd.sock on a raspberry pi zero with Bullseye)


reply via email to

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