JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
248 stars 33 forks source link

Add `geocentric_to_ecef`? #98

Closed PerezHz closed 1 year ago

PerezHz commented 1 year ago

First of all, thanks to all the contributors for this awesome package! Not sure if this has been discussed before, but we have a case in NEOs.jl where it makes sense to have a geocentric_to_ecef transformation available, since that's the representation in which we get some astronomy observatory data. I understand it's possible to do geocentric_to_geodetic and then geodetic_to_ecef, but maybe it makes sense to go directly from spherical to rectangular representation without using geodetic coordinates in between? Many thanks in advance!

EDIT: fix broken link

PerezHz commented 1 year ago

Or maybe this already exists somewhere? I mainly looked at the definitions and exports in src/transformations/geodetic_geocentric.jl

ronisbr commented 1 year ago

Hi @PerezHz !

Thank you very much! Sure, it makes sense. However, SatelliteToolbox.jl is going through a HUGE rewrite. I am splitting this enormous package into smaller ones to make it easier to maintain, install, and use. I will add a geocentric_to_ecef and ecef_to_geocentric to SatellliteToolboxTransformations.jl.

I am just finishing small corrections and very soon this package will be just a wrapper to add all the others modules. For the transformation part, I think nothing has changed. However, there will be lots of breaking changes because I tried to improve the API and fix old bad decisions :)

PerezHz commented 1 year ago

Hi @ronisbr! Thank you for your reply! Now that you mention it, actually what we use the most from SatelliteToolbox are precisely the coordinate/frame transformations applied on instances of the OrbitStateVector struct. Would you say that the SatelliteToolboxTransformations.jl API is nowadays stable enough for us to consider using that package directly?

PerezHz commented 1 year ago

However, there will be lots of breaking changes because I tried to improve the API and fix old bad decisions :)

Recently I heard that sometimes, a holy mess can only be fixed by fire, or something along those lines 😄 ... I think it just means this package is growing and design is changing for the better!

ronisbr commented 1 year ago

Hi @PerezHz !

Hi @ronisbr! Thank you for your reply! Now that you mention it, actually what we use the most from SatelliteToolbox are precisely the coordinate/frame transformations applied on instances of the OrbitStateVector struct. Would you say that the SatelliteToolboxTransformations.jl API is nowadays stable enough for us to consider using that package directly?

This use case is precisely why I am splitting the package! The API is exactly the same as we have now. I am just finishing some parts (not related to transformations) to emit the new SatelliteToolbox. Thus, I did not expect any breaking change, only some missing features (like the geocentric_to_ecef you requested here). I am using it everyday without problems so far :) So, I consider it to be stable.

Recently I heard that sometimes, a holy mess can only be fixed by fire, or something along those lines 😄 ... I think it just means this package is growing and design is changing for the better!

I cannot agree more :) Fortunately, the API for transformations was designed when I had a much better understanding of Julia language. So, it might not be the best API in the world, but it is good enough!

ronisbr commented 1 year ago

Hi @PerezHz !

It is done here:

https://github.com/JuliaSpace/SatelliteToolboxTransformations.jl

julia> using SatelliteToolboxTransformations

julia> geocentric_to_ecef(pi / 4, 0, 7000e3)
3-element StaticArraysCore.SVector{3, Float64} with indices SOneTo(3):
 4.949747468305833e6
 0.0
 4.949747468305832e6

julia> ecef_to_geocentric([7000e3, 0, 7000e3])
(0.7853981633974483, 0.0, 9.899494936611665e6)
PerezHz commented 1 year ago

Many thanks, @ronisbr!