Skip to content

PX4 fails to arm with custom OriginGeopoint in settings.json: Heading estimate not stable #5018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sidharthmohannair opened this issue Mar 31, 2025 · 3 comments

Comments

@sidharthmohannair
Copy link

Bug report

  • AirSim Version/#commit: v1.8.1
  • UE/Unity version: Version: 4.27.2-0+++UE4+Release-4.27
  • autopilot version: PX$ 1.16.0alpha
  • OS Version: Ubuntu 22.04.5 LTS

What's the issue you encountered?

When using custom GPS coordinates via OriginGeopoint in settings.json, PX4 fails to initialize properly and cannot arm. The error messages indicate sensor validation failures ("heading estimate not stable" and "GPS fix too low"). However, when removing the OriginGeopoint settings, PX4 works perfectly but doesn't show the desired custom location in QGC. This creates a conflict between setting a custom geolocation and having a functional drone.

Settings

{
 "SettingsVersion": 1.2,
"SimMode": "Multirotor",
"ClockType": "SteppableClock",
"Vehicles": {
"PX4": {
"VehicleType": "PX4Multirotor",
"UseSerial": false,
"LockStep": true,
"UseTcp": true,
"TcpPort": 4560,
"ControlPortLocal": 14540,
"ControlPortRemote": 14580,
"GimbalForwardControlToMAVLink": true,
"MAVLinkVersion": 2,
"Sensors": {
"Barometer": {
"SensorType": 1,
"Enabled": true,
"PressureFactorSigma": 0.0001825
 },
"Gps": {
"SensorType": 3,
"Enabled": true,
"EphEnabled": true
 },
"Magnetometer": {
"SensorType": 4,
"Enabled": true
 },
"Imu": {
"SensorType": 2,
"Enabled": true
 }
 },
"Cameras": {
  // Camera settings omitted for brevity
 },
"Parameters": {
"NAV_RCL_ACT": 0,
"NAV_DLL_ACT": 0,
"LPE_LAT": 14.485365,
"LPE_LON": 76.974786,
"MNT_MODE_IN": 4,
"MNT_MODE_OUT": 2,
"MNT_RC_IN_MODE": 1,
"MNT_MAN_ROLL": 1,
"MNT_MAN_PITCH": 2,
"MNT_MAN_YAW": 3,
"MNT_RANGE_ROLL": 180,
"MNT_RANGE_PITCH": 180,
"MNT_RANGE_YAW": 720
 }
 }
 },
"OriginGeopoint": {
"Latitude": 14.485365,
"Longitude": 76.974786,
"Altitude": 0.0
},
"WorldOrigin": {
"X": 0, "Y": 0, "Z": 0
},
"SubWindows": [
 // SubWindows settings omitted for brevity
 ]
}

How can the issue be reproduced?

  1. Set up AirSim with PX4 in Multirotor mode
  2. Add the custom OriginGeopoint and WorldOrigin settings to settings.json as shown above
  3. Start the simulation environment
  4. Connect to PX4 via QGC and observe the errors
  5. Try removing the OriginGeopoint and WorldOrigin sections and note that PX4 now arms correctly but doesn't use the custom location

Include full error message in text form

[0/1] launching px4 none_iris (SYS_AUTOSTART=10016)

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

px4 starting.

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
env SYS_AUTOSTART: 10016
INFO  [param] selected parameter default file parameters.bson
INFO  [param] importing from 'parameters.bson'
INFO  [parameters] BSON document size 799 bytes, decoded 799 bytes (INT32:26, FLOAT:14)
INFO  [param] selected parameter backup file parameters_backup.bson
INFO  [dataman] data manager file './dataman' size is 7872608 bytes
INFO  [init] PX4_SIM_HOSTNAME: localhost
INFO  [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560
INFO  [simulator_mavlink] Simulator connected on TCP port 4560.
INFO  [lockstep_scheduler] setting initial absolute time to 1743424160804518 us
INFO  [commander] LED: open /dev/led0 failed (22)
WARN  [health_and_arming_checks] Preflight Fail: ekf2 missing data
WARN  [health_and_arming_checks] Preflight Fail: system power unavailable
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/2025-03-31/12_29_21.ulg	
INFO  [logger] Opened full log file: ./log/2025-03-31/12_29_21.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> INFO  [mavlink] partner IP: 127.0.0.1
INFO  [mavlink] partner IP: 127.0.0.1
WARN  [health_and_arming_checks] Preflight: GPS fix too low
INFO  [tone_alarm] home set
INFO  [tone_alarm] notify positive
WARN  [health_and_arming_checks] Preflight Fail: heading estimate not stable
[2025.03.31-12.29.20:878][272]LogTemp: PX4
PX4
[2025.03.31-12.29.20:879][272]PIE: Server logged in
[2025.03.31-12.29.20:880][272]PIE: Play in editor total start time 0.2 seconds.
Preflight Fail: system power unavailable
[2025.03.31-12.29.21:825][327]LogTemp: Preflight Fail: system power unavailable
[logger] ./log/2025-03-31/12_29_21.ulg	
[2025.03.31-12.29.21:876][330]LogTemp: [logger] ./log/2025-03-31/12_29_21.ulg	
Preflight: GPS fix too low
[2025.03.31-12.29.22:994][398]LogTemp: Preflight: GPS fix too low
Got GPS lock
[2025.03.31-12.29.24:027][459]LogTemp: Got GPS lock
Got GPS Home Location
[2025.03.31-12.29.24:048][461]LogTemp: Got GPS Home Location
Preflight Fail: heading estimate not stable
[2025.03.31-12.29.27:101][644]LogTemp: Preflight Fail: heading estimate not stable
[2025.03.31-12.39.56:156][150]LogSlate: Window 'About Unreal Editor' being destroyed

What's better than filing an issue? Filing a pull request :).

@vikasyadavwork
Copy link

there is issue in magfield function you can change the calculation using this code mentioned in this library
issue #5001

@sidharthmohannair
Copy link
Author

Hi @vikasyadavwork ,

Thank you for your response. I have reviewed the solution you mentioned earlier, but I'm not sure where exactly to make the changes in the code, and what specific modifications are needed.

If you have already resolved this issue, could you please share the corrected code with me, along with the file(s) where the changes were made?

Thanks in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@sidharthmohannair @vikasyadavwork and others