Python with Rovers (swarming w/ delay)


I wrote a script with Python to run with rovers on Mission Planner.  The function of the script is essentially the same function as the Swarm application available from the Ctrl+F command on Mission Planner.  There are two vehicles involved, a leader and a follower.  I wrote a script for each vehicle so the leader can send coordinates and parameters and the follower can receiver them and interpret them into waypoints.  Since I'm using two scripts, I run the scripts on two instances of Mission Planner.  The Mission Planner instances can run on the same computer or on separate computers (I've tried both, but an IP address must be in the code if using separate computers).  

To set the waypoints on the follower script using Python, I use these three lines to set the lat, long, and alt for the waypoint:,float_lat)

My script works and does what I want it to.  However, the problem I'm having is there is a 4-5 second delay from when the leader script sends the coordinates/parameters to the follower, and the follower receives them.  No matter how fast I set the leader script to send or transmit, the follower script still maintains a 4-5 second delay.  I've narrowed the problem down to the altitude line.  As soon as I commented this out, the follower script ran instantaneously.  However, then the follower vehicle wouldn't follow the leader.  In fact, it didn't move at all.  My guess is the rover vehicle needs to have all three waypoint parameters set before it can execute a waypoint.  This doesn't make much sense because the rover is on the ground, but it seems to be necessary.  I've even tried setting arbitrary values to the altitude and all had the same delay except when I set it to 0.  But when setting it to 0, the follower didn't move again.

So does anyone know of a way to limit this follower delay or negate it in any way, while still maintaining the desired function?


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

Join diydrones

Email me when people reply –


  • To clarify, it looks like if any one of those 3 lines of code is commented out, then the delay goes away.  Therefore, I'm pretty sure it's not only the altitude line of code.  I'm thinking that when all 3 values are set, the delay comes from Mission Planner setting the waypoint for the vehicle.  There is no delay if only 1 or 2 of the 3 lines are used, because Mission Planner is not creating the waypoint due to missing parameters.

    Still, does anyone know of a way to reduce this lag?

    • I meet this problem too, did you work out it?

This reply was deleted.


Liam left a comment on Agricultural UAVs
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
Jun 30
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Jun 29
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Jun 29