Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aproblem #9

Closed
yuanshuai19960730 opened this issue Jul 22, 2020 · 11 comments
Closed

aproblem #9

yuanshuai19960730 opened this issue Jul 22, 2020 · 11 comments

Comments

@yuanshuai19960730
Copy link

hello,here is my problem :
i follow the usage describle in the usage.png
nav_posllh = x.read()
No errors have been found as of now
and then when i go next
nav_posllh.lat
it says that nav_posllh has no attribute 'lat'
nav_posllh.l
it says that nav_posllh has no attribute 'l'
could u help me with that ,thanks

@Korving-F
Copy link
Owner

Hi; I can try ^_^

Can you send me your entire code snippet as you write it?
Can you also try the following and send the resulting output?

y = x.read()
print(y.ubx_id)
print(y.ubx_class)

Which version of python are you using?

@yuanshuai19960730
Copy link
Author

image
Thanks for your reply:
Can you see the picture i send,my code snippet is on it
I had tried y.ubx_id ,it says 'UbxMessage' object has no attribute 'ubx_id'
The vision of python is Python 3.6.9 on Ubuntu system.
Look forward to your reply,thanks

@Korving-F
Copy link
Owner

I think I can see what the problem is: you're enabling NAV-POSLLH to be sent regularly.
But other messages have been enabled on your GPS module as well (many are not supported as of this moment).
At the moment the script fails silently if it receives unsupported messages.

>>> y = x.read()
Receiving
02 14  # <- This is a class 2, id 14 event you are receiving: UBX-RXM-MEASX not NAV-POSLLH

There are multiple things you can/should do:

  • Disable the event and any others you're not interested in:
x.disable_message(2,20) # Note that it prints out the class/id in hexadecimal, but takes in these as integers
  • Read safely and possibly without a flush (untested code; may contain a typo):
while(True):
    try:
        y = x.read()
        if(y.ubx_id == '02' and y.ubx_class == '01'):
            print("You found a NAV-POSLLH message ^_^")
            print(y.lat)
        else:
            print("You found a different but supported message.")
            print("ID: " + y.ubx_id + " Class: " + y.ubx_class)
            print("Variables: " + vars(y))
    except:
        print("Now you found an unsupported message")

See this document for more message types and technical information on the receiver: https://www.u-blox.com/sites/default/files/products/documents/u-blox8-M8_ReceiverDescrProtSpec_%28UBX-13003221%29.pdf

If you find a message you want to have added let me know :)

@yuanshuai19960730
Copy link
Author

image
thanks a lot ,i had received some message illustrated as the up picture
but ,there is still a problem:
i only enable two kinds message POSLLH(01,02) and PVT(01,07) on u-center on my computer
image
and then i do as follow:

x.disable_message(1,7)
.xenable_message(1,7)
image
does it means i cannot enable message use the code but only can enable message use u-center?because PVT turn gray on u-center
image

@Korving-F
Copy link
Owner

I'm not sure what exactly the issue is for you; it seems to work. Some things maybe you can try:

  • Set the baudrate to 9600
  • Disable all NMEA messages if you don't need them:
x.disable_NMEA() # get rid of noise
  • try multiple executions of x.enable_message(1,7).

When it enables a message type a CFG message is sent and only when the receiver processes this correctly an ACK is sent. If the message is sent but is malformed/not supported etc. it will send a NACK. In your case it seems to receive neither.

Let me know how your experiments are going; hope I can be of more help ^_^

@yuanshuai19960730
Copy link
Author

i have tried , i can only disable_message here.
I have set on u-center that i can only receive 01,07 and 01,02 ,and after i disable_message(01,07)
i cannot receive 01,02 message either,it syas
image
i think i can only enable/disable message on u-center now,and that does not matter.

and here i have a much more imortant question ,when i receive 01,02 message, it works well
image

but when i receive a 01,07 message
image
i just cannot understanding it!!
wish u can help me with that😂

@Korving-F
Copy link
Owner

Hmm; this seems like a classical python2 vs. 3 error.
Can you stop sending all messages in u-center and send back a similar image as below?

btw; do you have pyserial properly installed?

pip install --upgrade --force-reinstall pyserial
pip3 install --upgrade --force-reinstall pyserial

Also which version of this project are you using? (maybe do a pull / clean clone? just in case)

image

image

@yuanshuai19960730
Copy link
Author

image
i stopped all information and did pip3 install --upgrade --force-reinstall pyserial.
the only difference is my pyserial is in dir /.local/lib/python3.6/site-packages and yours is in dir usr/loacl/lib/python3.6/dist-packages.
does it matter? I'm not familiar with Python on linux.Because i have this mission ,i have to learn about it .

my project is python 3.6.9,i did not install python 2.x
image

and In the same case,message 01,02 works well ,but 01,07 just has problem ,it is really Weird !!
my mother language is not english ,and i cannot understand the meaning of "do a pull / clean clone",sorry about that😭
BTW,you reply to me so early today ,i guess you must have a holiday today😁.Wish you have a good time!

@Korving-F
Copy link
Owner

You're probably doing the installation correct; the way I installed the package on my system is actually insecure and should be avoided. Although you could look into using venv virtual environment.

Could you try to print PATH as described here just in case?: https://www.dummies.com/programming/python/how-to-find-path-information-in-python/

If you don't see your .local dir printed there follow for example PYTHONPATH example to add it manually: https://www.devdungeon.com/content/python-import-syspath-and-pythonpath-tutorial

Git pull / git clone:

cd ~/Desktop/py/
git clone https://github.com/Korving-F/ublox
# https://docs.github.com/en/enterprise/2.13/user/articles/cloning-a-repository

Can you also send a "ls -lah /dev/ttyACM3"?
It might be that running in a VM is complicating things.

Doing this from my phone so sorry for the incomplete response. Really not sure what it otherwise could be..

P.s. your English is good ^_^

@yuanshuai19960730
Copy link
Author

i am so happy that the question is solved:
i just git pull/git clone and it works well now
image
however, the enable/disable still does not work.but i can continue my work now:to add some message that i need like you do in the code .
BTW,i noticed that my ublox is version f9p,maybe this is the reason?
You are such a warmhearted and nice man,Wish everything goes well with you☺.Thank you very much!!

@Korving-F
Copy link
Owner

Awesome :D no worries and good luck with your project!
I'll try to look at f9p; maybe something changed :)
Greetings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants