Path: blob/master/libraries/AP_Declination/AP_Declination.h
9564 views
#pragma once12#include <AP_Common/Location.h>34/*5magnetic data derived from WMM6*/7class AP_Declination8{9public:10/*11* Calculates the magnetic intensity, declination and inclination at a given WGS-84 latitude and longitude.12* Assumes a WGS-84 height of zero13* latitude and longitude have units of degrees14* declination and inclination are returned in degrees15* intensity is returned in Gauss16* Boolean returns false if latitude and longitude are outside the valid input range of +-60 latitude and +-180 longitude17*/18static bool get_mag_field_ef(float latitude_deg, float longitude_deg, float &intensity_gauss, float &declination_deg, float &inclination_deg);1920/*21get earth field as a Vector3f in Gauss given a Location22*/23static Vector3f get_earth_field_ga(const Location &loc);2425/*26get declination in degrees for a given latitude_deg and longitude_deg27*/28static float get_declination(float latitude_deg, float longitude_deg);2930private:31static const float SAMPLING_RES;32static const float SAMPLING_MIN_LAT;33static const float SAMPLING_MAX_LAT;34static const float SAMPLING_MIN_LON;35static const float SAMPLING_MAX_LON;3637static const uint32_t LAT_TABLE_SIZE = 19;38static const uint32_t LON_TABLE_SIZE = 37;3940static const float declination_table[LAT_TABLE_SIZE][LON_TABLE_SIZE];41static const float inclination_table[LAT_TABLE_SIZE][LON_TABLE_SIZE];42static const float intensity_table[LAT_TABLE_SIZE][LON_TABLE_SIZE];43};444546