gpsd-users
[Top][All Lists]
Advanced

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

Re: Information


From: Gary E. Miller
Subject: Re: Information
Date: Sat, 3 Sep 2022 11:50:09 -0700

Yo Anton!

On Sat, 3 Sep 2022 16:42:30 +0200
Anton Strydom <agstrydom@gmail.com> wrote:

> I am busy finalizing the construction of a GNSS only navigated
> autonomous vehicle.

Good luck with that.  It is a lot harder thatn it would seem at first
look.

> I am testing a number of GNSS single and dual frequency devices to
> establish their efficiency and accuracy

How?  Using gpsprof?

> I need information that is according to documentation available with
> the TPV report

Depends on your GNSS receiver.

> The information I require is the following:
> 
> Status which returns a numeric value related to the fix status ie 3 =
> RTK Fixed

Some receivers can do that, but never tha same way.

> Datum which returns a string value that should return WGS84

Some receivers can't give you the datum.  Few send the datum without a
request.  You need to poll for it.

What you really want it to set the datum to WGS84.  If you have the
wrong datum, converting is a PITA.  Also, there are many WGS84 that
differ enough to prevent your goal.

> Track which I did manage to receive using the below Python script

Easy.  But not always "accurate".

> EcefX which returns a numeric value in meters for ECEFX coordinates
> EcefY which returns a numeric value in meters for ECEFY coordinates
> EcefZ which returns a numeric value in meters for ECEFZ coordinates

Once again, depends on the receiver and how it is configured.  If you
have ECEF, then you don't need the datum.

> Besides the above I would like to receive any information provided by
> the device that is related to heading or direction.

Then you need to tell your receiver to send it.  Dependnig on your
receiver, gpsd will then pass that data on.

> The commented out parts return either error messages or nothing at all

You left out the most important data for us to help you:
        Your gpsd version, and from where.
        Your Pythin version.
        Your GNSS recevier make, model, firmware version.

Did you bother to look at the Python example from gpsd?

> import os
> from gps import *

Why not just "import gps"?

> from time import *

Why not just "import time"?

> import time

Duplicate of prior line.

> import threading

gpsd is not tested for threading.  You are on you own if you do.

> import math
> 
> gpsd = None #seting the global variable
> 
> os.system('clear') #clear the terminal (optional)
> 
> class GpsPoller(threading.Thread):

You are not "polling", you are "watching".

>   def __init__(self):
>     threading.Thread.__init__(self)
>     global gpsd #bring it in scope
>     gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info

You should say what you are watching.  JSON, NMEA, raw?

>     self.current_value = None
>     self.running = True #setting the thread running to true
> 
>   def run(self):
>     global gpsd
>     while gpsp.running:
>       gpsd.next() #this will continue to loop and grab EACH set of
> gpsd info to clear the buffer

Don't use gps.next(), it is only there to support Python iterators.

> if __name__ == '__main__':
>   gpsp = GpsPoller() # create the thread
>   try:
>     gpsp.start() # start it up
>     while True:
>       #It may take a second or two to get good data
>       #print gpsd.fix.latitude,', ',gpsd.fix.longitude,'  Time:
> ',gpsd.utc
> 
> os.system('clear')
> 
>     print
>     print ' GPS Data'
>     print '----------------------------------------'
>     print 'latitude    ' , gpsd.fix.latitude
>     print 'longitude   ' , gpsd.fix.longitude
>     print 'time utc    ' , gpsd.utc
>     print 'altitude (m)' , gpsd.fix.altitude

Typical beginners mistakes.  You failed to check that the message
type you recieved is class TPV, and that the data is valid before using it.

Clearly you did not bother to look at the Python example from gpsd?

> #      print 'eps         ' , gpsd.fix.eps
> #      print 'epx         ' , gpsd.fix.epx
> #      print 'epv         ' , gpsd.fix.epv
> #      print 'ept         ' , gpsd.fix.ept
>     print 'speed (m/s) ' , gpsd.fix.speed
> #      print 'climb       ' , gpsd.fix.climb
>     print 'track       ' , gpsd.fix.track
>     print 'mode        ' , gpsd.fix.mode
>     print 'status      ' , gpsd.fix.status
> #      print 'datum       ' , gpsd.fix.datum
> 
> 
>   except (KeyboardInterrupt, SystemExit):
>       print "\nKilling Thread..."
> gpsp.running = False
> gpsp.join()
> print "Done.\nExiting."

Your threading is terrible.  No locks.  No need to thread, but if you
are going to thread, at least do it right.

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: pgpufqFbAFELa.pgp
Description: OpenPGP digital signature


reply via email to

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