pub struct Geodetic { /* private fields */ }Expand description
A position on the WGS84 ellipsoid: latitude, longitude, and height.
f64 throughout, where the rest of the crate is f32: at a latitude of 50° an f32
degree has a resolution of 4 × 10⁻⁶ °, which is 0.4 m on the ground. Positions
relative to the origin are small, so everything after the conversion is f32 again.
Height is above the WGS84 ellipsoid for the conversion to be exact, which is what
receivers compute (u-blox height, PX4 altitude_ellipsoid_m). Height above mean
sea level works if used consistently, but it misplaces the ellipsoid by the local geoid
undulation — up to 100 m — and so scales horizontal distance by up to 1.6 × 10⁻⁵:
1.6 cm per kilometer from the origin.
Implementations§
Source§impl Geodetic
impl Geodetic
Sourcepub fn from_degrees(latitude: f64, longitude: f64, height: f64) -> Self
pub fn from_degrees(latitude: f64, longitude: f64, height: f64) -> Self
Construct from latitude and longitude in degrees, and height in meters.
Current PX4 publishes exactly this, as float64: latitude_deg, longitude_deg and
altitude_ellipsoid_m of SensorGps (msg/SensorGps.msg:8-11 at c4e4ef98) pass
straight through, with no scaling.
Sourcepub const fn from_radians(latitude: f64, longitude: f64, height: f64) -> Self
pub const fn from_radians(latitude: f64, longitude: f64, height: f64) -> Self
Construct from latitude and longitude in radians, and height in meters.
Sourcepub fn from_degrees_e7(latitude: i32, longitude: i32, height_mm: i32) -> Self
pub fn from_degrees_e7(latitude: i32, longitude: i32, height_mm: i32) -> Self
Construct from the integer encoding u-blox NAV-PVT, MAVLink GPS_RAW_INT, and
PX4’s older vehicle_gps_position all share: latitude and longitude in 10⁻⁷
degrees, height in millimeters.
ArduPilot’s Location shares the latitude and longitude but not the height, which is
centimeters (int32_t alt; // in cm, libraries/AP_Common/Location.h:17 at 368dc0c4):
passed here unconverted it is ten times too low. Multiply it by ten first.
Sourcepub fn latitude_deg(self) -> f64
pub fn latitude_deg(self) -> f64
Latitude in degrees.
Sourcepub fn longitude_deg(self) -> f64
pub fn longitude_deg(self) -> f64
Longitude in degrees.
Sourcepub const fn latitude_rad(self) -> f64
pub const fn latitude_rad(self) -> f64
Latitude in radians.
Sourcepub const fn longitude_rad(self) -> f64
pub const fn longitude_rad(self) -> f64
Longitude in radians.
Sourcepub fn magnetic_declination(self) -> Option<Radians>
Available on crate feature magnetic-model only.
pub fn magnetic_declination(self) -> Option<Radians>
magnetic-model only.The magnetic declination here, east-positive, from the crate’s World Magnetic Model
table (one epoch, 10° grid, bilinear): None for a coordinate that is not a number.
Height is ignored.
The value Eskf applies itself where it places its origin, unless
set_magnetic_declination has been called.
A caller that knows its site before initializing hands the filter the site through
set_origin instead, which reads this and leaves the model
in charge; passing this to set_magnetic_declination fixes it for good. Behind the
magnetic-model feature, on by default.
Sourcepub fn normal_gravity(self) -> f32
pub fn normal_gravity(self) -> f32
WGS84 normal gravity here, m s⁻²: the value Config::gravity
is configured with for a site.
Somigliana’s closed formula on the ellipsoid, NGA.STND.0036 v1.0.0 equation (4-1), carried to the height by the second-order series of (4-3), which the standard gives for small heights: it is within a few µm s⁻² of the exact (4-4) at the altitudes a vehicle navigates, against the 0.03 m s⁻² the latitude moves it. Not a number for a coordinate that is not one.
Trait Implementations§
impl Copy for Geodetic
impl StructuralPartialEq for Geodetic
Auto Trait Implementations§
impl Freeze for Geodetic
impl RefUnwindSafe for Geodetic
impl Send for Geodetic
impl Sync for Geodetic
impl Unpin for Geodetic
impl UnsafeUnpin for Geodetic
impl UnwindSafe for Geodetic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.