GNSSNTRIPClient: Logger Initialization Fails in Thread + Difficulty Achieving RTK-FIX #128
-
|
Dear maintainers, I am currently working on a Scientific Initiation project that uses pygnssutils and pyubx2 to implement a Python-based NTRIP client which injects RTCM corrections into a u-blox GNSS receiver through a serial connection. I am facing two technical issues and would greatly appreciate any guidance or clarification.
When attempting to configure logging for the GNSSNTRIPClient running inside a dedicated thread (Windows, Python 3.11), I encounter the following error: AttributeError: 'NoneType' object has no attribute 'setLevel' This suggests that the logger instance returned inside the threaded context may be None.
The NTRIP connection is established successfully, and RTCM messages are being received and forwarded to the receiver’s serial port. However, the u-blox module remains in RTK-FLOAT or 3D-FIX, and does not converge to a stable RTK-FIX solution. My current configuration: Static IP, port, and mountpoint (RBMC – Brazil). ggamode=1 with fixed reference coordinates (reflat, reflon, refalt) provided to satisfy the caster’s position requirement. Output stream is directly connected to the serial port (output=serial_obj). Using the default parameters for ggainterval and other GNSSNTRIPClient settings. Is there any specific configuration detail — such as ggainterval, incorrect reference coordinates, or parameter interaction — that could be preventing the receiver from reaching RTK-FIX? Thank you very much for your time and for the excellent work on these tools — they are invaluable to the GNSS research community. Any help or insight would be sincerely appreciated. Additionally, I would like to share part of the code I am currently using. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Hi @Paulo-Junio (quick safety tip - please embed any Python code snippets in the body of your message, rather than providing *.py attachments)
Have a look at the set_logging method here: https://github.com/semuconsulting/pygnssutils/blob/main/src/pygnssutils/helpers.py#L134 For general guidance on using Python logging within Threads, refer to (for example): https://coderivers.org/blog/python-logging-in-threads/
Not an easy question to answer - there could be any number of reasons why you're not obtaining an RTK FIXED status which may for example be environmental or hardware/antenna related, rather than code issues. Have a look at this wiki in the first instance, which may offer some clues for further investigation: https://www.semuconsulting.com/gnsswiki/rtktips/ Couple of observations on your ggainterval=-1, # is this correct? this effectively disables GGA messages to the caster, so the following arguments are redundant
ggamode=1,
reflat=FIXED_LAT,
reflon=FIXED_LON,
refalt=FIXED_ALT,
refsep=FIXED_SEP, # <== don't forget the geoid separation argument (it will default to 0, but that may not be correct)
output=serial_obj, If your intention was to send GGA sentences to the caster, you need to set As an aside, have you considered using gnssstreamer here? As far as I can understand your intentions from the code snippet you've provided, it may do most of what you need out of the box e.g. https://github.com/semuconsulting/pygnssutils#5-serial-input-with-concurrent-ntrip-rtk-input-outputting-to-python-lambda-expression |
Beta Was this translation helpful? Give feedback.
-
|
Hello @semuadmin , I'm implementing a Python GNSS logger for a u-blox F9R (C10) receiver using the pyubx2 and pygnssutils libraries (specifically GNSSStreamer). My goal is to receive NTRIP corrections and log navigation and observation data. The issue I'm facing is that after initiating serial communication and sending the configuration messages (CFG-MSG), the GNSSStreamer is not triggering the outputhandler for the expected UBX messages (like NAV-PVT or RXM-RAWX). It seems the messages are either not being received or not being parsed by the streamer. ⚙️ Implementation DetailsMy script uses GNSSStreamer to manage the serial port (COM5) and the NTRIP connection. I send the CFG-MSG commands directly to the serial port before starting the streamer's thread.
Python Messages to be enabled on UART1 (Serial Port)messages_to_configure = [ for msg_class, msg_id, rate in messages_to_configure:
Python streamer = GNSSStreamer( streamer_thread = threading.Thread(target=streamer.run, daemon=True) ❓ The Current ProblemSerial Connection: The COM5 port is opened successfully. UBX Configuration: The configure_ublox(ser) command executes without any pyubx2 errors (the previous TypeError and UBXMessageError are resolved). Expected Output: After configuration, I should see log messages like "✅ Processando NAV-PVT!" (or equivalent) in the console, and the reported GNSS status should update. Actual Output: The program remains in the main loop, printing the static, uninitialized status (Lat/Lon 0.0, Sol: NO_FIX). The process_gnss_data callback is never called for any UBX messages, suggesting the streamer is not receiving or parsing the required data. I am not seeing any UBX data activity in the console. 💡 Hypotheses and QuestionsHypothesis 1 (Timing/Conflict): Could sending the CFG-MSG commands directly via ser.write() before starting the GNSSStreamer interfere with how the streamer initializes the port or its internal read buffer? Hypothesis 2 (Receiver Default): The u-blox C10/F9R often defaults to NMEA output on its primary ports. Is it possible my CFG-MSG commands are being ignored or overwritten, or are they enabling the messages on a different port than the one I'm reading from (COM5)? Question: What is the recommended method for configuring a u-blox receiver (like enabling UBX messages) when using the GNSSStreamer? Should the configuration messages be sent using the streamer's own internal methods, or is writing directly to the serial instance before calling streamer.run() acceptable? Any guidance on how to confirm that the receiver is actively transmitting UBX data on COM5 after the configuration, or any known issues with this sequence of operations, would be greatly appreciated. Thank you for your time and help! |
Beta Was this translation helpful? Give feedback.
Hi again @Paulo-Junio
If understand correctly, all you're trying to achieve here is:
This is a very common use case, and there are plenty of examples in the README for gnssstreamer, and also in the pyubx2 /examples folder, that illustrate exactly how to do this. I strongly recommend that you: