GPS RTCM data not recognized by F9P chip/u-center

Hello,

I`m trying to receive to use a Pixhawk together with a simpleRTK2B board and an online NTRIP service. My plan is to receive the NTRIP data on a companion computer and send the RTCM data via MAVSDK to the Pixhawk. The Pixhawk should then send the data automatically to the simpleRTK2B’s F9P chip and thereby create an RTK fix.

My current setup is using the NTRIP client from MAVProxy and I convert the rtcm data as described here.

from ntrip import NtripClient
import sys
import asyncio
from mavsdk import System
from mavsdk.rtk import RtcmData
from pyrtcm import RTCMReader

async def send_to_px4(raw_rtcm_data):
    msg = RTCMReader.parse(raw_rtcm_data)
    print(msg.identity)
   
    drone = System(mavsdk_server_address='localhost', port=50051)
    await drone.connect()
    await drone.rtk.send_rtcm_data(RtcmData(str(raw_rtcm_data)))

if __name__ == '__main__':
    n = NtripClient( user="username",
                     port=2101,
                     caster="casterip",
                     mountpoint="mountpoint",
                     lat=48,
                     lon=12,
                     height=0,
                    );

    for raw_rtcm_data in n.readLoop():
        asyncio.run(send_to_px4(raw_rtcm_data))

I changed this line in the NTRIP client to yield return the data instead of printing it.

    def readLoop(self):
        while True:
            data = self.read()
            if data is None:
                continue
            else:
                yield data

The RTCM data is received by the Pixhawk and forwarded to the simpleRTK which I can see by connecting to the simpleRTK via u-center, however the data can`t be parsed and is labeled as unknown.
ucenter-unknown

Now it could be that I somehow misconfigured the simpleRTK board, but to find that out I was trying to follow the RTCM data and see if it gets mixed up somewhere.
My first step was to look at the gps_inject_data message using QGroundControl`s MAVLink Console. When viewing the data there, I was not able to find any relation between the data I sent to the PixHawk and the data printed out there.


The data i sent started with 211, 0, … and I found no match somewhere in the array.

Now my question is if I am parsing the data correctly and if the way I check the data is even correct. I would also be interested what the “flags” parameter in the message means exactly as this was the only thing changing at some times.

Please let me know if you need any further data or description of what I tried so far as I might have forgotten something.

Greetings,
Andy

Did you manage it to get to work, I have similar issues, the rtk fix just doesn’t happen. send_rtcm_data is not complaining anything, data goes to PX4 but nothing happens

I wonder if RtcmData(str(raw_rtcm_data)) is the right approach. Shouldn’t it be bytes instead of str?

Hello
This problem seems to persist. I send the correct RTCM data (as string, as it is suggested here
Data I send start with [211, 0, 123, 67, …
Data I observe at the mavlink console with

nsh> listener gps_inject_data

appear somehow random and hence the the gps fix_type remains at 3 and never reaches 6. With QGroundControl in contrast, it works perfectly.

Any suggestions on how to use the

await drone.rtk.send_rtcm_data(rtk.RtcmData(str(rtcm_correction_data)))

function properly?
Thanks
Marc

Maybe it helps if some more information is provided:

MAVSKD Version is 2.8.1
I use some test data to send to the drone:

rtcm_correction_data = bytes([0x7f, 0x0, 0x0, 0x0, 0x0])

I send the data with:

await drone.rtk.send_rtcm_data(rtk.RtcmData(str(rtcm_correction_data,‘latin-1’)))

At the console, I enter the command

pxh> listener gps_inject_data

and get the data that arrived at the drone: [127, 0, 0, …, 0], as it should be.
However, for larger numbers it behaves differently, i.e., for

rtcm_correction_data = bytes([0x80, 0x0, 0x0, 0x0, 0x0])

The data arriving at the drone is [194, 128, 0, 0, …, 0] instead of [128, 0, 0, …, 0]
So obviously I still haven’t found out how this rtk correction data is being handled and how I have to provide it. Any hint is appreciated, thanks.