Python with Rovers (swarming w/ delay)

Hi,

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:

MissionPlanner.Utilities.Locationwp.lat.SetValue(item,float_lat)
MissionPlanner.Utilities.Locationwp.lng.SetValue(item,float_lng)
MissionPlanner.Utilities.Locationwp.alt.SetValue(item,float_alt)

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?

Thanks!

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

Join diydrones

Email me when people reply –

Replies

  • 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.

Activity