Files
KSP-MGA-Planner/README.md
Nazar Misyats b75a5710b0 Updated README
2025-10-18 01:59:59 -07:00

75 lines
3.6 KiB
Markdown

# Multiple Gravity Assist Trajectory Planner for KSP
An online tool providing automatic design of trajectories with multiple gravity assists for Kerbal Space Program.
See the [**forum post**](https://forum.kerbalspaceprogram.com/index.php?/topic/204391-online-calculator-for-trajectories-with-multiple-gravity-assists/).
![Example trajectory](imgs/example_trajectory_2.png)
## Installation
This section details installation building steps to modify and run the
tool locally. If you are only interested in adding
new solar systems, check the [solar system support section](#solar-systems-support).
This project requires [Node.js](https://nodejs.org/) with the TypeScript compiler. Install it globally with:
```cmd
npm install -g typescript
```
Install the necessary type definitions for [THREE.js](https://github.com/mrdoob/three.js/), [Chart.js](https://github.com/chartjs)
and [js-yaml](https://github.com/nodeca/js-yaml) with:
```cmd
npm ci
```
This project also includes [THREE.js example classes](https://github.com/mrdoob/three.js/tree/dev/examples/js) for line rendering and camera control.
In order to have the TypeScript compiler recognize them, the following lines must be addded to
`node_modules/@types/three/src/Three.d.ts`:
```js
/* Examples imports */
/* Example lines */
export * from '../examples/jsm/lines/Line2';
export * from '../examples/jsm/lines/LineGeometry';
export * from '../examples/jsm/lines/LineMaterial';
/* OrbitControls */
export * from '../examples/jsm/controls/OrbitControls';
```
Compile the project with:
```cmd
tsc -p ./src/tsconfig.json
```
## Solar systems support
The tool can support any solar system configuration. You can contribute to add support for solar systems from known mods.
1. Fork this project and create a new branch for your solar system.
2. Create a new folder in `data` for your system with a `config.yml`
and `bodies.yml` file following the templates in `data/stock`.
- `config.yml` stores the global configurations of the tool. These parameters may need
to be changed depending on the characteristics of the solar system (e.g. duration of a day,
camera clip distances for large solar systems...).
- `bodies.yml` stores the description of each body in the solar system. It must
rigorously follow the template format. If your solar
system uses Kopernicus configuration files, you can directly convert them into
a `bodies.yml` file via [this page](https://krafpy.github.io/KSP-MGA-Planner/tools/cfg-to-yml/).
3. Add an entry to `data/systems.yml` for your solar system.
4. **Test the tool** locally with your system (run the tool on a local HTTP server, e.g. with [VSCode's Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)),
check for the coherence of results and ingame feasibility.
5. Create a pull request to this repository.
## Used resources
- Ceriotti, Matteo (2010) Global optimisation of multiple gravity assist trajectories. PhD thesis.
- Orbital Mechanics for Engineering Students by Howard D. Curtis
- [René Schwarz' website](https://www.rene-schwarz.com/web/Home) and his Memorandum Series
- [Astrodynamics Wikibook](https://en.wikibooks.org/wiki/Astrodynamics)
- [ESA's Lambert Solver script](https://github.com/esa/pykep/blob/master/src/lambert_problem.cpp) for pykep
- [Space Exploration StackExchange](https://space.stackexchange.com/) (more precisely [this](https://space.stackexchange.com/questions/54414/how-to-calculate-the-velocity-vector-in-the-case-of-a-hyperbolic-orbit) and [this](https://space.stackexchange.com/questions/54448/calculating-the-time-of-flight-between-two-anomalies-gives-a-negative-result) post)