Repository navigation
Conversation
Contributor
|
Thank you! I will be manually redoing this update as I prefer it to use WMM-2025 and include some unit testings. |
WouterJansen
added a commit
that referenced
this pull request
Nov 13, 2026
Reworked from PR #177 by lql2511 (which ported PX4's WMM-2020 tables): - WMM-2020 expired at the end of 2024, so the tables are regenerated from the official WMM-2025 coefficients (NOAA NCEI/BGS, public domain), evaluated at 2027.5 (middle of the 2025-2030 validity), in PX4's exact table layout. scripts/wmm/generate_wmm_tables.py synthesises the field directly from the coefficient file; validated by reproducing PX4's published WMM-2020 tables (declination/inclination identical at every grid point, intensity within one quantisation step). - WorldMagneticModel.hpp: PX4's bilinear lookup (BSD-3, notice kept). - EarthUtils::getMagFieldWMM() added next to the existing dipole model, instead of replacing it. - MagnetometerSimpleParams: new ReferenceSource_WMM, now the default; selectable per sensor in settings.json with "ReferenceSource": "WMM" | "Dipole" | "Constant". - Standalone MSVC /W4 test: clean; mid-latitude error vs the exact model ~0.3 deg and ~0.3% in strength (10 degree grid, same as PX4). - docs/sensors.md, CHANGELOG, THIRD_PARTY_LICENSES (PX4 BSD-3, WMM public domain) updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace AirSim's dipole magnetic field model with the WMM-2020 lookup
table model used by PX4, so that HIL_SENSOR magnetic output matches
PX4's behavior.
Changes
AirLib/include/common/WorldMagneticModel.hpp(ported from PX4, BSD 3-Clause)EarthUtils::getMagField()to use WMM-2020 declination/inclination/strengthCoordinate convention
Output follows the NED frame expected by PX4 HIL_SENSOR:
Testing
License
PX4's WMM-2020 code is BSD 3-Clause, compatible with AirSim's MIT license.