I have been trying to inject raw UBX data which I gather from UBXReader library into my Pixhawk. For this, I use a GPS module to extract UBX data and a serial to USB converter to stream data into my Pixhawk. Here is what my setup looks like:
Using my other USB port, I gather GPS data and try to stream it into pixhawk as seen above. For this task, I use python.
from serial import Serial
from pyubx2 import UBXReader
stream = Serial('/dev/ttyUSB0', 38400, timeout=3)
stream2 = Serial('/dev/ttyUSB1', 38400, timeout=3)
while 1:
ubr = UBXReader(stream)
(raw_data, parsed_data) = ubr.read()
output = parsed_data.serialize()
stream2.write(output)
From MAVLink, I can see location and altitude data but I fail to stream HDOP and VDOP messages into my Pixhawk. What might be causing this and how should I proceed on fixing it?
You need to ensure your external GPS is outputting the requisite UBX message types - not all UBX messages contain hDOP or vDOP data. For example:
The NAV-PVT message contains lat, lon and pDOP but not vDOP or hDOP.
The NAV-DOP message contains hDOP and vDOP but not lat or lon.
So you may need to enable the NAV-DOP message on your external GPS using uCenter or PyGPSClient.