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

Draft: Show Examples in a GUI #264

Closed
wants to merge 3 commits into from

Conversation

philiplinden
Copy link

@philiplinden philiplinden commented Dec 21, 2023

Nyx Examples

This pull request includes self-contained crates that implement some of the examples shown in the docs: Lunar transfer, Orbit design from a genetic algorithm. It also demonstrates displaying the results with egui.

I don't think Nyx needs a front end, but here's a way to do it if you want one.

Motivation

I was very annoyed by the workflow needed to visualize trajectories and orbits. In order to generate plots, I had set up a sim, generate a trajectory, export the trajectory to Parquet files, read the Parquet files to a dataframe, and then plot the dataframe in Plotly. Yikes.

I was impressed by the plot demos on the egui demo page and was curious to see if orbits and trajectories could be plotted straight away as an egui plot.

Approach

  • Native GUI with eframe. WASM is intimidating, but egui runs natively too. I did some experiments with Bevy but it was a loooot of overhead. Since Nyx is basically its own physics engine, a simple UI with line plots should be enough for now. eframe is a simple GUI framework that is the backend for the egui demo that I liked, so I went with that.
  • Reproduce Python visualizations and documented demos. Self explanatory. It's nice to start from a baseline instead of potentially introducing new bugs from making my own scenario from scratch.
  • As a self-contained crate. Nyx has no examples, and the GUI doesn't change any core functions of Nyx. It makes more sense to provide this as an interactive example for folks curious about Nyx to build and learn from themselves.

Results

The proof of concept is there, but it's rough.

  • Able to change simulation inputs from the GUI
  • Orbital parameters change as orbit is propagated.
  • Trajectories plotted as a set of line plots.
  • Trajectories plotted in 3D.

Future work

  • Real-time plotting as propagations progress
  • Compiling to WASM and embedding in the nyx-space docs as an interactive demo.

Ancillary info

Effects

  • Adds examples/ to the top level directory.
  • All examples contained within are self-contained. No impact to existing codes.

If this is a new feature or a bug fix ...

  • Yes, the branch I'm proposing to merge is called issue-xyz where xyz is the number of the issue.

If this change adds or modifies a validation case

  • No.
  • Yes and:
    • I have coded up, or updated, an existing test case; and
    • I have provided a GMAT script which confirms the result(s); and
    • I have updated the VALIDATION.md file with the new error data between nyx and GMAT.
    • I will specify the version of GMAT used for the validation.

@philiplinden philiplinden marked this pull request as draft December 21, 2023 22:28
@philiplinden
Copy link
Author

It's too soon to merge anything with the main branch. Creating this PR was premature. I'll keep working on this from my fork: https://github.com/philiplinden/nyx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant