ArduCopter and Dronekit-sitl: mode changes to RTL when taking off

Hi everyone!

I am a new user of ardupilot and dronekit. I am trying to automate a simulation of a mission using ArduCopter.

what I did is, in a python file, use dronekit-sitl, and follow the direction here (use the method arm_and_takeoff()): http://python.dronekit.io/guide/taking_off.html

But instead of TCP port 5760, I use UDP to build up the connection: vehicle = connect(‘tcp:127.0.0.1:14550’, wait_ready=True). Because the TCP port never works for me.

However, every time when I call arm_and_takeoff(), the mode of the copter will always change from GUIDED to RTL at some point, and thus it never takes off.

Does anyone know what is going on please? Any help will be appreciated!

Thank you!

Probably it is triggering a failsafe, and therefore changing mode to RTL
Check your failsafe parameters