[Bug] Sometimes topic sensor_gps not updated in gz simulation
Describe the bug
I tried swarm testing of 10 drones in gz.
When I tried to take off the third drone, I found the following error. NOTE:The occurrence of a malfunction is a random small probability event, unless multiple drones are started in the gz simulation environment
I debugged and found that the geomagnetic sensor in the gz environment relies on GPS signals. Then, I listened to sensor_gps and found that it is not updating(update 367s ago)
https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/simulation/sensor_gps_sim/SensorGpsSim.cpp#L109 Because the sensor_gps publish requires _vehicle_local_position_sub. updated()&&_vehicle_global_position_sub. updated().
I listened to ORB-ID (vehicle_local_position_groundtruth) and ORB-ID (vehicle_global_position_groundtruth) and compared them with a normal takeoff drone, and did not find any issues.
normal drone in gz:
I also checked the running status of sensor_gps_sim and found that it was running.
I hope to receive your help,thanks
To Reproduce
Expected behavior
update sensor_gps
Screenshot / Media
No response
Flight Log
no
Software Version
main branch
Flight controller
gz
Vehicle type
None
How are the different components wired up (including port information)
No response
Additional context
No response
The problem was resolved through:
sensor_gps_sim stop sensor_gps_sim start sensor_mag_sim stop sensor_mag_sim start
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:
https://discuss.px4.io/t/unable-to-setup-compass-sensor-for-simulation/38810/2