Files
PX4-Autopilot/Tools/simulation
0462e3a31e fix(gz_bridge): use the corrected Gazebo magnetometer frame and units (#28877)
* fix(gz_bridge): use the corrected Gazebo magnetometer frame and units

The Gazebo magnetometer system defaults to a legacy mode: it computes the
field in NED, places it into the ENU world frame without converting, and
reports gauss. The bridge swapped body axes to compensate, but no body-axis
swap undoes a mirrored world-frame field at every attitude. At the default
world location this left the heading about 6 deg off on the ground.

gz-sim 8.6 added use_units_gauss and use_earth_frame_ned (gz-sim#2460).
Turn both off in server.config, so the field is in tesla and physically
correct in the sensor's FLU frame, and convert it like the IMU: FLU -> FRD,
tesla -> gauss.

Other ways of starting gz (standalone mode, gz-sim < 8.6, worlds with their
own systems) still deliver the legacy output. Detect it from the field
magnitude, keep the previous mapping for it and warn once.

Needs the x500 (and other) model magnetometer noise in tesla, see
PX4-gazebo-models.

* docs(gz_bridge): describe the legacy magnetometer frame accurately

NED components on ENU axes is a 180 degree rotation about the horizontal
axis between north and east, not a mirror.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* build(simulation): bump gz models for magnetometer noise in tesla

The gz_bridge server.config now runs the Magnetometer system in tesla, so
the models need their noise in tesla too, otherwise it is 1 gauss and PX4
refuses to arm. Also pulls in the advanced_plane parachute plugin and the
default world elevation fix.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: matteo <197973584+megavedl@users.noreply.github.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-30 16:45:43 -06:00
..