Comments (17)
Hi!
Thank you for the input ^_^ The next couple of days I'm a bit busy, but I'll try to squeeze support for that specific message in asap.
from ublox.
Thank you for your answer. It would be an enormous help and would make my project far easier.
from ublox.
I just pushed a new branch with the defined message in there. Unfortunately I don't have a device that supports that specific message (only with High Precision GNSS products) so I couldn't test it; could you verify that it works?
Thanks in advance :)
from ublox.
Thank you I will test it on monday. I hope it will work :)
from ublox.
I don't know why but it is doesn't work. I am using pyCharm.
This is the message that I get when I run the code
Transmitting
06 00
Transmitting
Traceback (most recent call last):
06 01
File "C:/Users/user/PycharmProjects/RTK/GPS.py", line 12, in
print(navigation_position.relPosN)
AttributeError: 'UbxMessage' object has no attribute 'relPosN'
Receiving
05 01
Acknowledged. CLS:0x6 ID:0x0
Receiving
05 01
Process finished with exit code 1
from ublox.
Hmm.. Could you share the code / what device are you exactly using? Then I have more to go on :)
from ublox.
Of course! I am using C94 M8P modul in moving baseline and the code:
import serial
import ubx2
x = ubx2.UbxStream(serial.Serial(port='COM8', baudrate=19200, timeout=1))
x.enable_message(1, 0x3c)
navigation_position = x.read()
print(navigation_position.relPosN)
#print(navigation_position.clsID)
but I changed the Class and Message ID and also the same result. So if I try to do this:
x = ubx2.UbxStream(serial.Serial(port='COM8', baudrate=19200, timeout=1))
x.enable_message(1, 2)
navigation_position = x.read()
print(navigation_position.lat)
#print(navigation_position.clsID)
I get the same error.
from ublox.
There's two issues:
- When you read a message you should check for the ubx_class and ubx_id to make sure the message you read is indeed the one you're interested in. Not all messages have the same variables and it could be that you have multiple messages enabled at the same time.
- Secondly I forgot to say that I pass in an integer to the enable_message() function; I guess I should put a nicer check in those functions and do a possible conversion. But for now could you try?:
x.enable_message(1, 60)
from ublox.
Hmm sorry; seems that you're already sort of checking for the msgID..
I'm starting to think it might also be a race condition; could you add something like this:
import time
import serial
import ubx2
x = ubx2.UbxStream(serial.Serial(port='COM8', baudrate=19200, timeout=1))
time.sleep(5) # give the UbxStream object a second to instatiate itself; this involves sending a cfg message to setup the baudrate
x.enable_message(1, 60)
navigation_position = x.read()
print(navigation_position.relPosN)
from ublox.
Yes. I spent a lot of hours today with trying to solve the problem. I don’t remember correctly but maybe I tried the x.enable_message(1,60) and it didn’t work.
Should I edit the main script? Beacuse ‘3c’ is written to _ubx_NAV_RELPOSNED or not? There is another message type marked with ‘60’ something(__ubx_aopstatus)
from ublox.
Hi :) 3c in hex is 60 in decimal so we're still talking about the same message. I will try to do a conversion there as well; but for now try it with the 60.
The problem comes with the UbxStream instantization which sets the baudrate but doesn't check for the confirm message. Then you immediately enable a message and waits for the confirmation, which it gets because the first confirmation message to set the baudrate just arrived. Whatever you read then is probably either a ACK or NACK message which doesn't have either lat or relPosN attribute.
Or that's my working theory atm :p please add that sleep there to see if I'm not entirely incorrect. I'll add some of these things to the code to make it work better for future users as well. Thanks again for putting in the time btw :)
from ublox.
Alright. I am going to try tommorow what you said. I am so excited about it. I hope we solve it finally.:)
from ublox.
Unfortunately it didn't work. I think the problem is that the messages I get through serial port contains a lot of information or some kind of data which is useless for me and I can't filter them so when I try to read these I get an error. I send you some of my attempts to make this work and I send the result also.
FIRST:
CODE:
import serial
import time
import ubx2
x = ubx2.UbxStream(serial.Serial(port='COM9', baudrate=19200, timeout=1))
time.sleep(5) # give the UbxStream object a second to instatiate itself; this involves sending a cfg message to setup the baudrate
x.enable_message(1, 60)
navigation_position = x.read()
print(navigation_position.relPosN)
ANSWER:
Transmitting
06 00
Transmitting
06 01
Receiving
05 01
Acknowledged. CLS:0x6 ID:0x0
Receiving
27 00
Traceback (most recent call last):
print(navigation_position.relPosN)
AttributeError: 'UbxMessage' object has no attribute 'relPosN'
SECOND:`
CODE:
import serial
import time
import ubx2
x = ubx2.UbxStream(serial.Serial(port='COM9', baudrate=19200, timeout=1))
time.sleep(5) # give the UbxStream object a second to instatiate itself; this involves sending a cfg message to setup the baudrate
x.enable_message(1, 60)
navigation_position = x.read(reset=False)
print(navigation_position.relPosN)
ANSWER:
Transmitting
06 00
Transmitting
06 01
Receiving
05 01
Acknowledged. CLS:0x6 ID:0x0
Receiving
04 02
Traceback (most recent call last):
print(navigation_position.relPosN)
AttributeError: 'UbxMessage' object has no attribute 'relPosN'
THIRD:
CODE:
import serial
import time
import ubx2
x = ubx2.UbxStream(serial.Serial(port='COM9', baudrate=19200, timeout=1))
time.sleep(5) # give the UbxStream object a second to instatiate itself; this involves sending a cfg message to setup the baudrate
x.disable_NMEA()
x.enable_message(1, 60)
navigation_position = x.read(reset=False)
print(navigation_position.relPosN)
ANSWER:
Transmitting
06 00
Transmitting
06 01
Receiving
05 01
Acknowledged. CLS:0x6 ID:0x0
Transmitting
06 01
Receiving
04 02
Receiving
04 02
......(lot of 04 02 message)
Receiving
04 02
Receiving
04 02
Receiving
0a 11
Unsuported message class
I think the device or the software is not compatible with the libary you made. I can't even acces any message type at all.(e.g: lat or lon in th NAV_POSLLH can't be reached with x.enable_message(1,2) or the year from NAV_PVT with x.enable_message(1,7) )
So if you have any idea please tell me. :)
from ublox.
GOOD NEWS. I solved the problem. I can get every value of any class. This libary is awesome. I have problem with the drivers so after the reinstalling it the program worked perfectly.
I have one problem to solve but it is nothing compare to the previous's one.
from ublox.
Ah; that's good to hear :D What's the remaining issue?
P.s. I'll merge the code and try to add some of the things I mentioned earlier then. :)
from ublox.
The remaining issue is when the code runs down and I try to run it again I get an error (AttributeError: 'UbxMessage' object has no attribute 'relPosN'). The reason of the error is that somehow it disable the message-RELPOSNED and also set the protocol out an protocol in to UBX+NMEA. So every time I want to run get data via serial communication I have to set these protocol in to RTCM3 and protocol out to NONE.
from ublox.
Hmm, well about the UBX+NMEA, this is very much possible because the initialization of the UbxStream object also sets/overwrites the baudrate and inProtoMask / outProtoMask in a CFG-PRT message. It enables RTCM as well as the UBX+NMEA but not RTCM3. Here I have to bail on knowledge on the underlying systems though; this is meant for high precision corrections presented to the module through some sort of base station that sends these RTCM3 messages to it right? Or is your module supposed to be the base station sending the corrections?
Also I'm pretty sure these masks set which protocols you can communicate to/from the module with over that serial connection. As in; you're trying to disable the ubx protocol through u-center and then reading messages sent using the ubx protocol? I could misunderstand this though :)
In any case I can set the bitmasks more permissive (or give an option) to set these flags so that by default these are enabled as well if you're sure. :)
In the meantime are you also sure you don't have any other messages enabled? I would recommend a more secure read just in case that you have:
import serial
import ubx
def run():
x = ubx.UbxStream(serial.Serial(port="/dev/ttyUSB0", baudrate=9600,timeout=1))
x.disable_NMEA()
x.enable_message(1,2)
x.enable_message(1,60)
while True:
y = x.read(reset=False)
if y.ubx_class is '01' and y.ubx_id is '02':
print(y.lat) # Message lat not part of RELPOSNED and should work
#print(y.relPosN) # This should give an error
if y.ubx_class is '01' and y.ubx_id is '3c':
print(y.relPosN) # Message relPosN not part of POSLLH and should work
#print(y.lat) # This should give an error
if __name__ == '__main__':
run()
Let me know how it goes and good luck ^_^
from ublox.
Related Issues (8)
- Bug in a read function HOT 2
- RTK capability: (base-station) receive RTCM (1005, 1077 and 1087) corrections HOT 3
- Type Error NAV_PVT HOT 9
- Possible to read multiple messages? HOT 1
- Should disable_NMEA call take ~5min to complete ? HOT 2
- Code getting stuck trying to read ubx_id 2 HOT 3
- aproblem HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ublox.