Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read SPK files directly #36

Conversation

ChristopherRabotin
Copy link
Member

@ChristopherRabotin ChristopherRabotin commented Nov 18, 2022

This replaces the ASN1 based Ephemeris and Orientation data. There may be a future use case for orientation data that is in ASN.1 encoding, but SPK files are way too common in the industry to require folks to switch from one file type to another.

This structure whoever removes the need to unload (or unfurnsh) files thanks to the proper use of lifetimes in Rust.

I will need to check whether one can deliberately violate these lifetimes in C (they might!).

TODO:

  • Better tests using the parquet file
  • Setup CSPICE in the pipeline using the shell script
  • Fix Github test
  • Add CLI testing

Closes #15 . Closes #30

ChristopherRabotin and others added 30 commits October 20, 2022 18:11
Use the dev-env-setup.sh script to install CSPICE on Linux

Exhaustive tests show some errors to be very large (0.1 meters), and I'm not sure why

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Lots of refactoring that helps me understand where things live

Two important tasks coming up:
1. Add a Cartesian State type
2. Copy the Orbit type from Nyx
3. Change the SPICE reading to not use any allocation so that an ANISE structure can be built and used without creating a file.

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Will now write the API to build frames

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
MAX TRAJ seems to be limited to 31 items. That is probably not large enough to be usable.

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Co-authored-by: Chris de Claverie <c.de-claverie@protonmail.com>
Co-authored-by: Grégoire Henry <greg.henry@mail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
I actually can't believe this works, but this is FANTASTIC!
I'll implement this for all of the other types, and that should significantly reduce stack size

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
I don't know how to allow a Vec to move into a large lifetime...
There is a big issue when building a DataArray: we don't know how many items exist, so we need an allocator.

If the solution is to allow for allocs when building, that's OK, but
then we can't easily read data from SPICE without allocating before reading.

The only good thing here is that we use very little stack space for passing the data around

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Can now correctly parse PCK summaries!

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Almost done with Hermite unequal step, I think.

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Co-authored-by: Chris de Claverie <c.de-claverie@protonmail.com>
Co-authored-by: Grégoire Henry <greg.henry@mail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
I'm likely taking one too many or one too few samples causing the interpolation to be slightly off.

Added a bunch of debugging messages

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
My algorithm to build the polynomial is probably wrong. Although it works perfectly for the example of SPICE

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
The reference does not exactly use divided differences but it obviously leads to more precise computation

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
@ChristopherRabotin
Copy link
Member Author

Works, when using exactly the same algorithm as SPICE.

Validation of a GMAT-generated SPK file, sampled 999 times over 3h 20 mins:

shape: (1, 7)
┌─────────────────────┬─────────────────────┬──────────────────────┬────────────────────────┬─────────────────────┬─────────────────────┬─────────────────────┐
│ min rel err (km) OK ┆ q25 rel err (km) OK ┆ mean rel err (km) OK ┆ median rel err (km) OK ┆ q75 rel err (km) OK ┆ q99 rel err (km) OK ┆ max rel err (km) OK │
│ ---                 ┆ ---                 ┆ ---                  ┆ ---                    ┆ ---                 ┆ ---                 ┆ ---                 │
│ f64                 ┆ f64                 ┆ f64                  ┆ f64                    ┆ f64                 ┆ f64                 ┆ f64                 │
╞═════════════════════╪═════════════════════╪══════════════════════╪════════════════════════╪═════════════════════╪═════════════════════╪═════════════════════╡
│ 0.0                 ┆ 6.2677e-16          ┆ 3.7227e-13           ┆ 1.6674e-15             ┆ 6.0504e-13          ┆ 1.5941e-12          ┆ 1.6198e-12          │
└─────────────────────┴─────────────────────┴──────────────────────┴────────────────────────┴─────────────────────┴─────────────────────┴─────────────────────┘
shape: (1, 7)
┌──────────────────┬──────────────────┬───────────────────┬─────────────────────┬──────────────────┬──────────────────┬──────────────────┐
│ min abs err (km) ┆ q25 abs err (km) ┆ mean abs err (km) ┆ median abs err (km) ┆ q75 abs err (km) ┆ q99 abs err (km) ┆ max abs err (km) │
│ ---              ┆ ---              ┆ ---               ┆ ---                 ┆ ---              ┆ ---              ┆ ---              │
│ f64              ┆ f64              ┆ f64               ┆ f64                 ┆ f64              ┆ f64              ┆ f64              │
╞══════════════════╪══════════════════╪═══════════════════╪═════════════════════╪══════════════════╪══════════════════╪══════════════════╡
│ 0.0              ┆ 6.6034e-9        ┆ 2.3705e-7         ┆ 3.2869e-8           ┆ 2.0364e-7        ┆ 0.000002         ┆ 0.000003         │
└──────────────────┴──────────────────┴───────────────────┴─────────────────────┴──────────────────┴──────────────────┴──────────────────┘
shape: (59, 6)
┌─────────────────────┬─────────────────────┬──────────────────┬──────────────────────┬───────────────────┬───────────┐
│ absolute error (km) ┆ relative error (km) ┆ File delta T (s) ┆ source frame         ┆ destination frame ┆ component │
│ ---                 ┆ ---                 ┆ ---              ┆ ---                  ┆ ---               ┆ ---       │
│ f64                 ┆ f64                 ┆ f64              ┆ str                  ┆ str               ┆ str       │
╞═════════════════════╪═════════════════════╪══════════════════╪══════════════════════╪═══════════════════╪═══════════╡
│ 0.000002            ┆ 1.5348e-12          ┆ 3252.000002      ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 1.4980e-12          ┆ 3348.000002      ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000003            ┆ 1.4459e-12          ┆ 3444.000002      ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 1.4383e-12          ┆ 3456.000002      ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ ...                 ┆ ...                 ┆ ...              ┆ ...                  ┆ ...               ┆ ...       │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 9.7376e-13          ┆ 11244.000005     ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 1.0935e-12          ┆ 11340.000005     ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 1.2020e-12          ┆ 11436.000006     ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ 0.000002            ┆ 1.2981e-12          ┆ 11532.000006     ┆ body -10000001 J2000 ┆ Earth J2000       ┆ Y         │
└─────────────────────┴─────────────────────┴──────────────────┴──────────────────────┴───────────────────┴───────────┘

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Eventually, I'll remove F64TupleArray

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Eventually, I'll remove F64TupleArray

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
…-anise-file-equivalent' of github.com:anise-toolkit/anise.rs into 30-spice-bsp-files-should-be-usable-without-needing-the-anise-file-equivalent
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
@ChristopherRabotin ChristopherRabotin added CLI-tools Command line interface API: rust Related to the Rust API labels Nov 28, 2022
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Hopefully this also stores the artifacts, but I'm not sure this will work

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
Might add it back latter if we have a need for custom serialization.
This work removes all custom serialization
@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@b62e311). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #36   +/-   ##
=========================================
  Coverage          ?   30.15%           
=========================================
  Files             ?       37           
  Lines             ?     2557           
  Branches          ?        0           
=========================================
  Hits              ?      771           
  Misses            ?     1786           
  Partials          ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
…-anise-file-equivalent' of github.com:anise-toolkit/anise.rs into 30-spice-bsp-files-should-be-usable-without-needing-the-anise-file-equivalent
Signed-off-by: Christopher Rabotin <christopher.rabotin@gmail.com>
@ChristopherRabotin ChristopherRabotin merged commit 6d6d320 into master Dec 3, 2022
@ChristopherRabotin ChristopherRabotin deleted the 30-spice-bsp-files-should-be-usable-without-needing-the-anise-file-equivalent branch December 3, 2022 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: rust Related to the Rust API CLI-tools Command line interface
Projects
None yet
3 participants