55 return { T(0.0), T(0.0), T(9.81) };
69 auto g_0 = 9.7803253359 * (1.0 + 1.931853e-3 * std::pow(std::sin(latitude), 2))
80 return { T(0.0), T(0.0), k * g_0 };
103 return { T(0.0), T(0.0), gravitationMagnitude };
124 - std::pow(
InsConst::omega_ie, 2.0) * radiusSpheroid * std::pow(std::cos(latitudeGeocentric), 2.0);
126 return { T(0.0), T(0.0), gravitationMagnitude };
136template<
typename Derived>
137[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
n_calcGravitation_EGM96(
const Eigen::MatrixBase<Derived>& lla_position,
size_t ndegree = 10)
145 auto latitudeGeocentric = std::atan(e_position(2) / std::sqrt(e_position(0) * e_position(0) + e_position(1) * e_position(1)));
148 auto radius = std::sqrt(e_position(0) * e_position(0) + e_position(1) * e_position(1) + e_position(2) * e_position(2));
149 auto elevation = M_PI_2 - latitudeGeocentric;
150 const auto& azimuth = lla_position(1);
153 Eigen::Vector3<typename Derived::Scalar> n_gravitation = Eigen::Vector3<typename Derived::Scalar>::Zero();
155 typename Derived::Scalar Pnm(0.0);
156 typename Derived::Scalar Pnmd(0.0);
158 auto coeffsRows = egm96Coeffs.size();
161 auto [P, Pd] = associatedLegendre(elevation, ndegree);
163 for (
size_t i = 0; i < coeffsRows; i++)
166 auto n =
static_cast<int>(egm96Coeffs.at(i).at(0));
167 auto m =
static_cast<int>(egm96Coeffs.at(i).at(1));
168 auto C = egm96Coeffs.at(i).at(2);
169 auto S = egm96Coeffs.at(i).at(3);
171 if (
static_cast<size_t>(n) == ndegree + 1)
182 auto nd =
static_cast<double>(n);
183 auto md =
static_cast<double>(m);
186 n_gravitation(0) += std::pow((
InsConst::WGS84::a / radius), nd) * (C * std::cos(md * azimuth) + S * std::sin(md * azimuth)) * Pnmd;
187 n_gravitation(1) += std::pow((
InsConst::WGS84::a / radius), nd) * md * (C * std::sin(md * azimuth) - S * std::cos(md * azimuth)) * Pnm;
188 n_gravitation(2) += (nd + 1.0) * std::pow((
InsConst::WGS84::a / radius), nd) * (C * std::cos(md * azimuth) + S * std::sin(md * azimuth)) * Pnm;
193 (1.0 / std::sin(elevation)) * (-
InsConst::WGS84::MU / (radius * radius)) * n_gravitation(1),
201template<
typename Derived>
202[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
n_calcGravitation(
const Eigen::MatrixBase<Derived>& lla_position,
205 const typename Derived::Scalar& latitude = lla_position(0);
206 const typename Derived::Scalar& altitude = lla_position(2);
208 switch (gravitationModel)
211 return Eigen::Vector3<typename Derived::Scalar>::Zero();
223 return Eigen::Vector3<typename Derived::Scalar>::Zero();
226 return Eigen::Vector3<typename Derived::Scalar>::Zero();
Associated Legendre Polynomials for EGM96.
Transformation collection.
static constexpr double f
Flattening f = (a-b)/a.
static constexpr double J2
Dynamic form factor, derived [-].
static constexpr double b
Semi-minor axis = polar radius.
static constexpr double MU
Gravitational constant (mass of Earth’s atmosphere included) [m³/s²].
static constexpr double a
Semi-major axis = equatorial radius.
static constexpr double e_squared
Square of the first eccentricity of the ellipsoid.
static constexpr double omega_ie
Nominal mean angular velocity of the Earth in [rad/s].
static constexpr double omega_ie_Skydel
Nominal mean angular velocity of the Earth in [rad/s]. Value implemented by the Skydel GNSS simulator...
std::array< std::array< double, 6 >, 65338 > egm96Coeffs
EGM96 coefficients.
std::pair< Eigen::MatrixX< T >, Eigen::MatrixX< T > > associatedLegendre(const T &theta, size_t ndegree=10)
Calculates the associated Legendre Polynomial coefficients necessary for the EGM96.
Eigen::Vector3< typename Derived::Scalar > lla2ecef_WGS84(const Eigen::MatrixBase< Derived > &lla_position)
Converts latitude, longitude and altitude into Earth-centered-Earth-fixed coordinates using WGS84.
Eigen::Vector3< typename Derived::Scalar > n_calcGravitation(const Eigen::MatrixBase< Derived > &lla_position, GravitationModel gravitationModel=GravitationModel::EGM96)
Calculates the gravitation (acceleration due to mass attraction of the Earth)
Eigen::Vector3< T > n_calcGravitation_WGS84(const T &latitude, const T &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Eigen::Vector3< T > n_calcGravitation_WGS84_Skydel(const T &latitude, const T &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
@ COUNT
Amount of items in the enum.
@ None
Ionosphere model turned off.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
GravitationModel
Available Gravitation Models.
@ WGS84_Skydel
World Geodetic System 1984 implemented by the Skydel Simulator // FIXME: Remove after Skydel uses the...
@ COUNT
Amount of items in the enum.
@ WGS84
World Geodetic System 1984.
@ None
Gravity Model turned off.
@ Const
Constant gravitation.
@ EGM96
Earth Gravitational Model 1996.
@ Somigliana
Somigliana gravity model.
bool ComboGravitationModel(const char *label, GravitationModel &gravitationModel)
Shows a ComboBox to select the gravitation model.
Eigen::Vector3< T > n_calcGravitation_Const()
Returns a constant gravitation of 9.81 [m/s^2] in down direction.
Eigen::Vector3< typename Derived::Scalar > n_calcGravitation_EGM96(const Eigen::MatrixBase< Derived > &lla_position, size_t ndegree=10)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Eigen::Vector3< T > n_calcGravitation_SomiglianaAltitude(const T &latitude, const T &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...