GithubHelp home page GithubHelp logo

gps3's People

Contributors

colour-of-art avatar garbas avatar lipi avatar pzrq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gps3's Issues

Cycle dependency found

When running pipdeptree -r -p channels I get:

Warning!! Cyclic dependencies found:
* gps3 => gps3 => gps3

seems like something is misconfigured for gps3.
I have version: gps3 0.33.3

Altitude attribute no longer works with gpsd 3.19

It appears gpsd deprecated their alt attribute in favor of altHAE. When gps3 is used with gpsd 3.17, the altitude attribute is fine. When it's used with gpsd 3.19, altitude is always 0. (I suspect it's only reading the now-deprecated alt value that's always set to 0 or NaN).

RE: Saving Files in .txt Format for Use in .kml files...

Hello,

I have been trying to understand the flow of the source a bit lately compared to when I just used it.

Is there a way to write to a file to handle .txt formatting while reading serial data in this lib?

Seth

P.S. I just spent a few hours trying to make a couple of the options available in a .txt file but could not get any output.

I am trying to use lat, lon, and alt in my file so far.

TypeError: argument must be an int, or have a fileno() method.

I try to close an AGPS3mechanism instance but it raises an error.

from gps3.agps3threaded import AGPS3mechanism

gps = AGPS3mechanism()
gps.stream_data()
gps.run_thread()

print(gps.data_stream.time)

gps.stop()

It raises:

Traceback (most recent call last):
  File "/opt/python3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/opt/python3.5/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/python3.5/lib/python3.5/site-packages/gps3/agps3threaded.py", line 43, in unpack_data
    for new_data in self.socket:
  File "/opt/python3.5/lib/python3.5/site-packages/gps3/agps3.py", line 115, in next
    waitin, _waitout, _waiterror = select.select((self.streamSock,), (), (), timeout)
TypeError: argument must be an int, or have a fileno() method.

How to fix this, please?

How to use a serial GPS?

how can I make it work with a serial data from an GPS at /dev/ttyUSB2 at , for example 57600 bps ?
and can it take NMEA and/or GPX from such serial interface ?

Thank you.

how do i get HDOP ?

I have this setup, (agps3 and agps3threaded) and can get lat, long, alt and the demo give ones.
I see hdop in the list, but cannot get it, it just returns n/a

e.g.
agps_thread.data_stream.lat
works fine
agps_thread.data_stream.hdop

returns n/a

cgps, nmea and gpsmon are all giving me hdop in the stream
(ublox mk8030)

Bad example - 100% CPU due to looping

The sample code below is currently returned as the top search result for python gps. It's hosted at this URL https://pypi.org/project/gps3/ and the big problem here is that the loop runs out of control, trashing the CPU usage for no reason. I would recommend adding a sleep to the loop. Quite simply a "time.sleep(0.2)" just below the "for new_data in ..." line would save a ton of carbon as N00bs using the sample code don't end up with code that max's out their CPU with useless looping.

from gps3 import gps3
gps_socket = gps3.GPSDSocket()
data_stream = gps3.DataStream()
gps_socket.connect()
gps_socket.watch()
for new_data in gps_socket:
    if new_data:
        data_stream.unpack(new_data)
        print('Altitude = ', data_stream.TPV['alt'])
        print('Latitude = ', data_stream.TPV['lat'])

README cleanup

Your README needs some serious cleanup I think.

Can you provide the code snippets as ready-to-copy snippets?
That would be very helpful!
Proper placing of comments (above lines) would also be good there.

Also: One README is enough! ;-)

GST Lat/Lon Standard Deviation are parsed as actual Lat/Lon with AGPS3

Please excuse me if I'm misunderstanding how to use the library.

I'm experiencing a problem where the lat and lon values from the GST message (which indicate the standard deviation in meters of the latitude and longitude estimates) are being unpacked as if they are the actual lat/lon. This is because their keys in the GST message are simply 'lat' and 'lon', the same as the actual lat/lon reported in the TPV message.

Is there an intended workaround for this?

Exceptions

I'm working on an integration of GPSD into Home-Assistant.io and using your project.

Have you considered to raise exceptions instead of printing to STDOUT if there is no connection possible or another problem occurs?

agps3/gps3

What exactly is the difference between agps3.py and gps3.py? diffing both yields pretty much the same thing.

sys.stderr.write error

When GPSD is not running, it should throw ConnectionRefusedError: [Errno 111] Connection refused, however gps3.py, line 70 has a bug:

sys.stderr.write('\nGPSDSocket.connect OSError is-->', error)
TypeError: write() takes exactly 1 argument (2 given)

Is this project abanadond?

I am running into an issue with gps3 and the upstream maintainers have requested that this be fixed in the gps3 module. This is a logic issue in processing GPS sentences. You can reference the pull request in Home Assistant - the Proposed Change details the issue. home-assistant/core#83953

Are you still maintaining this project? If not, would you be willing to transfer ownership to either myself or someone else that could make updates.

Thanks

Change stdout writes to log

sys.stderr.write(f'\r\nGPSDSocket.connect exception is--> {error}')

First of all, thanks for gps3. Really makes using gps with python easier.

I'd like to propose an enhancement: Use logging instead of writing to stdout/stderr.
That way, people can tweak output location, levels etc. It's more configurable and all around a better solution imho.

Adding version tags for releases

The pypi version is much ahead of your github version of the code.
Can you use the tags here to get ready for pypi releases?

I'm planning to provide a package for this in Arch Linux AUR.
I'd prefer a "release version" of this code instead of a "git version" there.
Also: Using setuptools for that would be very awesome!
https://github.com/pypa/setuptools

Version number needs incrementing

Hi @wadda,

I'm just experimenting with gps3 but I've noticed that the bug on line 162 of gps3.py (key in packages['DEVICE'] as opposed to key in self.packages['DEVICE']) still persists if I install gps3 via pip install gps3. I suspect this is because the version number (0.32.0) has not been incremented with the bug fix. Would you mind updating the version number?

Thanks and good work by the way!

Martyn.

Fix quality

Hi,

this library looks grat. However I can't find "Fix Quality" data from the GGA sentence. Am I missing something?

Many thanks!

JSON Leftovers

The socket read is run through the JSON

def refresh(self, gpsd_data_package):
    """Sets new socket data as Fix attributes
    Arguments:
        self:
        gpsd_data_package (json object):
    Provides:
    self attribute dictionaries, e.g., self.TPV['lat'], self.SKY['gdop']
    Raises:
    AttributeError: 'str' object has no attribute 'keys' when the device falls out of the system
    ValueError, KeyError: most likely extra, or mangled JSON data, should not happen, but that
    applies to a lot of things.
    """
    try:
        fresh_data = json.loads(gpsd_data_package)  # The reserved word 'class' is popped from JSON object class
        package_name = fresh_data.pop('class', 'ERROR')  # gpsd data package errors are also 'ERROR'.
        package = getattr(self, package_name, package_name)  # packages are named for JSON object class
        for key in package.keys():  # TODO: Rollover and retry.  It fails here when device disappears
            package[key] = fresh_data.get(key, 'n/a')  # Updates and restores 'n/a' if key is absent in the socket
            # response, present --> 'key: 'n/a'' instead.'
    except AttributeError:  # 'str' object has no attribute 'keys'
        print('No Data')
        return
    except (ValueError, KeyError) as error:
        sys.stderr.write(str(error))  # Look for extra data in stream
        return

As you see this last ValueError, KeyError throw a error with extraneous data that is in the JSON object shipped from GPSD

[io@io gps3] :( python3 human.py -host 192.168.0.4
Keyboard interrupt received
Terminated by user
Good Bye.
.
Extra data: line 1 column 2 - line 2 column 1 (char 1 - 15)Extra data: line 1 column 5 - line 2 column 1 (char 4 - 512)Extra data: line 1 column 2 - line 2 column 1 (char 1 - 97)Extra data: line 1 column 2 - line 2 column 1 (char 1 - 113)Expecting value: line 1 column 1 (char 0)Expecting value: line 1 column 1 (char 0)Extra data: line 1 column 2 - line 2 column 1 (char 1 - 159)Expecting value: line 1 column 1 (char 0)[io@io gps3] :(

I'm looking for a way to join this data with the data that is already in the buffer. I'm also open to ideas.

Unhandled Exception: 'NoneType' object has no attribute 'select'

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 754, in run
  File "433mobile.py", line 213, in gpsThread
  File "433mobile.py", line 236, in gpsConnectAndMonitor
  File "/root/.local/lib/python2.7/site-packages/gps3/gps3.py", line 116, in next
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'select'

Unclear what conditions led to the situation. The application works fine normally.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.