Code Monkey home page Code Monkey logo

Comments (10)

Hadatko avatar Hadatko commented on July 20, 2024

Hello
except ube.UBXMessageError() as err: should be except ube.UBXMessageError as err: ??

Try remove the parenthesis and catch your real error if i am correct.

from pyubx2.

jancelin avatar jancelin commented on July 20, 2024

Hi @Hadatko ,
same problem but cleaner without the ()


Starting serial read thread...

Starting HTTP Server on http://127.0.0.1:8123 ...
Press Ctrl-C to terminate.

<UBX(NAV-PVT, iTOW=15:17:25, year=2022, month=4, day=11, hour=15, min=17, second=25, validDate=1, validTime=1, fullyResolved=1, validMag=0, tAcc=1006, nano=155037, fixType=3, gnssFixOk=1, difSoln=1, psmState=0, headVehValid=0, carrSoln=2, confirmedAvai=1, confirmedDate=1, confirmedTime=1, numSV=21, lon=-1.0281327, lat=45.9921395, height=50492, hMSL=2369, hAcc=36, vAcc=50, velN=6, velE=-13, velD=-11, gSpeed=14, headMot=116.17642, sAcc=99, headAcc=180.0, pDOP=1.21, invalidLlh=0, lastCorrectionAge=0, reserved0=1044519020, headVeh=0.0, magDec=0.0, magAcc=0.0)>
Something went wrong Message checksum b'\x00\x1a' invalid - should be b'\x8e\x84'
<UNKNOWN PROTOCOL(header=b'$\x00')>
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/basegnss/pyubx2/examples/webserver/ubxserver.py", line 150, in _read_thread
    self.set_data(parsed_data)
  File "/home/basegnss/pyubx2/examples/webserver/ubxserver.py", line 167, in set_data
    if parsed_data.identity == 'NAV-PVT':
AttributeError: 'str' object has no attribute 'identity'

from pyubx2.

semuadmin avatar semuadmin commented on July 20, 2024

Hi @jancelin Sorry you're having difficulties.

To be honest, the webserver example was something I knocked up fairly quickly and it's by no means a production-strength implementation. Errors of the kind you're seeing (invalid checksum, unknown protocol) are normally indicative of a problem with the serial stream itself. Are you sure you have the correct baud rate set (the default on F9P UART1/2 is normally 38400)? Do you get the same errors if you use, say, the gnssdump cli utility to parse the output?

I've just uploaded a slightly amended version of the webserver example with enhanced exception handling (and one fixed typo which @Hadatko spotted!) and tried it against my own F9P - seems to be working fine...

(NB: this fix doesn't address the root cause of any 'unknown protocol' error - it just stops it knocking over the web server)

Connecting to serial port /dev/tty.usbmodem141301 at 9600 baud...

Starting serial read thread...

Starting HTTP Server on http://localhost:8080 ...
Press Ctrl-C to terminate.

127.0.0.1 - - [11/Apr/2022 16:47:08] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [11/Apr/2022 16:47:08] "GET /scripts.js HTTP/1.1" 200 -
127.0.0.1 - - [11/Apr/2022 16:47:08] "GET /styles.css HTTP/1.1" 200 -
127.0.0.1 - - [11/Apr/2022 16:47:08] "GET /gps HTTP/1.1" 200 -
127.0.0.1 - - [11/Apr/2022 16:47:13] "GET /gps HTTP/1.1" 200 -
127.0.0.1 - - [11/Apr/2022 16:47:18] "GET /gps HTTP/1.1" 200 -
^C

Terminated by user

Suggest you have a go with this amended version and let me know how you get on.

from pyubx2.

jancelin avatar jancelin commented on July 20, 2024

Hi

It's OK, it works on my side. Thanks a lot!

I use str2str to inject RTCM3 data for RTK centipede.fr, so I'm going to modify the web interface a bit to have all the PVT information on the precision of hAcc, vAcc, carrSoln data,...
it's for the physalia and Rtkbase project,
I'll share my progress.

Screenshot 2022-04-12 at 11-25-12 GPS Server Demo

from pyubx2.

semuadmin avatar semuadmin commented on July 20, 2024

OK glad the web server example works OK, and if it provides a useful basis for your own project then great! It's easy enough to amend the set_data() routine to accept other incoming data sources (including NMEA and RTCM3 if needs be). Do please share progress - thanks.

Just bear in mind that this is a fairly simplistic web server implementation; please heed the warning on the http.server library home page:

http server warning

Out of interest, did you actually get to the bottom of the 'invalid checksum' and 'UNKNOWN PROTOCOL' errors? pyubx2 should be capable of handling any of the protocols output by a u-blox device such as the F9P (i.e. NMEA, UBX or RTCM3), so - as I say - errors of this kind are normally associated with a corrupt serial stream (e.g. incorrect baud rate or some other process interfering with the stream such as gpsd).

Are you happy to close this issue in relation to the web server example? If you continue to get persistent 'UNKNOWN PROTOCOL' errors from pyubx2 elsewhere then by all means raise a separate issue. Cheers.

from pyubx2.

foxittt avatar foxittt commented on July 20, 2024

Hello
Is it possible to make such webserver example for pyrtcm + ntrip?

from pyubx2.

semuadmin avatar semuadmin commented on July 20, 2024

Hi @foxittt. The intention with this example is to wrap a simple HTTP server around the parsed serial data stream from a local GNSS device. For simplicity sake it currently only parses selected UBX messages, but could easily be modified to parse NMEA and/or RTCM3 messages coming from the same device.

NTRIP, on the other hand, is already an internet-based protocol so much of this would be superfluous. You can access any (public) NTRIP caster by simply opening the appropriate URL in any web browser (e.g. http://rtk2go.com:2101), though you obviously wouldn't get the parsed RTCM3 data without further client-side processing.

Have a look at ntrip_handler.py in PyGPSClient for an illustration of how to receive and parse an NTRIP data stream: https://github.com/semuconsulting/PyGPSClient/blob/master/pygpsclient/ntrip_handler.py

from pyubx2.

foxittt avatar foxittt commented on July 20, 2024

Thanks! I`ll try.

from pyubx2.

semuadmin avatar semuadmin commented on July 20, 2024

Hi @foxittt ,

FYI This is typical output from an NTRIP caster as displayed by the PyGPSClient utility - is this the sort of thing you were looking to see?

Screenshot 2022-04-12 at 11 45 31

from pyubx2.

foxittt avatar foxittt commented on July 20, 2024

Yes.

from pyubx2.

Related Issues (20)

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.