Hi all, I am a developer working on the AirSim simulator. We recently had an issue where we are flipping the sign of the gravity component when calculating the linear acceleration reported by the simulator’s IMU sensor. The result of this behavior is that while the drone is stationary, we are reporting a linear acceleration (in m/s^2) of approximately (0, 0, -9.8). Since we use a NED (north, east, down) coordinate system, and the HIL_SENSOR mavlink message also uses a NED coordinate system, we reconsidered this behavior and thought the sign of gravity’s z component should be positive (IE a positive acceleration going downwards). However making this change resulted in PX4 SITL not running any commands and instead outputting a warning in its output:
WARN [PreFlightCheck] Preflight Fail: Roll failure detected
Does anybody know why a positive acceleration in the z axis would cause this warning?
Additionally, we considered whether PX4 SITL was expecting the IMU to only report the resultant acceleration after collisions were factored in instead of always including an acceleration due to gravity (IE a stationary drone’s z acceleration would be 0 instead of -9.8/9.8), however this failed another PreFlightCheck:
WARN [PreFlightCheck] Preflight Fail: Accel Range, hold still on arming
WARN [PreFlightCheck] Primary accelerometer not found
We looked into the source and found this PreFlightCheck is happening here, which checks if the magnitude of the IMU’s acceleration is between 4.0 and 15.0. Does anybody know the context for why this check is happening and why a IMU sensor reporting 0 acceleration fails this check?