ArduPilot formation flying revisited

Further to our first attempts at fully automated formation flying (see, Phil ( with his rebuilt Valdez (v2) and I headed out to try again.

Most of the flights were really good with the two planes following the route (and each other) very well. The turns especially were almost mirror images of each other and watching the two planes from the ground flying in almost perfect formation was amazing.

The first afternoon was really calm and this benefited both planes a lot. Each flight lasted around 25 minutes.

On the first day we tried a triangular course with waypoints around 700m (2300ft) apart but on the second day the course was set rectangular with the long legs around 1200m (3930ft) apart. The wind however had picked up a bit and was a bit lumpy with thermals starting to build.

We took about 2 hours of onboard video with a Mobius camera and a bit of ground video, but due to the wide-ish angle of the Mobius' lens the lead plane was often quite small although they looked really close at times both from the ground and from the FPV video setup on my plane.

All went very well until... not unexpectedly - a midair collision!

See the video for details.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Maybe this video can make it more clear: 

  • Moderator

    You lost me right after "some ideas:..". :)

    Not sure when or if I'll ever try this again but thanks for the input, maybe someone can use it.

  • Great video, thank you for sharing. I think the best idea for swarming should be using dronekit. The python scripts needed can run on the ground computer (GCS) of the follower. Here are some ideas:



    plane = connect(args.connect, wait_ready=True)

    quad1 = connect(args.connect, wait_ready=True)

    def point2(v1,v2):
      R = 6371000; # metres
      dtr = np.pi/180.; # degrees to rad
      fi1 =*dtr;
      fi2 =*dtr;
      ld1 = v1.location.global_relative_frame.lon*dtr;
      ld2 = v2.location.global_relative_frame.lon*dtr;
      dfi = fi2-fi1;
      dld = ld2-ld1;
      fim = (fi1+fi2)/2.;
      x = dld*np.cos(fim);
      y = dfi;
      d = np.sqrt(x*x+y*y)*R;
      x = np.cos(fi1)*np.sin(fi2)-np.sin(fi1)*np.cos(fi2)*np.cos(dld);
      y = np.sin(dld)*np.cos(fi2);
      brng = np.arctan2(y,x);
      p2 = LocationGlobalRelative(fi2/dtr, ld2/dtr, 50);
      if d >= 30:
        p2_lat = fi2-d*np.cos(brng)/R;
        p2_lon = ld2-d*np.sin(brng)/R;
        p2 = LocationGlobalRelative(p2_lat/dtr, p2_lon/dtr, 50)
      return p2


    print "Start tracking ..."
    while True:
        pct1 = point2(plane,quad1);
        print "Quad1 going towards point :",,pct1.lon

    It is better first to test it at home using SITLs

    Let me know when you will try it for real!

  • Hi,
    I am also trying to fly quadcopters(more than two) in certain formation  (without using SWARM or FOLLOW ME).
    Can you tell me, How can i get real time GPS location of flying copter?
    I mean, where (in which parameter) does ardupilot codebase store GPS location to show on Mission Planner(or any other GCS) ?
    Can i extract GPS location from Telemetry Logs periodically (Like in every 2 second)?

    Any help would be much appreciated

    Thank you

  • Moderator

    No idea, we'll attempt it on our next outing to see if it functions for fixed wing.

  • 100KM

    Graham, the Swarming wiki appears to be written for MR. Do you know if there is any reason it would not work for fixed wing? I wonder what the update frequency is for the "leader's" position and subsequent followers' guidance corrections.

  • Hi Graham, that was great, at the Vaal, nogal. Thanks for sharing, great video.

  • Moderator

    @Gagarien, yes, north eastern edge of the Vaal Dam.

  • @Graham: Sweet, I didn't know this feature existed already!

  • Moderator

     Thanks guys, it was quite a bit of fun. @Trung we're using two laptops and two telemetry radio's on 433MHz but with different ID's and there does not appear to be any interference.

    @Martin: there is the little known 'swarm' function but we haven't tried that yet (

This reply was deleted.