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 @_JonMyer: 🚨Attention DeepRacer's including #UndergroundDeepRacer🚨 Check our our LIVE stream that including @IAM_dbro Take a few moments…
yesterday
DIY Robocars via Twitter
RT @chr1sa: The @DIYRobocars @donkey_car virtual AI car race is starting in 15 minutes! Watch it live on Twitch https://www.twitch.tv/mossmann3333 htt…
Aug 1
DIY Robocars via Twitter
RT @chr1sa: Don't miss our monthly @DIYRobocars @donkey_car virtual AI car race tomorrow at 10:00am PT live on Twitch. Head-to-head racing…
Jul 31
DIY Robocars via Twitter
RT @sparkfun: Our completed tutorial on building an @NVIDIA Jetson Nano-powered @Sphero RVR gets your bot up and running via teleoperation…
Jul 30
DIY Robocars via Twitter
RT @SmallpixelCar: Freeway test https://t.co/4V5tV9lhIP
Jul 29
DIY Robocars via Twitter
Very small autonomous cars racing, thanks to an overhead camera: https://control.ee.ethz.ch/research/team-projects/autonomous-rc-car-racing.html
Jul 29
DIY Robocars via Twitter
Jul 29
DIY Robocars via Twitter
Jul 29
DIY Robocars via Twitter
RT @chr1sa: Don't miss our virtual AI car race this Saturday! Real developers + virtual cars =🏎️🏎️🏎️ Head-to-head battles with thrills, sp…
Jul 28
DIY Robocars via Twitter
Jul 27
DIY Robocars via Twitter
RT @usashirou1: Jetson nano by Isaac Kaya #jetson https://t.co/Mu1N0CyQkN
Jul 23
DIY Robocars via Twitter
RT @GPUsolution: JetRacer mady by Iflytek company #JetsonNANO #Nvidia https://t.co/MimTymIwge
Jul 23
DIY Robocars via Twitter
RT @openmvcam: I love this: Mega or Mini? Image Classification on the 1MB OpenMV Cam H7 by Ish Ot Jr. in OpenMV, Edge Impulse, Internet of…
Jul 23
DIY Robocars via Twitter
RT @RoboticMasters: This is looking pretty good... but still needs a bit more refinement. Pure OpenCV Turning Sign Detection. No Tensorfl…
Jul 23
DIY Robocars via Twitter
Jul 23
DIY Robocars via Twitter
Jul 20
More…