Trouble running custom scripts with SITL

Hey guys!

I’m currently creating custom scripts for a project and I want to use SITL to test them. I’m currently using DroneKit and SITL with QGroundControl. The goal was/is to run Python scripts utilizing DroneKit to interact with the SITL drone.

Issue Summary: When running, MAVProxy starts with the default configuration:

  • --out
  • --master tcp:
  • --sitl
  • --out

My DroneKit script is set to connect to However, upon execution, I’m getting a timeout error, specifically: dronekit.TimeoutError: wait_ready experienced a timeout after 30 seconds..

QGroundControl also disconnects from SITL whenever I initiate my dronekit script.

Steps Taken:

  1. Ensured is running (QGroundControl visualizes the drone) before initiating the script.
  2. Confirmed no other applications/scripts are trying to connect to port 14551.
  3. Tried connecting the script to (after closing QGC) with the same issue persisting.
  4. Checked for any firewall or security software that might block the ports - none found.

Would anyone be able to provide guidance on how to resolve this issue? Are there any nuances that I should be aware of?

Thank you.

Try setting the timeout parameter in your connect method to something much higher than the default 30 seconds.

newdrone.connect(ip=‘tcp:’, timeout=240, wait_ready=True)

The issue seems to be caused by the calibration of the sitl drone taking too long and therefore the parameter list never actually gets sent before the timeout. You can show that this is the case by doing one of a couple of things. Change wait_ready=False. Your drone will function but will not be stable or be able to parse a GPS position because it took off before the information was received. Or, you can customise the data in the wait_ready parameter like wait_ready=[‘system_status’, ‘gps_0’, ‘armed’, ‘parameter’]. I found when I left out the ‘parameter’ option out, the drone would fly but was unstable as well, whilst all the other data would come through before a timeout.

1 Like