Hi everyone,
I’m running PX4 SITL with Gazebo Sim and ROS2/MAVROS2, and I’m stuck on preflight sensor failures whenever I integrate a Husky robot + custom world with the x500. When I run the stock x500 setup alone, everything works great (including Offboard via ROS2). As soon as I move to my landing_zone world with Husky, PX4 reports missing sensors and refuses to arm.
I’d really appreciate help understanding what I’m doing wrong on the Gazebo/PX4 side (sensor setup / world / parameters).
this is the reference model for X500:
<?xml version="1.0" encoding="UTF-8"?>
<sdf version='1.9'>
<model name='x500'>
<include merge='true'>
<uri>model://x500_base</uri>
</include>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_0_joint</jointName>
<linkName>rotor_0</linkName>
<turningDirection>ccw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>0</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_1_joint</jointName>
<linkName>rotor_1</linkName>
<turningDirection>ccw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>1</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_2_joint</jointName>
<linkName>rotor_2</linkName>
<turningDirection>cw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>2</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_3_joint</jointName>
<linkName>rotor_3</linkName>
<turningDirection>cw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>3</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="MotorFailurePlugin"
name="gz::sim::systems::MotorFailureSystem">
</plugin>
</model>
</sdf>
My current world file (Tools/simulation/gz/worlds/landing_zone.sdf) looks like:
<?xml version="1.0" ?>
<sdf version="1.9">
<world name="landing_zone">
<!-- Core systems -->
<plugin filename="gz-sim-physics-system" name="gz::sim::systems::Physics"/>
<plugin filename="gz-sim-user-commands-system" name="gz::sim::systems::UserCommands"/>
<plugin filename="gz-sim-scene-broadcaster-system" name="gz::sim::systems::SceneBroadcaster"/>
<plugin filename="gz-sim-sensors-system" name="gz::sim::systems::Sensors">
<render_engine>ogre2</render_engine>
</plugin>
<!-- Sun -->
<light type="directional" name="sun">
<pose>0 0 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<direction>-0.5 0.1 -0.9</direction>
</light>
<!-- Inline Ground Plane (NO external dependency) -->
<model name="ground_plane">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
</collision>
<visual name="visual">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<ambient>0.7 0.7 0.7 1</ambient>
<diffuse>0.7 0.7 0.7 1</diffuse>
</material>
</visual>
</link>
</model>
<!-- Husky robot -->
<include>
<uri>
https://fuel.gazebosim.org/1.0/OpenRobotics/models/MARBLE_HUSKY_SENSOR_CONFIG_2
</uri>
<pose>5 0 0.1 0 0 0</pose>
</include>
</world>
</sdf>
Launch the simulation:
export PX4_GZ_WORLD=landing_zone
export LIBGL_ALWAYS_SOFTWARE=1
make px4_sitl gz_x500
The problem: Preflight sensor failures and missing sensor topics
In the PX4 shell (pxh>), I get repeatedly:
i@:~/PX4-Autopilot$ make px4_sitl gz_x500
[0/1] cd /home/issa/PX4-Autopilot/build/px4_sitl_…issa/PX4-Autopilot/build/px4_sitl_default/bin/px4
| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /| |
| | / /^\ \ ___ |
_| / / |_/
px4 starting.
INFO [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO [init] found model autostart file as SYS_AUTOSTART=4001
INFO [param] selected parameter default file parameters.bson
INFO [param] importing from ‘parameters.bson’
INFO [parameters] BSON document size 440 bytes, decoded 440 bytes (INT32:17, FLOAT:5)
INFO [param] selected parameter backup file parameters_backup.bson
INFO [dataman] data manager file ‘./dataman’ size is 1208528 bytes
INFO [init] Gazebo simulator 8.10.0
INFO [init] Starting gazebo with world: /home/issa/PX4-Autopilot/Tools/simulation/gz/worlds/landing_zone.sdf
INFO [init] Starting gz gui
INFO [init] Waiting for Gazebo world…
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
libEGL warning: egl: failed to create dri2 screen
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
libEGL warning: egl: failed to create dri2 screen
INFO [init] Gazebo world is ready
INFO [init] Spawning Gazebo model
Warning [Utils.cc:132] [/sdf/model[@name=“x500_base”]/link[@name=“base_link”]/sensor[@name=“air_pressure_sensor”]/gz_frame_id:/home/issa/PX4-Autopilot/Tools/simulation/gz/models/x500_base/model.sdf:L219]: XML Element[gz_frame_id], child of element[sensor], not defined in SDF. Copying[gz_frame_id] as children of [sensor].
Warning [Utils.cc:132] [/sdf/model[@name=“x500_base”]/link[@name=“base_link”]/sensor[@name=“magnetometer_sensor”]/gz_frame_id:/home/issa/PX4-Autopilot/Tools/simulation/gz/models/x500_base/model.sdf:L233]: XML Element[gz_frame_id], child of element[sensor], not defined in SDF. Copying[gz_frame_id] as children of [sensor].
Warning [Utils.cc:132] [/sdf/model[@name=“x500_base”]/link[@name=“base_link”]/sensor[@name=“imu_sensor”]/gz_frame_id:/home/issa/PX4-Autopilot/Tools/simulation/gz/models/x500_base/model.sdf:L259]: XML Element[gz_frame_id], child of element[sensor], not defined in SDF. Copying[gz_frame_id] as children of [sensor].
Warning [Utils.cc:132] [/sdf/model[@name=“x500_base”]/link[@name=“base_link”]/sensor[@name=“navsat_sensor”]/gz_frame_id:/home/issa/PX4-Autopilot/Tools/simulation/gz/models/x500_base/model.sdf:L311]: XML Element[gz_frame_id], child of element[sensor], not defined in SDF. Copying[gz_frame_id] as children of [sensor].
INFO [gz_bridge] world: landing_zone, model: x500_0
INFO [lockstep_scheduler] setting initial absolute time to 3620000 us
INFO [init] Setting camera to follow x500_0
INFO [init] Camera follow offset set to -2.0, -2.0, 2.0
INFO [commander] LED: open /dev/led0 failed (22)
WARN [health_and_arming_checks] Preflight Fail: Accel Sensor 0 missing
WARN [health_and_arming_checks] Preflight Fail: barometer 0 missing
WARN [health_and_arming_checks] Preflight Fail: ekf2 missing data
WARN [health_and_arming_checks] Preflight Fail: Gyro Sensor 0 missing
WARN [health_and_arming_checks] Preflight Fail: Found 0 compass (required: 1)
WARN [health_and_arming_checks] Preflight Fail: No connection to the GCS
INFO [uxrce_dds_client] init UDP agent IP:127.0.0.1, port:8888
INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
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/2026-02-16/18_53_05.ulg
INFO [logger] Opened full log file: ./log/2026-02-16/18_53_05.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)
INFO [px4] Startup script returned successfully
pxh> WARN [health_and_arming_checks] Too many arming check events (1, 14 > 14). Not reporting all
WARN [health_and_arming_checks] Preflight Fail: Accel Sensor 0 missing
WARN [health_and_arming_checks] Preflight Fail: barometer 0 missing
WARN [health_and_arming_checks] Preflight Fail: ekf2 missing data
WARN [health_and_arming_checks] Preflight Fail: Gyro Sensor 0 missing
WARN [health_and_arming_checks] Preflight Fail: Found 0 compass (required: 1)
WARN [health_and_arming_checks] Preflight Fail: No connection to the GCS
Checking sensor topics inside PX4:
pxh> listener sensor_accel 1
never published
pxh> listener sensor_gyro 1
never published
pxh> listener sensor_baro 1
never published
pxh> listener sensor_mag 1
never published
