AP_Compass_SITL held the compass sensor model -- the noise, the delay
buffer, the elliptical correction and the failure injection -- inline.
Move it to SITL::CompassSim so it sits alongside the rest of the sensor
simulation and beside the transformation it shares with
get_mag_offsets().
The consumer owns its own instance, so sampling stays where it was and
the 100Hz rate at which the sensor is simulated is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
AP_Compass_SITL applied the orientations, board trim and scale factor to
the field inline. Move it into SITL::SIM so that the several things
which want these numbers can share one copy, and add get_mag_offsets()
alongside it: SIM_MAGn_OFS is subtracted from the field before that
transformation is applied, so the offset a perfectly-calibrated compass
would end up with is the same transformation applied to SIM_MAGn_OFS.
That depends only on parameters, so it costs nothing to evaluate on
demand -- no field, noise or delay-buffer work is involved.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Keep the compass consistent with the IMU under a board mounting offset; rotating only the IMU leaves a spurious yaw estimate error.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
rather than each backend storing this itself.
This allows many methods to assume that they are working on the current instance number rather than being passed the instance number
registering the compass via the compass backend method now infers setting the device ID
this adds new COMPASS_SCALE, COMPASS_SCALE2 and COMPASS_SCALE3
parameters, which give the sensor scaling factor. It is used to
compensate for an incorrect scaling in a compass.
The 3D compass calibration process will set the correct value
automatically, otherwise users can set the value to a known value for
an existing compass