RTK without mavlink via GPS2 port

Hi!

I have a rover using a purple cube and a Here4 GPS via CAN. All is working great. I’ve established NTRIP (my own mountpoint) using Mission Planner - all great.

I now have a LoraSerial telemetry module solely for RTCM packets coming from my base (SparkFun RTK Express Kit) into pixhawk UART4 (Serial3/GPS2). I can confirm I am receiving RTCM packets because SERIAL_PASS1 and _PASS2 correctly bridge the RTCM to my workstation and I can even use MP COM port to establish RTK incoming info.

How do I get the pixhawk to use RTCM from UART4 and inject into GPS on CAN bus? I dont want to have to wrap them with mavlink first - I believe SERIAL3_TYPE = 5 should work for a GPS feeding only RTCM as the base?

1 Like

im in a similar position, If that works it would simplify my setup a lot, I was about to try and write something to convert it to mavlink.

@Yuri_Rage any thoughts on this?

I don’t think we support this. But I think we should (probably as an additional bit in GPS_DRV_OPTIONS). @tridge?

1 Like

Is the part that’s not supported the RTCM → UART → CAN path … Or is it just taking raw RTCM packets and passing them directly other than them coming in the GPS_RTCM_DATA path?

I can test.

Thx!

I’m fairly certain we don’t support raw RTCM on a serial port. But I don’t see why we couldn’t or shouldn’t.

There is nothing blocking the injection path to any RTK-capable module, and the MavLink methods for injection would apply almost equally (other than reconstructing the RTCM3 messages, since they’d be intact upon arrival).

I was thinking bit 6 in GPS_DRV_OPTIONS would already do this - what’s does bit 6 do now?

It enables the RTCM3 parser for MavLink. A brief code review shows that the intent is to allow redundant RTCM3 sources and reconcile duplicate messages. Enabling it all the time (even for a single telemetry channel) would ostensibly avoid garbled messages arriving at the GPS.

In any case, the parsing options apply to MavLink telemetry channels.

Mind you, I didn’t write this portion of the code, but I think I’ve deduced the intent correctly.

I know eventually a raw serial RTCM3 parser will be included into ardupilot - but I couldn’t wait. Here is a project I made using an ESP32 to take the stream from the ublox (in my Sparkfun RTK Express kit) and wrap it in mavlink packets.

Its rough code - but works great.

https://github.com/SamObde/RTCM2MavLink/blob/main/src/main.cpp

I have it working now on my base. It takes the raw RTCM output from my SparkFun RTK radio port, wraps it into mavlink GPS_RTCM_DATA packets and sends them along on another UART across my LoraSerial radio straight into the pixhawk cube. Amazing - I can finally just fire up the ardurover and start driving knowing that RTK Fixed is just going to happen on its own.

If anyone wants to help clean up or extend the code feel free. I started a github for it.

2 Likes

That is very cool, I was seriously looking at doing something similar. I was trying to get it form RTK2go into ardupilot via a 4g modem, I found some esp32 code that could get the rtcm data from rtk2go and output it on the serial port but there wasnt a good way of feeding that into ardupilot until your program, so I have ordered some esp32 c3 boards and for testing I’m just going to stack them with this feeding the rtcm into the second esp32 that feeds it into the pixhawk via mavlink, I will have a go at merging them at some point.

I got your mavlink adapter working with this esp32 RTCM client


I just stacked a pair of C3 zero boards so one is getting RTCM from RTK2GO over wifi then feeding that into your RTCM to Mavlink adapter. i will try and combine them next now i have it working.

I have combined them in arduino so its just a single esp32C3

Excellent!

What 4G modem are you using with success?

Its a ZTE MF971VS, it’s one of the few that come with extenal antennas.
image

I have just been testing it with qgound control to look at the output and it looked ok but now i have it setup with a rover it doesn’t look right, its coming through as RTCM but I don’t think it’s valid data. The raw RTCM that I’m getting is working and I can send that into mission planner with serial, and it works like I was connected to the ntrip server directly. I think there is some extra data getting in somewhere and it’s causing your adapter to parse it incorrectly. I thought it was something wrong with the way I copied them together but when I rebuilt the separate boards with unmodified code the output was the same.

If you use the mavlink inspector in mission planner does it show up as a feed?

yes, it shows up as a RTCM feed on but the flight controller doesnt accept it, im not sure why.

il get some screenshots to show you.

you can see that mission planner accepts the ntrip ok and sends it over mavlink but when you compare it to what your adapter is sending its very different. the only thing i have changed in the code is setting the baudrate to 115200 rather than 57600 but i don’t see how that could make any difference?