MAV_CMD_NAV_TAKEOFF command can not take off

Hello,I have a question about using the MAV_CMD_NAV_TAKEOFF command in the mavlink_command_long format in the MAVLink protocol to maneuver the quadcopter in the simulator to take off, before this command I have changed the GUIDED mode, and successfully executed the ARM DISARM, and after I executed the ’ TAKEOFF’ command the console shows Got COMMAND_ACK: NAV_TAKEOFF: ACCEPTED but unfortunately the drone did not leave the ground. May I ask why this happens?
This is my C code snippet using MAVLink C library:

int auto_take_off( int altitude)
{
// Prepare command for Take-off
mavlink_command_long_t com = { 0 };
com.target_system = system_id;
com.target_component = autopilot_id;
com.command = MAV_CMD_NAV_TAKEOFF;
com.param7 = altitude;
}

You may want to refer to this example, did you check arm successfully, are you using this library package?

The takeoff_land example in mavsdk also doesn’t perfectly make the copter in sitl take off and is in C++, I want to reproduce the example in C. I’m sure that I receive in console
“Got COMMAND_ACK: COMPONENT_ARM_DISARM: ACCEPTED
AP: Arming motors
ARMED”
I quoted the ‘common.h’ library that generates C using the MAVLink tool.

Oh I see, you are using simulator. Do you think it is not supported?

ArduPilot provides a native firmware simulator + FDM program (all launched by sim_vehicle.py), often simply referred to as SITL, which is usually used with its developer GCS, MAVProxy.

Curious why you do it over simulator and not a real UA where they are already available GCS.

Well, since my development environment doesn’t allow me to debug a program based on controlling drone flight on an on-board computer on a real copter, I had to use a simulator to debug my control program, and I wanted to control the copter flight using a MAVLink-based C program

Some available solutions for your consideration:

  1. Mavsdk-python + Pi4B
  2. Mavsdk-python + Jetson Orin NX
  3. Phone on drone + cloud remote control
  4. Mavros + Pi or Jetson
  5. Dronekit + Pi or Jetson Nano (not recommended)

Which companion computer are you looking at?
Nowadays many libraries build on python, C survive maybe for very low level device driver.