Advertisement
sumguytwitches

Tsetse Kerbin takeoff

Jun 2nd, 2023 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. set steeringmanager:rollcontrolanglerange to 180.
  2. set proprad to 5.8.
  3. set rotormods to ship:modulesnamed("ModuleRoboticServoRotor").
  4. set rotors to list().
  5. for rm in rotormods {
  6. local rotor to lexicon().
  7. set rotor["part"] to rm:part.
  8. set rotor["mod"] to rm.
  9.  
  10. set rotor["blades"] to list().
  11. for bm in rm:part:ModulesNamed("ModuleControlSurface") {
  12. local b to bm:part.
  13.  
  14. local blade to lexicon().
  15. set blade["mod"] to bm.
  16. set blade["offset"] to vdot(-b:Facing:starvector, b:position - b:parent:position).
  17. set blade["proprad"] to proprad.
  18.  
  19. bm:setfield("deploy", true).
  20.  
  21. rotor["blades"]:add(blade).
  22. }
  23.  
  24. rotors:add(rotor).
  25. rm:setfield("torque limit(%)", 100).
  26. }
  27.  
  28. set first to true.
  29. set taraoa to 4.5.
  30. set deploycopy to 9.
  31. fuelcells on.
  32. set displayIndex to 0.
  33.  
  34. //Lock Vars
  35. set rpmtarget to min(459,max(0, throttle * 460)).
  36.  
  37. //Functions
  38.  
  39. //Control Loop
  40. on round(time:seconds * 10) {
  41. set rpmtarget to min(459,max(0, throttle * 460)).
  42. set rpmcopy to rpmtarget.
  43. for rotor in rotors {
  44. rotor:mod:setfield("rpm limit", rpmcopy ).
  45. set calcAirspeed to (2 * constant:pi * (rotor:blades[0]:proprad + rotor:blades[0]:offset) * rpmcopy /60).
  46. set deploycopy to max(3, taraoa + arctan2(airspeed, calcAirspeed)).
  47. for blade in rotor:blades {
  48. blade:mod:setfield("deploy angle", deploycopy).
  49. }
  50. }
  51.  
  52. return first.
  53. }
  54.  
  55.  
  56. set x to 90.
  57. lock p to 0.
  58. lock steering to heading(x,p).
  59. lock throttle to 1.
  60. when airspeed > 140 then set p to 7.
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement