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

DIY Robocars via Twitter
RT @TinkerGen_: "The Tinkergen MARK ($199) is my new favorite starter robocar. It’s got everything — computer vision, deep learning, sensor…
Monday
DIY Robocars via Twitter
Monday
DIY Robocars via Twitter
RT @roboton_io: Join our FREE Sumo Competition 🤖🏆 👉 https://roboton.io/ranking/vsc2020 #sumo #robot #edtech #competition #games4ed https://t.co/WOx…
Nov 16
DIY Drones via Twitter
First impressions of Tinkergen MARK robocar https://ift.tt/36IeZHc
Nov 16
DIY Robocars via Twitter
Our review of the @TinkerGen_ MARK robocar, which is the best on the market right now https://diyrobocars.com/2020/11/15/first-impressions-of-tinkergen-mark-robocar/ https://t.co/ENIlU5SfZ2
Nov 15
DIY Robocars via Twitter
RT @Ingmar_Stapel: I have now explained the OpenBot project in great detail on my blog with 12 articles step by step. I hope you enjoy read…
Nov 15
DIY Robocars via Twitter
RT @DAVGtech: This is a must attend. Click the link, follow link to read the story, sign up. #chaos2020 #digitalconnection #digitalworld ht…
Nov 15
DIY Robocars via Twitter
RT @a1k0n: Got a new chassis for outdoor races (hobbyking Quantum Vandal) but I totally didn't expect that it might cause problems for my g…
Nov 11
DIY Drones via Twitter
First impressions of the Intel OpenBot https://ift.tt/36qkVV4
Nov 10
DIY Robocars via Twitter
Nov 9
DIY Robocars via Twitter
Excellent use of cardboard instead of 3D printing! https://twitter.com/Ingmar_Stapel/status/1324960595318333441
Nov 7
DIY Robocars via Twitter
RT @chr1sa: We've got a record 50 teams competing in this month's @DIYRobocars @donkey_car virtual AI car race. Starting today at 10:00am…
Nov 7
DIY Robocars via Twitter
Nov 6
DIY Robocars via Twitter
RT @a1k0n: Car's view, using a fisheye camera. The ceiling light tracking algorithm gave me some ideas to improve ConeSLAM, and having grou…
Nov 5
DIY Robocars via Twitter
RT @a1k0n: To get ground truth I measured the rug, found the pixel coordinates of its corners, calibrated my phone camera with my standard…
Nov 5
DIY Robocars via Twitter
RT @a1k0n: @DIYRobocars is back in December, but outside. Time to reinvestigate ConeSLAM! I rigged up a quick and dirty ground-truth captur…
Nov 5
More…