Use pymavlink to takeoff an arduplane in sitl

I know how to arm or disarm an arduplane in sitl,using a python script based on pymavlink.but how can i take it off ,just using the python code ,without mavproxy window command

You can update flight mode to TAKEOFF and arm the craft using pymavlink.

mode_id = mavlink_connection.mode_mapping()[mode_set]
# Set new mode
mavlink_connection.mav.set_mode_send(
mavlink_connection.target_system,
mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
mode_id)

1 Like

Thank you!By the way ,May I ask if you know how to simulate a Cessna aircraft in SITL? The default arduplane are as follows:ArduPlane: CRRCSim|calibration|firefly|gazebo-
zephyr|jsbsim|last_letter|plane|plane-3d|plane-
dspoilers|plane-elevon|plane-ice|plane-jet|plane-
soaring|plane-tailsitter|plane-
vtail|quadplane|quadplane-cl84|quadplane-
copter_tailsitter|quadplane-ice|quadplane-
tilthvec|quadplane-tilttri|quadplane-
tilttrivec|quadplane-tri|scrimmage-plane but there is no Cesna.