Mavproxy Module Ntrip

Hello,

I have MavProxy running on a Raspberry Pi 3 as a companion computer to my ardupilot flight controller (Mrobotics Rev2). My Raspberry Pi 3 also has an internet connection. I want to use the Ntrip module to enable RTK via internet for my rover platform and not needing a local base station. I noticed rtk2go.com has free Ntrip Client connectivity so I wanted to connect to there. How are you able to get the Ntrip module to work in mavproxy? It’s been hard to find documentation or an example to go on. I loaded the module via command line module load ntrip but I am not sure what to do from there such as adding/pointing to the Ntrip service.

Thanks!

If the normal mavpxroxy ntrip module does not work for you you may want to try my mavproxy RTK injection module. It`s on a github PR. But you will need to compile it from source.

I am currently trying to use the normal mavproxy ntrip module with the following settings
HOLD> caster NTRIP.itsware.net
logfile None
mountpoint DETROIT_RTCM3-GG
password test
port 2101
username test

When I start the Ntrip Module I get the following when I type ntrip status
HOLD> ntrip status
HOLD> 1004: 3 (len 186)
1008: 1 (len 26)
1012: 3 (len 128)
1033: 1 (len 57)
1230: 1 (len 18)
ntrip: 9 packets, 67.0 bytes/sec last 0.3s ago framesize 415
ntrip status
HOLD> 1004: 10 (len 186)
1006: 2 (len 27)
1008: 2 (len 26)
1012: 10 (len 128)
1033: 2 (len 57)
1230: 2 (len 18)
ntrip: 28 packets, 145.6 bytes/sec last 0.1s ago framesize 442
ntrip status
HOLD> 1004: 20 (len 186)
1006: 4 (len 27)
1008: 4 (len 26)
1012: 20 (len 128)
1033: 4 (len 57)
1230: 4 (len 18)
ntrip: 56 packets, 263.1 bytes/sec last 0.6s ago framesize 442

What do these statuses mean and how do I know if my gps is now in RTK? If I keep checking Ntrip status the packets keep increasing (which I assume is good).
In QGroundControl the GPS Status only says 3D lock not rtk. Also the NTRIP public caster that I am connecting to is about 400 miles away. It is the closest, not sure if that is why it is not going into rtk mode.

@Christopher_Milner (tagging you in this as I have seen you have had success with the ntrip module in other posts) Thanks!

The status info gives you the the count of each RTCM message type received. If you wan to know what each one is you can look it up here: https://www.use-snip.com/kb/knowledge-base/rtcm-3-message-list/
I have high end, high gain antennas and I can get an rtk fix from base stations up to 100 miles away. I do notice an increase time to fix and less accuracy with distance. RTK requires that the base station and rover have visibility of the same satellites in order to calculate a solution. I do not think that 400 miles is useful baseline distance.

I am using this gps module https://store.mrobotics.io/ProductDetails.asp?ProductCode=mro-gps003-mr
I found a closer Ntrip base Station that is about 60mi away. However the GPS still is not going into a rtk fix mode. The best that I got was 3d DGPS lock. However, I can get a 3d DGPS lock without the correction data streaming from Mavproxy. Is there a way to check to see if the data is being sent to the GPS unit?

M8N modules do not support RTK. If you want to stick with an Mro product you would need the ZED-F9

Do you have a link for it? i would like to try it because ntrip module for me doesn’t work (it crashes after few minutes).

@brove I’m using ZED-F9Ps from sparkfun and ardusimple. I’m running ntrip and mavproxy on a companion computer (Raspberry Pi) that’s on my rover and directly connected to the autopilot. The companion computer is connected to the internet via a 4g/LTE USB modem. Connecting ntrip to the snip server at www.rtk2go.com. I set up my own base station that pushes corrections to the rtk2go server. It’s working very reliably. Once you upgrade to a GPS that supports RTK, let me know if you still have questions.

I finally got it working. Thank you. Do you happen to know how the RTCM corrections are being streamed to the flight controller? Meaning, are the corrections just passing through the flight controller and straight into the GPS or is the flight controller altering/formatting the data in some way before sending to the GPS?

If the RTCM messages are too large, MAVProxy breaks the messages up into multiple GPS_INJECT_DATA messages.

Aside from that, Ardurover passes the messages straight through.

GPS_INJECT_TO controls which GPS ardurover sends the corrections to.

Would you happen to know how to inject the RTCM messages directly into the RTK GPS? I posted more details on StackOverflow.

I am using the ntrip.py and rtcm3.py files from MAVProxy. I can run the ntrip.py file fine on my desktop and on a Raspberry PI and see the data packets coming in but I am not sure how to forward that data (or where in the script) to the GPS that is hooked up via serial port on the RPI

I use str2str from rtklib for this task. It has an ntrip client and can output to serial.

In my configuration, for my (fixed, stationary) base, I have an RPi connected to the Sparkfun ZED-F9P (ZED-F9P’s UART connected to the Pi’s USB port with a USB-to-serial converter). Then, I run str2str on the RPi and it collects the RTCM messages and forwards them to rtk2go’s ntrip caster (stream name is SandySpringMD in the table here http://www.rtk2go.com:2101/) - str2str has native ntrip support. Then on my rovers I use mavproxy’s ntrip module (ntrip client) to connect to the rtkgo server to source the RTCM data, and forward the data to the Ardurover software.

Excuse me and I wanted to ask a related topic… there is a part of the architecture that is not clear to me… I leave you my configuration, I have a rover with a pixhawk 6c, where I have connected a GPS RTK from the same manufacturer through port GPS1 In the telemetry port 1 I have a telemetry module connected to be able to connect from the laptop, in turn in the telemetry port 2 it is connected to a BeagleBone Black (BBB) to have a MapLink connection and this board connected by 4G to the internet, So from the internet I can send you missions and other things. The RTK data injection module, where I put them on the BBB board running as a service and send it to the Telemtria 2 connection or I have to put another exclusive connection by Telemtria 3 to the Pixhawk. I have noticed that using the str2str procedure blocks the connection that goes from the BBB to the pixhawk and I cannot send more commands to it. Or do I have to use the MAVproxy solution and ntrip service for the connection between pixhawk (telem2) and BBB, can I also send other mavlink2 commands through this same port?

Or the best solution is to have telem2 port for mavlink2 commands, and telem3 also connected to BBB for MAVProxy commands for NTRIP?

Let’s see if you can give me a cable or give me light !!

@jimovonz Could you point me in the right direction? I have:

RTK Base Station, raspberry Pi and ZED-F9P. This GPS has been configured to send correction messages (i.e. I ran survey in for a long time then set it up to broadcase correction messages). On this PC I’m using str2str to receive the correction messages over the serial port and send them to rtk2go.com (mount point SandySpringMD).

Then on my rovers, which are on the internet, I’m running mavproxy. I use the NTRIP module to connect to the ntrip caster at rtk2go.com and receive the corrections.

I want to take rtk2go out of the loop. They keep blocking my IP address because of my repeated connection attempts…

I think this should be simple. All of my computers (rtk base station and rover companion computers) are on the same vpn they can see each other’s IP addresses.

So: How can I set up mavproxy on each rover to get rtcm correction data from an rtk base station which is on its network? Can I run str2str on the base station computer and somehow use mavproxy to connect to the base station’s str2str and read the messages and inject them to the autopilot using mav?

Basically what’s an easy way to feed mavproxy rtcm corrections that doesn’t require the ntrip module?

There’s gotta be an easy solution here, I just can’t see it. Can you point me in the right direction??

Thanks

Hi Chris,

It has been a while since I have done anything with mavproxy - we have all our own in-house solutions now…

It definitely seems doable…in fact I vaguely recall doing just this…

After a quick refresher, I remember the issue I faced with this. If you have no NTRIP caster to connect to using the Mavproxy NTRIP module, then your only option is the DGPS module. Unfortunately, this module sets itself up as UDP server that you have to feed corrections to. I ended up re-writing the code to use TCP but there is a workaround.
On your RPi, you can use str2str to source the RTCM data directly from the serial port with the F9P on the other end and then act as a TCP server. Something like:

str2str -in serial://ttyUSB0:115200 -out tcpsvr://:2101

If you configure Mavproxy running on your companion computer to load the DGPS module, it will set up a local UDP server on port 13320.
You can run socat on the companion computer to connect to the TCP server on the RPi and also connect to the local UDP server running on Mavproxy and forward the data

socat TCP4:remote_RPi_host:2101 UDP4:127.0.0.1:13320

You will need to make sure that the RPi and Mavproxy are up and running before you run socat - this will ensure that socat can connect to live servers

For debugging, you can omit the “-out” parameter in the str2str command which will cause it to dump to the console. Because it is binary data, it will look like gobledegook. You can install the following:

sudo apt-get install gpsd gpsd-clients

This will give you the gpsdecode command. If you pipe the output of str2str to gpsdecode, you will better be able to see the messages being received. There is still a lot of binary data in the output but take note of the message types to confirm you are seeing the RTCM MSM messages you expect

str2str -in serial://ttyUSB0:115200 | gpsdecode

You can also do something similar on the companion PC side:

socat TCP4:remote_RPi_host:2101 - | gpsdecode

This should allow you to confirm that the data is getting to the vehicle.

Let me know how you get on!

2 Likes

Hi Chris.
l have a similar setup where l am running a base station on rtk2go.com
l have been trying connect my pixhawk with a raspberry p to get the correction to my controller to no avail. Do you perhaps have a step by step procedure l can follow.

You’re running mavproxy on the RPi, right? Connect the RPi to the Pixhawk with USB, then, start here

https://ardupilot.org/mavproxy/docs/getting_started/download_and_installation.html

to get mavproxy running on the RPi and talking to the pixhawk. Once you’ve got that running then read about the mavproxy module called ntrip. NTRIP Injection — MAVProxy documentation

This assumes the RPi has internet connectivity the entire time you’re running.

LMK how it goes

I used str2str on the RPI Base Station in tcpsvr mode like you recommended - thanks for that recommendation…

Then on each rover companion computer (raspberry Pi), I wrote a short python program which sources RTCM from the Base Station using tcpip (connects to the str2str server using regular tcpip socket) and forwards the RTCM to the Pixhawk+Ardurover using MAV by connecting to the mavproxy instance running on the companion computer and sending the rtcm data to it using mav message gps_rtcm_data_send - and mavproxy forwards that message to the pixhawk.

Because the rover companion computers are connecting to the internet using cellular modems, they don’t have a public IP address, so, the connectivity described above was only possible by having all of the computers on the same vpn, using openvpn.

This is working pretty well including robust when internet connectivity is dropped and recovered by the cellular modems.