Servers by jDrones

How does Arducopter deal with RTK data

(Thomas Demmer) #1


I’ve been looking around arducopter and RTK topics but I struggle to understand correctly how all of this works.
From what I understand, it is possible to inject RTK Data using MAVLink and GPS_INPUT. This seems to work because Mission Planner detects “RTK Fix”.
But what happens inside the arducopter code ? Does it have a specefic set of parameters for the EKF that are activated when recieving RTK data ?
Also, will it work if I only send accurate Longitude and Latitude information ? Or do I have to inject velocity and other information ?
And finaly, if I send altitude information while in RTK fix, will the drone use it automatically or do I also have to change some other parameters ?

If anyone could clear this up for me it would help me a lot !

Thank you all for your contributions,

Best regards

RTK GPS guided precision landing
Use external positioning system for higher accuracy
(Thomas Demmer) #2


I see i got no answers so far… Isn’t my question clear enough ? I’ll be glad to give more details if needed.
I’m especially curious in how the arducopter considers RTK altitude. Do I have to change the primary altitude source or is the fact that I have RTK fix enough for the drone to trust the GPS altitude ?

Thank you all.

Best regards

(Mike Boland) #3

I think your question is clear enough, and I for one, am lurking on the side lines awaiting an answer as well.

It would be good if @Michael_Oborne or anyone else could chime in with some pearls off knowledge to allow us mere mortals to understand what is going on.

(rrr6399) #4

Arducopter 3.4 supports RTK GPSes. Emlid has some instructions on settting it up:

You can choose to make the RTK GPS the primary GPS or the secondary backup GPS. Arducopter will decide which to use based on the quality of the fix as a first check and then the one with the greater number of satellites if the fix quality is the same. There is an off by one error with the RTK fix, at least for the Reach where a RTK Float Fix shows up as a DGPS Fix and the RTK Fixed Fix shows up as a RTK Float Fix, which can defeat the switch logic unless the RTK has more satellites. I think this is being fixed in 3.5.

Based on my experience with it so far, I’d make it a secondary GPS and get some experience with it in terms of steady RTK Float and RTK Fixed fixes. It can be sensitive to input parameters and such so you want to make sure its rock solid before allowing it to be used for navigation rather than just logging.

I’ve seen some great position and altitude data come out of the RTK depending on the input parameters and setup.

(Francisco Ferreira) #5

Hi everyone,

I’ll try to give some insights (although EKF is a big world and I don’t know everything about it):

  • EKF will use the speed, position and height accuracy provided by the GPS to know how trustworthy the reported information is
  • EKF will, by default, use the baro information for altitude. You can change the primary source for altitude using the EK2_ALT_SOURCE parameter
  • EKF can work without velocity information but it is highly recommended that your GPS provides the velocity information as that will increase the EKF prediction accuracy

(David) #6

Also need to consider what type of GPS data you are sending to the flight controller from the GPS reciever. NMEA data, for example, doesn’t include vertical velocity, which is information the EKF wants to refine it’s output. Most binary outputs send more data to the EFK, which makes it better suited for precise applications. Not all boards have binary outputs and not all vendors have binary GPS driver in the Ardupilot library.

(Thomas Demmer) #7


Wow, thank you all ! I didn’t expect so many answers in one night.

Ok, things are getting clearer.
I still have a question concerning the drone’s estimated position: I know that the EKF uses all its sensors information with different levels of trust to estimate its current position (the long, lat and alt information that can be found in the POS section of the logs)… correct me if I’m wrong by the way.
Now, if I switch from 3D fix to RTK fix will the EKF automatically allow more trust to the GPS information ? If so, I guess that the POS (long, lat) should be close the the GPS (long, lat). Am I right ?

Concerning altitude, I have thought of changing the EK2_ALT_SOURCE parameter but my fear is that if I loose the RTK fix the Altitude information is going to get quite bad and the copter might crash. Is there a way to configure the drone to only use the GPS as primary altitude source when in RTK fix and switch back to baro when not ?

Thank you all for your contribution and have a nice day.

(Muqing Cao) #8

Currently a page for RTK GPS inject in Mission Planner has been developed:

Which should show up if you load the latest MP. This is meant for the new RTK GPS Here+ developed by Hex Technology and ProfiCNC. I believe it can be used for other RTK bases as well.

Regarding the copter firmware, what I heard is development is ongoing to integrate the RTK accuracy into the EKF. Hope that helps.

(David) #9


Is this different than the GPS inject option found in the cntl f menu?

Looks identical, so I am assuming it just migrated to a more accessible place as RTK becomes my prevalent.

(Francisco Ferreira) #10

Like I said, it relies on the accuracy information provided by the GPS. Just having a flag saying it is RTK means nothing to the EKF.

No, not at this point.

Yes, it is the same. It was changed to the initial setup menu to be more accessible.

(David) #11


That’s what I thought. Thanks

(Thomas Demmer) #12


Thank you for those information.
I’ll dig deeper into the matter and if I find more stuff i’ll post it here.

(Debupt) #13

hi, Thomass. Really interesting topic.
Have you ever found more stuff? I’m really curious about how AC deal with more precise info from RTK GPS.

(Thomas Demmer) #14

Hi Debupt,

So far what I have understood is that there are different paramaters that are linked and that can play a role in a MAVLink RTK GPS. I only used the GPS_INPUT MAVLink messages.
First, the GPS Fix is only used when the drone chooses its best GPS. That means that if you have a really bad GPS but you say you have a high fix, the drone will only consider your GPS.
Also, it uses the data of only one GPS at the time. So if you have a GPS that provides only really accurate position and no velocity, the drone will do with no velocity, even if the other GPS provides velocity.

In the GPS input message, you can use flags to say which information you provide (only position, only velocity or both). You can also give the estimation of the accuracy of the different vertical and horizontal velocity and position. Note though, that the drone will use as minimum accuracy the accuracy provided in the full parameters list under the parameters EK2_VELNE_M_NSE, EK2_POSNE_M_NSE, EK2_VELD_M_NSE, EK2_POSD_M_NSE.

Anyway, using the GPS_INPUT message you should be able to provide accurate GPS information to the drone. Then starts the other work of proprely calibrating the PID and other parameters…

I hope it gives you some answers, it’s not really clear but I’ll try to answer more specefic questions :smiley:

Good luck with your projects,


(Debupt) #15

Really thanks for your reply.
Recently, I use gps_input mavlink msg to make a fake gps signal, in order to make drone loiter indoors. I guess you might do the similar work?
I set EK2_POSNE_M_NSE = 0.1 to make ekf trusts more about gps msg and horizontal_accuracy = 0.01. When in loiter mode, the drone can fix in one position with +/-10cm error, I want to get better result, so I consider maybe I can make a fake rtk gps signal to get more accuracy position info for pixhawk.

(Chobitsfan) #16

Hi @Debupt @Thomasss

Thank you very much for info
I set EK2_POSNE_M_NSE = 0.1 and archive more accurate RTL with ublox m8p.