Skip to content
This repository was archived by the owner on Dec 24, 2023. It is now read-only.

Geodetic height, latitude, and longitude calculation #4

Open
ChristopherRabotin opened this issue Dec 13, 2021 · 0 comments
Open

Geodetic height, latitude, and longitude calculation #4

ChristopherRabotin opened this issue Dec 13, 2021 · 0 comments
Labels
proposed A proposed functionality supported-functions Related to the functions provided by ANISE

Comments

@ChristopherRabotin
Copy link
Member

ChristopherRabotin commented Dec 13, 2021

This would allow computing the geodetic height, latitude, and longitude of a given state.

Requires

  1. Flattening coefficient of an ellipsoid
  2. 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:

  1. SPICE: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recgeo_c.html
  2. 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

  1. 5 arbitrary test case from SPICE (more?)
  2. 5 specific test cases near each Earth pole
  3. 5 specific test cases near each Moon pole

Formal testing

  1. For all {x, y, z} between +/- 100,000 kilometers, the latitude should be between +/- 90 degrees and the longitude between +/- 180 degrees.
@ChristopherRabotin ChristopherRabotin added supported-functions Related to the functions provided by ANISE proposed A proposed functionality labels Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
proposed A proposed functionality supported-functions Related to the functions provided by ANISE
Projects
None yet
Development

No branches or pull requests

1 participant