This documentation was generated with the assistance of AI. Please report any inaccuracies.
Classes: NEDGravityEstimator, ECEFGravityEstimator, ECIGravitationEstimator (see the
Class Reference table at the end of this page for Javadoc and source links).
Gravity vs. gravitation
Gravitation is the fundamental mass-attraction force; it does not include any centripetal effect.
Gravity is what a body actually experiences at (or near) the Earth’s surface: the gravitational
acceleration plus the (outward) centrifugal acceleration caused by the Earth’s rotation. An
accelerometer never measures gravity or gravitation directly — it measures specific force, the
non-gravitational force per unit mass, which is zero in freefall and equal and opposite to gravity
when the body is held stationary:
flowchart LR
A["Gravitation (gamma)\nmass attraction only"] --> C["Gravity (g)\ngamma minus centrifugal term"]
B["Earth-rotation centrifugal\nacceleration"] --> C
C -->|sensed via reaction| D["Specific force f\n(what accelerometers measure)"]
Derivation chain
The estimators follow the gravity-modelling chain of Groves chapter 2, restated here in outline.
Gravitation. A mass distribution attracts a test mass; for a body at ECEF position
the attraction is the gradient of a gravitational potential. Truncating the
spherical-harmonic expansion of that potential to the first zonal term (oblateness) gives the
gravitation vector used by the ECEF and ECI estimators (equation 2.142,
see below). A point-mass model alone would be the special case.
Centrifugal term. A body co-rotating with the Earth also experiences an outward acceleration. Gravity is
the sum of both effects (equation 2.133):
The matrix product is , so subtracting it adds a term that
points away from the rotation axis and has no component along the axis.
Surface gravity. On the ellipsoid surface the combined effect is a closed-form function of latitude, the
Somigliana model (2.134), which equals roughly 9.78 m/s² at the equator and 9.83 m/s² at the poles.
Gravity is stronger at the poles because they are closer to the Earth’s centre and have no centrifugal
relief.
Height correction. Away from the surface, gravity falls with height roughly like an inverse square. The
estimator applies a second-order polynomial correction in to the down component (2.139) and a
small north component that arises because the local vertical is not exactly toward the Earth’s centre
(2.140). East gravity is zero by symmetry about the rotation axis.
Gravity versus specific force. The accelerometer senses , the non-gravitational
acceleration. At rest in NED, , so the sensed down
component is (about -9.8 m/s²). The navigation equations add gravity back
() while the kinematics estimators subtract it.
flowchart TD
A["Position (L, h) or (x, y, z)"] --> B{"Frame"}
B -->|NED| C["Somigliana g0(L)\n(2.134)"]
C --> D["Height correction\n(2.139, 2.140)"]
D --> G["g^n = (gN, 0, gD)"]
B -->|ECEF| E["J2 gravitation gamma^e\n(2.142)"]
E --> F["Subtract Omega*Omega*r\n(2.133)"]
F --> H["g^e"]
B -->|ECI| I["J2 gravitation gamma^i\n(2.142), no centrifugal term"]
G --> J["Specific force f = a - g\n(kinematics estimators)"]
H --> J
I --> J
NEDGravityEstimator
Computes acceleration due to gravity resolved about the north, east, and down axes of the local
navigation frame, for a given geodetic latitude and height, using the WGS84 Somigliana model for
surface gravity plus first-order height corrections. East gravity is always zero by symmetry.
Surface gravity (Somigliana model):
North component (height correction due to the flattened, non-spherical Earth):
Down component (height and Earth-shape correction):
where is geodetic latitude, is height, is the WGS84 eccentricity,
/ are the WGS84 equatorial/polar radii, is the flattening,
is the Earth rotation rate, and is the Earth gravitational constant. The equation numbers cited by the
implementation are (2.134) for surface gravity, (2.140) for north gravity and (2.139) for down gravity. See
[book-groves], chapter 2 (gravity and gravitation models).
double latitude = Math.toRadians(41.3851); // Barcelona, in radians
double height = 0.0; // meters
// static, stateless call - no need to instantiate the estimator
NEDGravity gravity = NEDGravityEstimator.estimateGravityAndReturnNew(latitude, height);
double gn = gravity.getGn(); // north component (m/s^2), typically near zero
double gd = gravity.getGd(); // down component (m/s^2), approximately 9.8
// an instance can be reused instead, if preferred
NEDGravityEstimator estimator = new NEDGravityEstimator();
NEDGravity result = new NEDGravity();
estimator.estimate(latitude, height, result);
ECEFGravityEstimator
Computes the same gravity vector, but resolved about ECEF-frame axes for a Cartesian position
. The gravitational term uses a spherical-harmonic approximation truncated to the
zonal term (Earth’s oblateness), and the centrifugal term is added explicitly since ECEF axes
rotate with the Earth:
The gravitational part is equation (2.142) and the last step, equation (2.133), subtracts
, which is the same as adding the
outward centrifugal acceleration:
.
A position of exactly zero returns a zero vector instead of dividing by zero.
double x = 4_789_000.0; // ECEF position (m)
double y = 177_000.0;
double z = 4_195_000.0;
ECEFGravity gravity = ECEFGravityEstimator.estimateGravityAndReturnNew(x, y, z);
double gx = gravity.getGx();
double gy = gravity.getGy();
double gz = gravity.getGz();
double norm = gravity.getNorm(); // total gravity magnitude (m/s^2)
ECIGravitationEstimator
Computes gravitation only (no centrifugal term) resolved about ECI-frame axes, using the same
spherical-harmonic model as ECEFGravityEstimator. Because the ECI frame is inertial (does
not rotate with the Earth), there is no centrifugal acceleration to add — the ECI navigation equations
account for Earth rotation separately where needed, through the Earth-rotation skew-symmetric matrix
and the rotation. The code evaluates the same
equation (2.142) as the ECEF estimator, just without the centrifugal step.
double x = 4_789_000.0; // ECI position at a given instant (m)
double y = 177_000.0;
double z = 4_195_000.0;
ECIGravitation gravitation = ECIGravitationEstimator.estimateGravitationAndReturnNew(x, y, z);
double gammaX = gravitation.getGx();
double gammaY = gravitation.getGy();
double gammaZ = gravitation.getGz();
Which one should I use?
Class
Resolving frame
Returns
NEDGravityEstimator
Local navigation (north, east, down)
Gravity g (gravitation + centrifugal)
ECEFGravityEstimator
ECEF (rotates with the Earth)
Gravity g (gravitation + centrifugal)
ECIGravitationEstimator
ECI (inertial)
Gravitation gamma only (no centrifugal term)
Class Reference
Javadoc and source links for the classes used in the examples above: