This repository was archived by the owner on Dec 24, 2023. It is now read-only.
This repository was archived by the owner on Dec 24, 2023. It is now read-only.
Geodetic height, latitude, and longitude calculation #4
Open
Description
This would allow computing the geodetic height, latitude, and longitude of a given state.
Requires
- Flattening coefficient of an ellipsoid
- A body-fixed frame definition is needed for the correct computation, but we should only check that at runtime if the function is called from a context (which would provide the flattening coefficient).
Reference:
Reference: G. Xu and Y. Xu, “GPS”, DOI 10.1007/978-3-662-50367-6_2, 2016
Proposed signatures
In the algorithms module
/// From the provided radius vector, the reference body in equatorial radius in **the same units** as the radius,
/// and the flatenning ratio (unitless), return the geodetic height in the units of the previous variables,
/// geodetic latitude in degrees, and geodetic longitude in degrees.
pub fn geodetic_coord_from(radius_vec: &Vector3, eq_radius: f64, flatenning: f64) -> Result<(f64, f64, f64), AniseError> {}
pub fn geodetic_height_from(radius_vec: &Vector3, eq_radius: f64, flatenning: f64) -> Result<f64, AniseError> {}
pub fn geodetic_latitude_from(radius_vec: &Vector3, eq_radius: f64, flatenning: f64) -> Result<f64, AniseError> {}
pub fn geodetic_longitude_from(radius_vec: &Vector3, eq_radius: f64, flatenning: f64) -> Result<f64, AniseError> {}
In an Anise context
/// Compute the geodetic coordinates of the requested ephemeris as seen from the requested body fixed frame.
/// Will return an error if the `seen_by` parameter is missing either `eq_radius` or `flatenning` constants in
/// its `Orientation` structure, or the `eq_radius` constant is not in a recognized distance unit (`m`, `km`, more?).
impl Anise {
// (...)
/// Example:
/// let (height, lat, lng) = anise_context.geodetic_coord(&my_spacecraft_traj, my_epoch, &earth_iau).unwrap();
pub fn geodetic_coord(&self, obj: &Anise.Ephemeris, at: Anise.Epoch, seen_by: &Frame) -> Result<(f64, f64, f64), AniseError> {}
// (...)
}
pub struct Frame<'a> {
ephem: &'a Anise.Ephemeris,
orient: &'a Anise.Orientation,
}
Prior implementations:
- SPICE: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recgeo_c.html
- Supported and validated in Nyx: https://docs.rs/nyx-space/latest/nyx_space/struct.Orbit.html#method.geodetic_height , https://docs.rs/nyx-space/latest/nyx_space/struct.Orbit.html#method.geodetic_latitude , https://docs.rs/nyx-space/latest/nyx_space/struct.Orbit.html#method.geodetic_longitude .
Tests proposed:
Validation test cases
- 5 arbitrary test case from SPICE (more?)
- 5 specific test cases near each Earth pole
- 5 specific test cases near each Moon pole
Formal testing
- For all {x, y, z} between +/- 100,000 kilometers, the latitude should be between +/- 90 degrees and the longitude between +/- 180 degrees.