Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function info {
- parameter message.
- set logmessage to round(missionTime,1) + ": " + message.
- print logmessage.
- }
- set takeoffspeed to 60.
- set targetOrbitAltitude to 101e3.
- list engines in es.
- for e in es e:shutdown().
- toggle ag2.
- toggle ag8.
- bays on.
- wait 1.
- toggle ag8.
- set vectors to ship:partsdubbedpattern("vector").
- for v in vectors set v:thrustlimit to 100.
- set servos to ship:modulesnamed("ModuleRoboticRotationServo").
- lock p to choose -verticalspeed - 20 if alt:radar > 1000 else 0.
- Set deadzone to 2. lock roll to choose max(-30,min(30, body:geopositionof(heading(h,0):vector):bearing)) if abs(body:geopositionof(heading(h,0):vector):bearing) > deadzone else 0.
- lock h to body:geopositionof(srfprograde:vector:normalized):heading.
- lock steering to heading(h,p, -roll).
- lock throttle to 1.
- lock vlimit to choose -verticalspeed + 50-alt:radar if groundspeed > 2 and alt:radar < 50 else ((-verticalspeed-1)-sqrt(2*max(1,(max(0.1,vdot(up:vector,vectors[0]:facing:vector))* availablethrust*0.9)/mass-body:mu/(body:radius^2))*max(alt:radar-20+verticalspeed*0.5,0.1)))*100.
- lock angletarget to max(-10,min(10,-groundspeed)).
- set landing to true.
- when landing then {
- set vlimitcopy to vlimit.
- set anglecopy to angletarget.
- for v in vectors set v:thrustlimit to vlimitcopy.
- for s in servos if s:hasfield("target angle") s:setfield("target angle", anglecopy).
- print " v thrust: " + vlimitcopy at (0,0).
- print "servo angle: " + anglecopy at (0,1).
- return true.
- }
- when airspeed < 1 then {
- lock throttle to -verticalspeed - 1.
- set landing to false.
- for v in vectors set v:thrustlimit to 100.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement