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

Add examples / how-to #328

Merged
merged 21 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
15c83bc
Add high fidelity orbit propagation example
ChristopherRabotin Jun 29, 2024
fc7925e
Add OEM export back into Spacecraft Trajectory
ChristopherRabotin Jun 29, 2024
a0c217c
Improve 01_orbit_prop readme and add plots
ChristopherRabotin Jun 29, 2024
8d9ca6e
Clean up 01_orbit_prop example
ChristopherRabotin Jun 30, 2024
f9d1abe
Update README.md
ChristopherRabotin Jun 30, 2024
81c222d
Add SpacecraftUncertainty to remove boilerplate
ChristopherRabotin Jul 1, 2024
d26ce0e
Monte Carlo support all random Nyx state distrib.
ChristopherRabotin Jul 1, 2024
e507da9
Fix exporting MC results
ChristopherRabotin Jul 2, 2024
3a696ca
Analysis of JWST leads to a Github issue
ChristopherRabotin Jul 2, 2024
ea28fe2
Uncertainty in Keplerian looks odd with OrbitDual
ChristopherRabotin Jul 2, 2024
046b7ff
Working on improving the Spacecraft uncertainty tests
ChristopherRabotin Jul 2, 2024
e3f778a
Fix RIC to inertial for uncertainty struct
ChristopherRabotin Jul 2, 2024
413b134
OD export now includes sigmas in integr. and RIC
ChristopherRabotin Jul 3, 2024
be8ead8
Renamed state params and add state sigma calcs
ChristopherRabotin Jul 3, 2024
448f473
Fix tests after changing export columns
ChristopherRabotin Jul 3, 2024
f45c73e
OD export limited to spacecraft estimations
ChristopherRabotin Jul 3, 2024
ac9f52f
Clippy
ChristopherRabotin Jul 3, 2024
ae4719e
Wrap up 02 JWST example
ChristopherRabotin Jul 4, 2024
6ebe6e7
Switch version to 2.0.0-rc
ChristopherRabotin Jul 4, 2024
4d2cf73
Format code
ChristopherRabotin Jul 4, 2024
779567a
Clippy
ChristopherRabotin Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,21 @@ assignees: ''

---

## Description
## Description

Please describe the issue or enhancement you want to report. Provide as much detail as possible to help us understand and address it.

## Documentation type
## Documentation type

Tell us which of the four Diátaxis documentation types this issue or enhancement relates to:

- Tutorial
- How-to guide
- Technical reference / Math Spec
- Explanation

## Affected area(s)

For the selected documentation type, tell us what specific area(s) this issue relates to. Provide titles, page numbers, URLs or other locators.
- [ ] Tutorial
- [ ] How-to guide
- [ ] Technical reference / Math Spec
- [ ] Explanation

## Expected or desired behavior

Tell us what you expected to see in the documentation, or how you think it could be improved. For enhancements, describe the improvement you think could be made.

## Additional context

Provide any other context or screenshots that would help us understand the issue or enhancement.

## Possible solutions (optional)

If you have any suggestions for how to address the issue or implement the enhancement, provide them here. We appreciate any insights you have!

## Who should review this?

Tag any individuals, teams, or roles that would likely need to review or address this issue for the specified documentation type.
Tell us what you expected to see in the documentation, or how you think it could be improved. For enhancements, describe the improvement you think could be made, including URLs to the documentation if available.

We will do our best to direct this to the appropriate people. Thank you for your feedback!
<!-- Thank you for your feedback! -->
5 changes: 5 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ jobs:
- name: Doc Test
run: cargo test --doc

- name: Run examples
run: |
cargo run --example 01_orbit_prop --release
cargo run --example 02_jwst --release

lints:
name: Lints
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules/
*.venv*
dist/
*.parquet
*.oem
*.profraw
lcov.txt
.DS_Store
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "nyx-space"
build = "build.rs"
version = "2.0.0-beta.1"
version = "2.0.0-rc"
edition = "2021"
authors = ["Christopher Rabotin <[email protected]>"]
description = "A high-fidelity space mission toolkit, with orbit propagation, estimation and some systems engineering"
Expand All @@ -26,6 +26,7 @@ exclude = [
"Dockerfile*",
"rustfmt.toml",
"tests/GMAT_scripts/*",
"*.png",
]

[badges]
Expand Down Expand Up @@ -96,3 +97,11 @@ name = "nyx_space"
# For flamegraph -- https://github.com/flamegraph-rs/flamegraph
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Clink-arg=-Wl,--no-rosegment"]

[[example]]
name = "01_orbit_prop"
path = "examples/01_orbit_prop/main.rs"

[[example]]
name = "02_jwst"
path = "examples/02_jwst_covar_monte_carlo/main.rs"
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
# Nyx: Revolutionizing Flight Dynamics
# Nyx: Comprehensive Spaceflight Dynamics

**Blazing fast from mission concept to operations, and automation.** -- [https://nyxspace.com/](https://nyxspace.com/)
[**Empowering flight dynamics engineers with open-source software**](https://nyxspace.com/)

Nyx is provided under the AGPLv3 License. By using this software, you assume responsibility for adhering to the license. Refer to [the pricing page](https://nyxspace.com/pricing/) for an FAQ on the AGPLv3 license.
Nyx is revolutionizing the field of flight dynamics engineering as a powerful, open-source tool for mission design and orbit determination. From trajectory optimization to orbit estimation, Nyx is built for speed, automation, and scalability. It dramatically reduces simulation time compared to commercial products, and integrates seamlessly into automated workflows across various platforms.

**Nyx has proven mission-critical reliability, already contributing to the success of three lunar missions.**

![Static Badge](https://img.shields.io/badge/Nyx_Space-Website-orange?link=https%3A%2F%2Fnyxspace.com%2F)
![Contact Form](https://img.shields.io/badge/Nyx_Space-Contact-orange?link=https%3A%2F%2F7ug5imdtt8v.typeform.com%2Fto%2FneFvVW3p)

[![nyx-space on crates.io][cratesio-image]][cratesio]
[![nyx-space on docs.rs][docsrs-image]][docsrs]
[![LoC](https://tokei.rs/b1/github/nyx-space/nyx?category=lines)](https://github.com/nyx-space/nyx).
[![codecov](https://codecov.io/gh/nyx-space/nyx/graph/badge.svg?token=gEiAvwzwh5)](https://codecov.io/gh/nyx-space/nyx)

# Documentation

The documentation is currently being updated. If you have specific use cases you would like to see documented, please [open a Github issue](https://github.com/nyx-space/nyx/issues/new?assignees=&labels=Documentation&projects=&template=documentation.md&title=) or [use the contact form](https://7ug5imdtt8v.typeform.com/to/neFvVW3p).

## Quick start

### Rust

To install Nyx, follow these steps:
1. Clone the repository: `git clone https://github.com/nyx-space/nyx.git`
2. Navigate to the directory: `cd nyx`
3. Run any of the [examples](./examples/), e.g. `RUST_LOG=info cargo run --example 01_orbit_prop --release`

### Python

For Python projects, get started by installing the library via `pip`: `pip install nyx_space`.

**Important:** The Python package has been temporarily disabled. Refer to <https://github.com/nyx-space/nyx/issues/311> for details.

# License

Nyx is provided under the [AGPLv3 License](./LICENSE). By using this software, you assume responsibility for adhering to the license. Refer to [the pricing page](https://nyxspace.com/pricing/) for an FAQ on the AGPLv3 license. Notably, any software that incorporates, links to, or depends on Nyx must also be released under the AGPLv3 license, even if you distribute an unmodified version of Nyx.


[cratesio-image]: https://img.shields.io/crates/v/nyx-space.svg
[cratesio]: https://crates.io/crates/nyx-space
[docsrs-image]: https://docs.rs/nyx-space/badge.svg
[docsrs]: https://docs.rs/nyx-space/
[docsrs]: https://rustdoc.nyxspace.com/

# Author information
> Chris Rabotin is a GNC and flight dynamics engineer with a heavy background in software.

## Who am I?
An GNC and flight dynamics engineer with a heavy background in software. I currently work for Rocket Lab USA on the Blue Ghost lunar lander. -- Find me on [LinkedIn](https://www.linkedin.com/in/chrisrabotin/).
I currently work for Rocket Lab USA as the lead flight dynamics engineer on both Blue Ghost lunar lander missions. -- Find me on [LinkedIn](https://www.linkedin.com/in/chrisrabotin/).
37 changes: 37 additions & 0 deletions examples/01_orbit_prop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Orbit propagation

Propagating an orbit is the core of any astrodynamics analysis. In this example, you'll learn how to propagate an orbit state using basic two body dynamics or using a high fidelity propagator with the point masses of the Moon and Sun, solar radiation pressure, and a 21x21 gravity field.

Then, you'll learn how to build some data products as dataframes using polars, and how to export the propagated trajectory as a CCSDS OEM file.

To run this example, just execute:
```sh
RUST_LOG=info cargo run --example 01_orbit_prop --release
```

Building in `release` mode will make the computation significantly faster. Specifying `RUST_LOG=info` will allow you to see all of the information messages happening in ANISE and Nyx throughout the execution of the program.

## Data products

1. Export the trajectory as a CCSDS OEM version 2.0 file and as a parquet file, which includes the Keplerian orbital elements. This can be quickly analyzed and plotted in Python.
2. Compare the difference in the radial, in-track, cross-track frame between the high fidelity and two-body/Keplerian propagation. The RIC frame is commonly used to compute the difference in position and velocity of different spacecraft. Build a Dataframe from this data and print
3. Build a Dataframe containing the azimuth, elevation, range, and range-rate data of that spacecraft as seen from Boulder, CO, USA. Print out when the spacecraft has an elevation of 15 degrees or above on the horizon.

## Force models

The force models used here are akin to STK's "HPOP" propagator. Specifically, this example runs with the following models:
- Point masses of the Earth, Moon, and Sun, where the gravitational parameters are sourced from NASA's [pck00011.tpc](https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00011.tpc) file (note that these differ slightly from GMAT's values). The planetary ephemeris used is the DE440s.bsp, provided by NASA as well.
- Solar radiation pressure, with only the Earth as an eclipsing body
- Spherical Harmonics of the Earth of order and degree 21x21, computed in the IAU Earth frame. The data comes from the JGM3 gravitational model, downloaded automatically using ANISE's `MetaFile` downloading and local caching mechanism. This is the default gravity field model of GMAT.

## Quick analysis

In two body propagation, all orbital elements remain constant apart from the true anomaly. In real life, the oblateness of the Earth causes the right ascension of the ascending node to drift with time (red line below). The other force models also affect the overall orbit.

![RAAN, AOP, INC over time](./cubesat-angles-v-time.png)

![SMA (km) over time](./cubesat-sma-v-time.png)

![ECC over time](./cubesat-ecc-v-time.png)

_Note_: These plots were generated with an SRP area of that was ten times larger than the correct value, hence you may notice slightly different Keplerian orbital elements, notably for the change in the shape of the orbit.
Binary file added examples/01_orbit_prop/cubesat-angles-v-time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/01_orbit_prop/cubesat-ecc-v-time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/01_orbit_prop/cubesat-sma-v-time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading