Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Landing Burn
- // Configuration
- set radarOffset to 26.850. // Measure "alt:radar" of the vehicle when landed 27.977
- // Physics
- lock trueRadar to alt:radar - radarOffset. // Distance from the bottom of vehicle to the ground
- lock g to constant:g * body:mass / body:radius^2. // Gravitational acceleration
- lock maxDecel to (ship:availablethrust / ship:mass) - g. // Maximum achievable deceleration of the vehicle
- lock stopDist to ship:verticalspeed^2 / (2 * maxDecel). // Distance to kill all the velocity
- lock idealThrottle to stopDist / trueRadar. // Hoverslam throttling setting
- lock impactTime to trueRadar / abs(ship:verticalspeed). // Time to impact with the current velocity
- // State variables
- set burnStarted to 0. // 1 if landing burn has started
- clearscreen.
- wait until ship:verticalspeed < -1.
- print "Preparing for landing burn...".
- rcs on.
- print "RCS Online...".
- brakes on.
- lock steering to srfretrograde.
- list engines in elist.
- for eng in elist
- {
- if eng:hasgimbal
- {
- set maxrange to eng:gimbal:range.
- set eng:gimbal:limit to maxrange/2. // this will limit engine gimbal
- }
- }
- print "Engine gimbal limited...".
- wait until trueRadar < stopDist.
- print "Landing burn has begun!".
- set burnStarted to 1.
- lock throttle to idealThrottle.
- wait until burnStarted = 1.
- until impactTime < 4.
- print "Deploying landing legs...".
- gear on.
- wait until ship:verticalspeed > -0.01.
- print "Falcon 9 first stage has landed at LZ-1!".
- set ship:control:pilotmainthrottle to 0.
- wait 5.
- rcs off.
- sas off.
- brakes off.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement