wirawafiy1

Boost back guidance

Oct 27th, 2023
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. Clearscreen.
  2. if ADDONS:TR:AVAILABLE {
  3. if ADDONS:TR:HASIMPACT {
  4. PRINT ADDONS:TR:IMPACTPOS.
  5. } else {
  6. PRINT "Impact position is not available".
  7. }
  8. } else {
  9. PRINT "Trajectories is not available.".
  10. }
  11. SET runMode to 0.
  12.  
  13. when throttle = 0 then {
  14. set STEERINGMANAGER:MAXSTOPPINGTIME to 15.
  15. set STEERINGMANAGER:PITCHPID:KD to 2.
  16. set STEERINGMANAGER:YAWPID:KD to 2.
  17. preserve.
  18. }
  19.  
  20. when throttle > 0 then {
  21. set STEERINGMANAGER:MAXSTOPPINGTIME to 15.
  22. set STEERINGMANAGER:PITCHPID:KD to 1.
  23. set STEERINGMANAGER:YAWPID:KD to 1.
  24. preserve.
  25. }
  26. RCS on.
  27. SAS off.
  28. SET landingpad TO latlng(-0.0556982365026111,-74.5090489030054). //change to your landing pad latitude and longtitude
  29. SET targetDistOld TO 0.
  30. SET landingpoint TO ADDONS:TR:IMPACTPOS.
  31. set lngoff to (landingpad:LNG - ADDONS:TR:IMPACTPOS:LNG)*10472.
  32. set latoff to (landingpad:LAT - ADDONS:TR:IMPACTPOS:LAT)*10472.
  33. RCS on.
  34. lock steering to heading ((landingpad:heading-180), 40). //all this is used to get around the problem of kOS' slow and inefficient steering problem
  35. wait 0.5.
  36. lock steering to heading ((landingpad:heading-180), 50).
  37. wait 0.5.
  38. lock steering to heading ((landingpad:heading-180), 60).
  39. wait 0.5.
  40. lock steering to heading ((landingpad:heading-180), 70).
  41. wait 0.5.
  42. lock steering to heading ((landingpad:heading-180), 80).
  43. wait 0.5.
  44. lock steering to lookDirUp( up:forevector, ship:facing:topvector).
  45. lock steering to heading (landingpad:heading, 80).
  46. wait 0.5.
  47. lock steering to heading (landingpad:heading, 70).
  48. wait 0.5.
  49. lock steering to heading (landingpad:heading, 60).
  50. wait 0.5.
  51. lock steering to heading (landingpad:heading, 50).
  52. wait 0.5.
  53. lock steering to heading (landingpad:heading, 40).
  54. wait 0.5.
  55. lock steering to heading (landingpad:heading, 30).
  56. wait 0.5.
  57. lock steering to heading (landingpad:heading, 20).
  58. wait 0.5.
  59. lock steering to heading (landingpad:heading, 10).
  60. wait 0.5.
  61. lock steering to heading (landingpad:heading, 0).
  62. wait 0.5.
  63. toggle AG1.//switches from all engines to three engine mode. delete this if you have a different acion group assigned/using a different vessel.
  64. lock throttle throttle to 1.
  65. RCS off.
  66. when altitude > 4000 then {
  67. set lngoff to (landingpad:LNG - ADDONS:TR:IMPACTPOS:LNG)*10472.
  68. set latoff to (landingpad:LAT - ADDONS:TR:IMPACTPOS:LAT)*10472.
  69. wait 0.1.
  70. preserve.
  71. }
  72.  
  73. when lngoff > 1000 then {
  74.  
  75. lock throttle to 0.4.
  76. }
  77.  
  78. when lngoff > 2000 then { //how far past the landing pad your impact position should be so that after the entry burn the impact position will be roughly near the landing pad. Experiment with this until you get what you desire.
  79. SET throttle TO 0.
  80. unlock throttle.
  81. unlock steering.
  82. wait until ship:verticalspeed < -300.
  83. run Landing. //landing guidance start
  84. }
  85. //fine tuning values for latitude
  86. When throttle > 0 then {
  87. when latoff < -20 then {
  88. lock steering to heading (landingpad:Heading - 2,0).
  89. preserve.
  90. }
  91.  
  92. when latoff > 20 then {
  93. lock steering to heading (landingpad:heading + 2,0).
  94. preserve.
  95. }
  96.  
  97. }
  98.  
  99. wait until ship:verticalspeed < -5.
  100. print "Boostback burn succesful". //I reccommend turning on Mechjeb's SVEL- for this coast phase
  101. unlock steering.
  102. wait until ship:verticalspeed < 300.
  103. run Landing.
  104.  
Add Comment
Please, Sign In to add comment