Giter Site home page Giter Site logo

kerbal2's Introduction

Kerbal Space Program 2

Automation for KSP2 written with KontrolSystem2.

Installation

Tested with the Steam version of Kerbal Space Program 2, but it should work with any version.

  1. Install Kontrolsystem2, the easiest way to do this is via CKAN as it will pull in all needed dependencies.
  2. Clone this GitHub repo in a directory of your choice. Once cloned, go into the BepInEx configuration and set the "localLibPath" to this directory. You can alternatively copy the files from this project into the KSP2/BepInEx/plugins/KontrolSystem2/to2Local directory.

Now when you launch KSP2 and select the rightmost icon at the center bottom (looks like 3x3 squares) there should be a new option "Kontrol System 2"

Using the scripts

Right now there are the following missions:

  • launch_to_orbit: launches a vessel into low Kerbin orbit.
  • land_athmosphere: lands a vessel from orbit around Kerbin. Assumes you have parachutes. Tries to land near the KSC.
  • go_mun : Launches a vessel to the Mun and lands in a flat area near the Mun's equator. Needs enough delta_v to get there.
  • go_minmus : Launches a vessel to Minmus and lands it... somewhere.
  • return_to_kerbin: returns to kerbin from a moon in the Kerbin system. Tested with the Mun. Assumes you have parachutes

The scripts will stage as needed. Debug and status output is shown in the console, opening it is highly recommended.

Phases of a Mission

Initially the vessel is launched, gravity turn is performed and we climb to close to the target apoapsis. Usually an additional burn is performed to fune tune once we have exited the atmosphere. After circularization, we check if the inclination needs to be change.

Then the transfer is planned. For anything but Mun, the transfer from Kerbin will happen in two phases:

  1. An initial burn to get on an escape trajectory from Kerbin
  2. A second burn executed above 100k km altitude to fine tune the trajectory and get a good encounter

After the correction burn, we wait until we are in the spehere of influence (SOI) of the target body. Once that is the case, we circularize, lower periapsis and lower apopasis to the target orbit height.

Last we pick a spot to land, slow down close to that spot and the auto lander plans and executed a (hopefully) soft landing. Right now landing spots are hardcoded, we do no check the terrain for suitability.

Return starts with an initial burn to an apoapsis that is circularized. We then claculate ejection angles (at least in the Kerbin system) and perform an ejection burn. This should put us into an elliptical orbit around Kerbin. We then wait for the Apoapsis, lower periapsis and attempt aero capture. This may happen over a number of passes to reduce heat.

Once Periapsis is below sea level, the landing code takes over, waits for safe opening of parachutes and lands.

Most scripts are written that they can be aborted and re-started at most time. Quicksave is your friend.

Where to get help with the scripts

Best place to get help are the KSP forums.

If you encounter a bug or have a suggestions, please file it here on GitHub.

kerbal2's People

Contributors

appenz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

andymt

kerbal2's Issues

Issue with glib

Hi,
I just starting with TO2, and your code seems to be a good starting point.

Unfortunatly, It seems to be issue in the glib.
I can't boot KS2

Rebooted in 00:00:01.7258968
ERROR: [glib\transfer.to2(61, 132)] IncompatibleTypes
Cannot BitXor a float with a int
ERROR: [glib\transfer.to2(61, 45)] ArgumentMismatch
Argument d of 'sqrt' has to be a float, but Unit was given
ERROR: [glib\transfer.to2(67, 78)] IncompatibleTypes
Cannot BitXor a float with a float
ERROR: [glib\transfer.to2(67, 18)] IncompatibleTypes
Cannot Mul a float with a Unit
ERROR: [glib\transfer.to2(67, 122)] IncompatibleTypes
Cannot BitXor a Unit with a float
ERROR: [glib\transfer.to2(66, 5)] IncompatibleTypes
Function 'hohmannTime' returns Unit but should return float

I try to make some change, with no succes. I have to read the TO2 specs ;)

The first line in error :

sync fn hohmannPhaseAngle(self, alt_start: float, alt_end: float, o: Orbit) -> float = {
    return 180*(1-(1/(2*sqrt(float2))*sqrt((1+(alt_start+o.reference_body.radius)/(alt_end+o.reference_body.radius))^3)))
}

Maybe each number have to be cast as Float ?

Thx for your help,

DimiBD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.