Servers by jDrones

ArduPilot with Dual GPS (blended)


(rmackay9) #1

ArduPilot has supported Dual GPS for quite some time but it has always only been using one or the other GPS (whichever had higher number of satellites). Also for Copter users we recommended against using two GPSs because when we switched from one to the other, the EKF and controllers weren’t notified and we could end up with a sudden position jump.

In the upcoming Copter-3.5-rc2 (beta release) the sudden jump issues are resolved and we will also include GPS Blending meaning that the output from both GPSs will be combined together. The weighting of the two GPSs is determined by their reported accuracies (horizontal position, horizontal speed and (optionally) vertical position accuracy).

We recommend using two GPSs from the same manufacturer because the reported accuracies from different manufacturers might not be compatible leading to a non-optimal blend.

Setting up dual GPSs is fairly easy. Connect a second GPS to an available Serial port (like Serial 4/5) and then set these parameters:

  • SERIAL4_PROTOCOL = 5 (replace the “4” with “1” or “2” if the 2nd GPS is connected to Telem1 or 2)
  • GPS_TYPE2 = 1 (to enable automatic detection of the 2nd GPS)
  • GPS_AUTO_SWITCH = 2 (to enable Blending) or 1 to use the existing logic which uses only one GPS at a time

After your flights, if you want to see how it’s performed, you can open the DataFlash log in the Mission Planner and click the “Show Map” button and it shows the paths of the GPSs, the EKF’s estimated position and in the next beta it will even show the blended GPS’s output. If you’re using a different GCS you may be able to plot the GPS, GP2 and GPB (for Blended) messages.

This feature is compatible with RTK GPSs as well. Here’s a flight from Michael Oborne using a Here+ RTK GPS and a Tersus (note we recommend using two GPSs from the same manufacturer normally).

Here’s a related video from our recent developer un-conference in Canberra Australia. This is Paul Riseborough’s heavily loaded IRIS using Blended GPS, optical flow and a lidar range finder.

This feature was definitely a team effort with the GPS blending implemented by Paul, intensively peer reviewed by Michael duBreuil (our GPS maintainer) and Francisco Ferreira (our “bug master”), MP work by MichaelOborne and finally heavily tested by me and others… and the GPSs came from proficnc and mRobotics.

Blend GPS calculation
(Perth UAV - Sam) #2

Nice! Will GPS blending be implemented in Arduplane as well?

(rmackay9) #3


Yes, it’s in our shared AP_GPS library so it will go out with the next release of each vehicle. The only thing that’s extra special about Copter (and Sub) is that the position controllers have an extra handler to deal with the sudden position jump. Still, that’s less of an issue especially for Plane I think. Certainly all vehicles will benefit from the averaging and robustness improvements of having blended GPS.

(Perth UAV - Sam) #4

In our case we’re primarily using quadplanes, so the position controller issues might present themselves in hover? I would have thought that position change in plane would result in a somewhat erratic flight path as well. What sort of position variance is typically observed in flight between the GPS? In our use case the main reason for having two GPS units is for redundancy, so will there be a configurable parameter for setup?

(chuckntaylor) #5

Wonderful stuff! Thank you to the development team for all the hard work.

(Francisco Ferreira) #6

Without knowing quadplane code very well, I think you are covered in that case. It’s the flying wing code that doesn’t check if EKF have done a position reset.

(rmackay9) #7

I’ve just checked and the quadplane doesn indeed include the position reset code. Quadplanes make use of the multicopter attitude and position controllers so there was no extra effort required.
One related thing that appears to be missing from quadplane is the yaw reset code. I would imagine this would mean that quadplanes yaw would turn after once or twice after takeoff as they climb past 2m in altitude.
This is unrelated to the Dual GPS changes though.

(Perth UAV - Sam) #8

Thx for checking Randy. (I’m assuming it is included)
Also thx for the heads-up with the yaw reset code I’ll keep an eye out for any issues.

Is it possible to bias the blend towards one GPS over another? In our case a Reach RTK GPS?

(rmackay9) #9

There’s no config to force it to favour one over the other but the weighting is based on the reported accuracy from the GPSs. Normally that’ll mean it’ll use the RTK more than the non-RTK GPS. By the way, if you’re just looking to use it as a fallback you could stick with the existing “UseBest” logic by leaving GPS_AUTO_SWITCH to 1. Even this method is improved in AC3.5-rc2 because the position jumps should be handled properly now (you’ll probably still see a slight twitch but hopefully nothing significant).

(Perth UAV - Sam) #10

Many thx for the feedback Randy.
(BTW, I know it’s confusing, but my name is actually Sam, the gmail handle is jeffbloggs)

(Tryggvi Stefánsson ) #11

This is awesome! Thanks for implementing this. When blending the GPS there is of course the benefit of redundancy can we expect more accurate position with this method as well or some other benefits?

(Perth UAV - Sam) #12

I doubt weather averaging two GPS positions will result in better accuracy, for that you’d need to know which one is actually the one with the most error. I think the main benefit beyond redundancy is that it is possible to use both GPS modules at the same time, without the position jumping from one to the other in flight. (at least in copter for now)

(gmorph) #13

The EKF does calculate the error in each GPS. But yes the best benefit is it doesn’t jump around when switching from one to the other.

Thanks, Grant.

(rmackay9) #14

Sorry, I missed the extra posts here.

Actually the additional GPS, when blended, does improve accuracy a bit. I can’t give the mathematical proof of why that is but it’s a real and expected improvement.

(Perth UAV - Sam) #15

Hmm I wonder why that is. Is it because there’s a higher liklihood that the aircraft location is between the two GPS positions rather than outside of them? What was the accuracy verified with? Also what is the typical variance between the two GPS units? I’m assuming that is typically only within a few meters of eachother to start with? Would be interesting to know if that effect could be intentionally improved.

(rmackay9) #16


sorry, I don’t know the answers. Here’s Paul’s original PR which may provide some clues: It’s also possible that I have misunderstood things. Maybe it’s because it weights the solution towards the better of the two GPSs so because one is likely always better than the other, overall we get a better result.
Paul Riseborough would know best.

(Perth UAV - Sam) #17

Yeah ok that might be. I’ll have a look at the links. Thx.

(Andresiko) #18

Hi all, is this GPS blending feature included in the rover firmware update? Thanks!

(rmackay9) #19

Sorry for the slow reply, missed the email reminder somehow.
Yes, this is included in the next Rover release.

(gmorph) #20

Hi Andresiko. This feature is available in the Rover Beta if you wanted to install that on your vehicle.

Thanks, Grant.