WARNING:dronekit:Link timeout (Gazebo Precisions Landing Script)


For some reason, gazebo_precision_landing.py is not working. I’ve checked all the script and even attempted to use the key and I continually get the WARNING:dronekit:Link timeout. Here’s the full error message:


WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/dronekit/mavlink.py”, line 211, in mavlink_thread_in
File “/usr/local/lib/python2.7/dist-packages/dronekit/init.py”, line 1371, in listener
APIException: No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File “/home/dronedojo/courseRoot/catkin_ws/src/gazebo_drone/scripts/gazebo_precision_landing.py”, line 20, in
vehicle = connect(‘udp:’,wait_ready=True)
File “/usr/local/lib/python2.7/dist-packages/dronekit/init.py”, line 3166, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File “/usr/local/lib/python2.7/dist-packages/dronekit/init.py”, line 2275, in initialize
raise APIException(‘Timeout in initializing connection.’)
dronekit.APIException: Timeout in initializing connection.


Fixed it…
changed upd to tcp in vehicle connect…


Hi @Pharns, glad you got your problem figured out! Did the precision landing work as expected after your timeout issue was resolved?

Also, that is strange that changing from udp to tcp appears to have solved your issue, as my environment is running with '‘udp:’ just fine without any dronekit timeouts.


The interesting part is I finally got it to work, but for some reason the drone doesn’t track the marker and lands about 3 meters to the left of target… I compared my script to the Key and it’s the same. I loaded the key script and it worked. So I’m guessing I did something wrong somewhere. But the scripts where identical. Have you ever used the JeVois Smart Machine Vision camera? I was thinking about using that instead of the PiCam on my build.



Hmmm, I’m wondering if the ArduCopter SITL drone isn’t loading with a rangefinder activated? If there is not rangefinder, the precision landing won’t work. This might explain why the scripts look exactly the same, but it was working in the Key VM. You can check this by typing the following in the MAVProxy terminal that you launch the ArduPilot SITL from:
param show RNGFND1_TYPE
If that parameter is 0 (for none), you can change it to 1 with:
param set RNGFND1_TYPE 1

If that doesn’t work, another thing we could do is analyze the dataflash logs of the SITL vehicle, just as we do with a real drone. From the same MAVProxy terminal, you would type:

log list

then download the last flight log by downloading the latest numbered flight log

log download <NUMBER> <NUMBER>.bin

Then you could pull that up in Mission Planner for further diagnosing.

As for the JeVios camera, I have not personally used it but I’ve heard good things about it. If my understanding of the JeVios is correct, it seems it would free up processing power of the RPi, allowing for higher res images in the scripts, translating into higher detectable altitudes for the marker. I’ll be interested to see your results if you end up going that route!


Thanks for your help… The interesting thing was there was no RNGFND1_TYPE when I looked at all the loaded parameters. I did notice RNGFND2_TYPE and I enabled that one and now everything works as expected. Do you have a clue why I’m missing the 1st rangefinder?

I’ll keep you posted on the JeVois camera. I already have it and I’m going to try and set it up instead of the PiCam.


Hmmm, that is very odd. I’m not really sure why that parameter would be completely missing? I don’t recall seeing that before. I’d imagine this is only a SITL related issue and won’t be seen on a real drone as well. Glad the RNGFND2_TYPE solved your issue though!

Please do, I’m pretty excited to see your JeVois results!