Advertisement
wirawafiy1

Orbit test

Oct 26th, 2023 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // kOS Launch Example
  2.  
  3. // Set desired orbit parameters
  4. SET targetApoapsis TO 100000.
  5. SET targetInclination TO 0.
  6.  
  7. // Stage separation altitude
  8. SET separationAltitude TO 25000.
  9.  
  10. // Activate SAS and throttle up
  11. LOCK STEERING TO HEADING(90, 90).
  12. LOCK THROTTLE TO 1.
  13.  
  14. // Launch countdown
  15. WAIT UNTIL COUNTDOWN < 5.
  16.  
  17. // Ignition!
  18. STAGE. // Ignite the first stage
  19.  
  20. // Gravity turn
  21. WAIT UNTIL SHIP:ALTITUDE > separationAltitude. // Begin gravity turn
  22. LOCK STEERING TO HEADING(90, 90 - (SHIP:ALTITUDE / 10000)). // Adjust heading based on altitude
  23.  
  24. // Circularization burn
  25. WAIT UNTIL SHIP:APOAPSIS > targetApoapsis - 10000. // Begin circularization burn
  26. LOCK THROTTLE TO 0.5. // Reduce throttle for a controlled burn
  27.  
  28. // Fine-tune orbit
  29. WAIT UNTIL SHIP:ORBIT:INCLINATION > targetInclination - 1 AND SHIP:ORBIT:INCLINATION < targetInclination + 1. // Adjust inclination
  30. LOCK THROTTLE TO 0. // Turn off engines
  31.  
  32. // Print orbit information
  33. PRINT "Desired Apoapsis: " + targetApoapsis + " m.".
  34. PRINT "Desired Inclination: " + targetInclination + " degrees.".
  35. PRINT "Launch successful!".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement