semuconsulting / pyubx2

Python library for parsing and generating UBX GPS/GNSS protocol messages.
BSD 3-Clause "New" or "Revised" License
161 stars 64 forks source link

Unable to increase the rate of navposecef stream from 1Hz to 4 Hz #81

Closed madyasha closed 2 years ago

madyasha commented 2 years ago

I am trying to read messages from the u-blox ZED-F9K receiver via serial communication using pyubx2. However, currently, the measurement update rate for various streams such as the navposecef stream is set to 1 Hz. Since my application involves high dynamics, I would like to increase the streaming rate to ideally 4 Hz or 20 Hz (the highest rate possible). I was able to do this in ucenter-2 but I would like to do it via serial communication. I tried setting higher rates than 1 Hz but the iTOW in messages still shows that we receive these measurements at 1 Hz.

semuadmin commented 2 years ago

Please post the FULL code you are using to set the measurement rate, along with examples of the serial output of your device BEFORE and AFTER you apply your code. Please also specify how you are physically connecting to the device (i.e. which serial port, baud rate). Thanks.

madyasha commented 2 years ago

I am using one of the example scripts, specifically, ubxsetrates.py. I am changing the RATE value here as shown. I tried baud rates of 9600 and 115200. The serial output from my device is exactly the same.

for (msgid, msgname) in UBX_MSGIDS.items(): if msgid[0] == 0x01: # NAV msg = UBXMessage( "CFG", "CFG-MSG", SET, msgClass=msgid[0], msgID=msgid[1], rateUART1=RATE, rateUSB=RATE, )

semuadmin commented 2 years ago

Hi @madyasha

OK so the code example you've used is to change the UBX Message Rate, not the Measurement Rate (aka Solution Interval). Also note that the default baud rate for ZED-F9K's UART1 and UART2 ports is 38,400 baud (not 9,600 or 115,200).

I strongly recommend you download and review the Interface and Integration specifications for your ZED-F9K device as these will explain the connection between Message Rate, Measurement Rate (aka Solution Interval) and Measurement Ratio - you need an understanding of all three to achieve what you're after.

https://content.u-blox.com/sites/default/files/LAP120_Interfacedescription_UBX-20046191.pdf https://content.u-blox.com/sites/default/files/ZED-F9K_Integrationmanual_UBX-20046189.pdf

To change the GNSS measurement rate/solution interval on a Generation 9+ u-blox device like the ZED-F9K, you need to use the CFG-VALSET command with a configuration database key of CFG_RATE_MEAS (0x30120001) - the setting is in milliseconds, so 1000 = 1Hz, 200 = 5Hz, etc.

The older CFG-RATE command should also work, but this is now deprecated.

pyubx2 fully supports all these commands and their various options - see the README for details.

If you have more general queries on configuration of UBX devices for RTK applications, I recommend you ask a question on the u-blox support forum:

https://portal.u-blox.com/s/

Hope this helps