Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. PARAMETER launchCompassHeading.
  2. PARAMETER launchTargetApoapsis.
  3. PARAMETER launchTargetPeriapsis.
  4.  
  5. SET ascentProfile TO LIST(
  6. //tiltAltitude, tiltPitch
  7. 0, 90,
  8. 1000, 87.5,
  9. 2000, 85,
  10. 2500, 82.5,
  11. 3000, 80,
  12. 3500, 77.5,
  13. 4000, 75,
  14. 4500, 72.5,
  15. 5000, 70,
  16. 5500, 67.5,
  17. 6000, 65,
  18. 6500, 62.5,
  19. 7000, 60,
  20. 7500, 57.5,
  21. 8000, 55,
  22. 8500, 52.5,
  23. 9000, 50,
  24. 9500, 47.5,
  25. 10000, 45
  26. ).
  27.  
  28. FUNCTION NOTIFY {
  29. PARAMETER notifyMessage.
  30. PARAMETER notifyColour.
  31. HUDTEXT (notifyMessage, 5, 2, 50, notifyColour, false).
  32. }
  33.  
  34. FUNCTION TILT {
  35. PARAMETER tiltAltitude.
  36. PARAMETER tiltPitch.
  37. UNTIL FALSE {
  38. IF altitude > tiltAltitude {
  39. LOCK steering TO heading(launchCompassHeading, tiltPitch).
  40. BREAK.
  41. }
  42. }
  43. }
  44.  
  45. FUNCTION GTURN {
  46. SET step TO 0.
  47. UNTIL step >= ascentProfile:length - 1 {
  48. TILT(ascentProfile[step], ascentProfile[step + 1]).
  49. SET step TO step + 2.
  50. }
  51. }
  52.  
  53. FUNCTION CLEANSTAGE {
  54. SET previousMaxThrust TO maxThrust.
  55. SET staged TO false.
  56. UNTIL staged = true {
  57. IF maxThrust < (previousMaxThrust - 10) {
  58. NOTIFY("Stage Jettison.", red).
  59. STAGE.
  60. SET staged TO true.
  61. }
  62. }
  63. }
  64.  
  65. FUNCTION ECCENTRICITYCONTROL {
  66. UNTIL periapsis > launchTargetPeriapsis {
  67. IF eta:apoapsis > 10 {
  68. LOCK steering TO HEADING(launchCompassHeading, 355).
  69. BREAK.
  70. }
  71. ELSE IF eta:apoapsis < 5 {
  72. LOCK steering TO HEADING(launchCompassHeading, 5).
  73. BREAK.
  74. }
  75. ELSE {
  76. LOCK steering TO HEADING(launchCompassHeading, 0).
  77. BREAK.
  78. }
  79. }
  80. }
  81.  
  82. NOTIFY("Launch sequence intiated.", green).
  83. WAIT 1.
  84. NOTIFY("Counting down.", green).
  85. WAIT 1.
  86. NOTIFY("5...", yellow).
  87. WAIT 1.
  88. NOTIFY("...4...", yellow).
  89. WAIT 1.
  90. NOTIFY("...3...", yellow).
  91. WAIT 1.
  92. NOTIFY("...2...", yellow).
  93. WAIT 1.
  94. NOTIFY("...1...", yellow).
  95. LOCK THROTTLE to 1.
  96. STAGE.
  97. WAIT 1.
  98. NOTIFY("...lift off!", red).
  99. STAGE.
  100.  
  101. GTURN().
  102.  
  103. CLEANSTAGE().
  104.  
  105. WAIT UNTIL apoapsis > launchTargetApoapsis.
  106.  
  107. NOTIFY("Target apoapsis obtained.", yellow).
  108. NOTIFY("Engine shutoff.", red).
  109. LOCK throttle TO 0.
  110. LOCK steering TO prograde.
  111.  
  112. WAIT UNTIL altitude > 70000.
  113.  
  114. NOTIFY("Atmospheric pressure negligible.", yellow).
  115. NOTIFY("Fairing separation.", red).
  116. STAGE.
  117. WAIT 5.
  118. NOTIFY("Maneuvering for orbital insertion.", red).
  119. LOCK steering TO heading(launchCompassHeading, 5).
  120.  
  121. WAIT UNTIL eta:apoapsis < 10.
  122.  
  123. NOTIFY("Approaching apoapsis.", yellow).
  124. NOTIFY("Burning for orbital insertion.", red).
  125. LOCK throttle TO 1.
  126.  
  127. ECCENTRICITYCONTROL().
  128.  
  129. NOTIFY("Target periapsis obtained.", red).
  130. NOTIFY("Engine shutoff.", red).
  131. LOCK throttle TO 0.
  132. WAIT 1.
  133. NOTIFY("Extending solar arrays.", red).
  134. NOTIFY("Optimising Kerbol angle.", red).
  135. NOTIFY("Extending antenna.", red).
  136. LOCK steering TO sun.
  137. TOGGLE gear.
  138. WAIT 1.
  139. NOTIFY("Stable orbit obtained.", green).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement