Autonomous takeoff without using take off mode

As you know, in mission planerda you need to arm the drone first for takeoff and then takeof, but I want to take off directly without using the “take off” mode.How do I get this done? What should be the code I’m going to write on Dronekit?

Use guided mode and issue a takeoff command. That way no need for takeoff mode.

I don’t quite understand what you’re saying. Would you please give me a little more detail?

Using dronekit:
https://dronekit-python.readthedocs.io/en/latest/guide/taking_off.html

But if you want to do it by hand:

  1. Use the “MAV_CMD_DO_SET_MODE” mavlink command to set the mode to “GUIDED” see https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_MODE
  2. Arm the copter
  3. Use the MAV_CMD_NAV_TAKEOFF mavlink command to takeoff