mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 16:40:34 +08:00
simplify world_magnetic_model interface (degrees in, degrees out)
- this hopefully helps avoid accidental mis-use - try to clarify units everywhere
This commit is contained in:
@@ -113,11 +113,11 @@ void SensorMagSim::Run()
|
||||
if (gpos.eph < 1000) {
|
||||
|
||||
// magnetic field data returned by the geo library using the current GPS position
|
||||
const float mag_declination_gps = get_mag_declination_radians(gpos.lat, gpos.lon);
|
||||
const float mag_inclination_gps = get_mag_inclination_radians(gpos.lat, gpos.lon);
|
||||
const float mag_strength_gps = get_mag_strength_gauss(gpos.lat, gpos.lon);
|
||||
const float declination_rad = math::radians(get_mag_declination_degrees(gpos.lat, gpos.lon));
|
||||
const float inclination_rad = math::radians(get_mag_inclination_degrees(gpos.lat, gpos.lon));
|
||||
const float field_strength_gauss = get_mag_strength_gauss(gpos.lat, gpos.lon);
|
||||
|
||||
_mag_earth_pred = Dcmf(Eulerf(0, -mag_inclination_gps, mag_declination_gps)) * Vector3f(mag_strength_gps, 0, 0);
|
||||
_mag_earth_pred = Dcmf(Eulerf(0, -inclination_rad, declination_rad)) * Vector3f(field_strength_gauss, 0, 0);
|
||||
|
||||
_mag_earth_available = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user