Advertisement
Kyace

hover2.ks

Aug 3rd, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. LOCK alt TO SHIP:ALTITUDE.
  2. LOCK vertspd to SHIP:VERTICALSPEED.
  3. SET level to 100.
  4. LOCK P to level - alt.
  5. SET I to 0.
  6. SET D to 0.
  7. SET P0 to P.
  8.  
  9. SET Kp to 0.3.
  10. SET Ki to 0.05.
  11. SET Kd to 0.4.
  12.  
  13. LOCK dthrott to Kp * P + Ki * I + Kd * D.
  14.  
  15. LOCK steering TO UP.
  16.  
  17. SET thrott to 1.
  18. SET fall to 3.
  19.  
  20. LOCK THROTTLE to thrott.
  21. WAIT 1.
  22. STAGE.
  23.  
  24. SET t0 TO TIME:SECONDS.
  25. SET start_time to TIME:SECONDS.
  26. SET work to "on".
  27. UNTIL work = "off" {
  28. SET dt TO TIME:SECONDS - t0.
  29. IF dt > 0 {
  30. SET I TO I + P * dt.
  31. SET D TO (P - P0) / dt.
  32. SET thrott to dthrott.
  33. SET P0 TO P.
  34. SET t0 TO TIME:SECONDS.
  35. }
  36. SET MET to TIME:SECONDS - start_time.
  37. IF MET > 45 {
  38. SET level to 100 - MET/fall.
  39. SET Ki to 0.01.
  40. //SET Kd to 0.1.
  41. }
  42. IF MET > (45+28*fall/2) {
  43. SET work to "off".
  44. SET engines TO SHIP:PARTSDUBBED("LiquidEngineMini").
  45. FOR eng IN engines{
  46. eng:GETMODULE("ModuleEnginesFX"):DOEVENT("shutdown engine").
  47. }
  48. UNLOCK THROTTLE.
  49. UNLOCK STEERING.
  50. }
  51. WAIT 0.001.
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement