Using gazebo to simulate the drone does not take off

Ubuntu:20.04
PX4:1.12.3
gazebo:11.15.1
I tested gazebo after compiling the PX4 source code. After entering ‘roslaunch px4 posix_sitl.launch’ in the terminal, the terminal displayed the following:

ning@ning-Legion-Y7000P-IRX9:~$ roslaunch px4 posix_sitl.launch
… logging to /home/ning/.ros/log/e6d49bbe-0589-11f0-8326-81469bc50aea/roslaunch-ning-Legion-Y7000P-IRX9-14383.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ning-Legion-Y7000P-IRX9:40077/

SUMMARY
========

PARAMETERS

    • /gazebo/enable_ros_network: True*
    • /rosdistro: noetic*
    • /rosversion: 1.17.0*
    • /use_sim_time: True*

NODES

  • /*
  • gazebo (gazebo_ros/gzserver)*
  • gazebo_gui (gazebo_ros/gzclient)*
  • sitl (px4/px4)*
  • vehicle_spawn_ning_Legion_Y7000P_IRX9_14383_6746860904521503477 (gazebo_ros/spawn_model)*

auto-starting new master
process[master]: started with pid [14391]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to e6d49bbe-0589-11f0-8326-81469bc50aea
process[rosout-1]: started with pid [14401]
started core service [/rosout]
process[sitl-2]: started with pid [14408]
INFO [px4] Creating symlink /home/ning/mypx4/Firmware/build/px4_sitl_default/etc → /home/ning/.ros/etc

______ __ __ ___
| ___ \ \ \ / / / |
| |_/ / \ V / / /| |
| __/ / \ / /_| |
| | / /^\ \ ___ |
_| / / |_/

px4 starting.

INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
process[gazebo-3]: started with pid [14420]
Info: found model autostart file as SYS_AUTOSTART=10016
INFO [param] selected parameter default file eeprom/parameters_10016
process[gazebo_gui-4]: started with pid [14429]
INFO [parameters] BSON document size 444 bytes, decoded 444 bytes
[param] Loaded: eeprom/parameters_10016
process[vehicle_spawn_ning_Legion_Y7000P_IRX9_14383_6746860904521503477-5]: started with pid [14438]
INFO [dataman] Unknown restart, data manager file ‘./dataman’ size is 11798680 bytes
PX4 SIM HOST: localhost
INFO [simulator] Waiting for simulator to accept connection on TCP port 4560
[INFO] [1742475029.674580, 0.000000]: Loading model XML from file /home/ning/mypx4/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
[INFO] [1742475029.676681, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[ INFO] [1742475029.711734172]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1742475029.712633573]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting…
[ INFO] [1742475029.753255168]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1742475029.754174168]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting…
[ INFO] [1742475029.978453551, 0.004000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[INFO] [1742475029.980987, 0.000000]: Calling service /gazebo/spawn_sdf_model
Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
[INFO] [1742475030.231158, 0.184000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1742475030.234420864, 0.184000000]: Physics dynamic reconfigure ready.
INFO [simulator] Simulator connected on TCP port 4560.
INFO [commander] LED: open /dev/led0 failed (22)
INFO [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0
INFO [ekf2] starting instance 0, IMU:0 (1310988), MAG:0 (197388)
INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO [ekf2] starting instance 1, IMU:1 (1310996), MAG:0 (197388)
INFO [ekf2] starting instance 2, IMU:2 (1311004), MAG:0 (197388)
INFO [ekf2] starting instance 3, IMU:0 (1310988), MAG:1 (197644)
INFO [ekf2] starting instance 4, IMU:1 (1310996), MAG:1 (197644)
INFO [ekf2] starting instance 5, IMU:2 (1311004), MAG:1 (197644)
INFO [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280
INFO [logger] logger started (mode=all)
INFO [logger] Start file log (type: full)
INFO [logger] [logger] ./log/2025-03-20/12_50_30.ulg
INFO [logger] Opened full log file: ./log/2025-03-20/12_50_30.ulg
INFO [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
ERROR [mavlink] Device /dev/ttyACM0 does not exist

### Description
This module implements the MAVLink protocol, which can be used on a Serial link or UDP network connection.
It communicates with the system via uORB: some messages are directly handled in the module (eg. mission
protocol), others are published via uORB (eg. vehicle_command).

Streams are used to send periodic messages with a specific rate, such as the vehicle attitude.
When starting the mavlink instance, a mode can be specified, which defines the set of enabled streams with their rates.
For a running instance, streams can be configured via mavlink stream command.

There can be multiple independent instances of the module, each connected to one serial device or network port.

### Implementation
The implementation uses 2 threads, a sending and a receiving thread. The sender runs at a fixed rate and dynamically
reduces the rates of the streams if the combined bandwidth is higher than the configured rate (-r) or the
physical link becomes saturated. This can be checked with mavlink status, see if rate mult is less than 1.

Careful: some of the data is accessed and modified from both threads, so when changing code or extend the
functionality, this needs to be take into account, in order to avoid race conditions and corrupt data.

### Examples
Start mavlink on ttyS1 serial with baudrate 921600 and maximum sending rate of 80kB/s:
$ mavlink start -d /dev/ttyS1 -b 921600 -m onboard -r 80000

Start mavlink on UDP port 14556 and enable the HIGHRES_IMU message with 50Hz:
$ mavlink start -u 14556 -r 1000000
$ mavlink stream -u 14556 -s HIGHRES_IMU -r 50

Usage: mavlink [arguments…]

  • Commands:*

  • start Start a new instance*

  • [-d <val>]  Select Serial Device*
    
  •             values: <file:dev>, default: /dev/ttyS1*
    
  • [-b <val>]  Baudrate (can also be p:<param_name>)*
    
  •             default: 57600*
    
  • [-r <val>]  Maximum sending data rate in B/s (if 0, use baudrate / 20)*
    
  •             default: 0*
    
  • [-p]        Enable Broadcast*
    
  • [-u <val>]  Select UDP Network Port (local)*
    
  •             default: 14556*
    
  • [-o <val>]  Select UDP Network Port (remote)*
    
  •             default: 14550*
    
  • [-t <val>]  Partner IP (broadcasting can be enabled via -p flag)*
    
  •             default: 127.0.0.1*
    
  • [-m <val>]  Mode: sets default streams and rates*
    
  •             values: custom|camera|onboard|osd|magic|config|iridium|minimal|extvision|extvisionmin|gimbal, default: normal*
    
  • [-n <val>]  wifi/ethernet interface name*
    
  •             values: <interface_name>*
    
  • [-f]        Enable message forwarding to other Mavlink instances*
    
  • [-w]        Wait to send, until first message received*
    
  • [-x]        Enable FTP*
    
  • [-z]        Force hardware flow control always on*
    
  • [-Z]        Force hardware flow control always off*
    
  • stop-all Stop all instances*

  • status Print status for all instances*

  • [streams  ] Print all enabled streams*
    
  • stream Configure the sending rate of a stream for a running instance*

  • [-u <val>]  Select Mavlink instance via local Network Port*
    
  • [-d <val>]  Select Mavlink instance via Serial Device*
    
  •             values: <file:dev>*
    
  • -s <val>    Mavlink stream to configure*
    
  • -r <val>    Rate in Hz (0 = turn off, -1 = set to default)*
    
  • boot_complete Enable sending of messages. (Must be) called as last step in startup script.*
    INFO [px4] Startup script returned successfully
    pxh> [vehicle_spawn_ning_Legion_Y7000P_IRX9_14383_6746860904521503477-5] process has finished cleanly
    log file: /home/ning/.ros/log/e6d49bbe-0589-11f0-8326-81469bc50aea/vehicle_spawn_ning_Legion_Y7000P_IRX9_14383_6746860904521503477-5.log*
    INFO INFO [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset velocity to zero
    [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset velocity to zero
    INFO [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset velocity to zero
    INFO [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset velocity to zero
    INFO [ecl/EKF] reset velocity to zero
    INFO [ecl/EKF] reset position to last known position
    INFO [ecl/EKF] reset velocity to zero
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] GPS checks passed
    INFO [ecl/EKF] 4444000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 4440000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 4444000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 4576000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 4576000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] 4648000: EKF aligned, (baro hgt, IMU buf: 12, OBS buf: 9)
    INFO [ecl/EKF] INFO [ecl/EKF] reset position to GPS
    *reset position to GPSINFO *
    INFO [ecl/EKF] [ecl/EKF] reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    INFO [ecl/EKF] reset position to GPS
    INFO [ecl/EKF] reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    INFO [ecl/EKF] reset position to GPS
    INFO [ecl/EKF] reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    INFO [ecl/EKF] reset position to GPS
    INFO [ecl/EKF] reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    INFO [ecl/EKF] reset position to GPS
    INFO [ecl/EKF] reset velocity to GPS
    INFO [ecl/EKF] starting GPS fusion
    INFO [tone_alarm] home set
    INFO [tone_alarm] notify negative

However, when I continue to enter “commdaner takeoff” in the terminal, the UAV will not takeoff. The terminal display is as follows:

pxh> commander takeoff
pxh> INFO [commander] Armed by internal command
INFO [navigator] Using minimum takeoff altitude: 2.50 m
INFO [commander] Disarmed by auto preflight disarming
INFO [logger] closed logfile, bytes written: 53330159

Please help me solve this problem!