beeg sana
This commit is contained in:
@@ -3,10 +3,19 @@ run "library/lib_math".
|
||||
run "library/lib_location_constants".
|
||||
run "defaults".
|
||||
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
|
||||
|
||||
function Test{
|
||||
TestSetup(10000).
|
||||
WaitFalling(100).
|
||||
Descent().
|
||||
Landing().
|
||||
}
|
||||
|
||||
function TestSetup{
|
||||
|
||||
print "Launch to start.".
|
||||
WaitForEngineStart().
|
||||
parameter tgt is 5000.
|
||||
if altitude > 100 {
|
||||
return.
|
||||
@@ -21,7 +30,8 @@ function TestSetup{
|
||||
unlock throttle.
|
||||
}
|
||||
|
||||
function Landing{
|
||||
declare function Landing{
|
||||
parameter altitudeOffset is 0.0.
|
||||
print "Starting Landing".
|
||||
gear on.
|
||||
set pad to location_constants:kerbin:launchpad:position.
|
||||
@@ -61,14 +71,14 @@ function Landing{
|
||||
|
||||
until landed {
|
||||
set landingThrottle to hoverPid:update(time:seconds, verticalSpeed).
|
||||
set hoverPid:setpoint to Map(alt:radar, 0, 100, -0.5, -30).
|
||||
set hoverPid:setpoint to Map(alt:radar + altitudeOffset, 0, 100, -0.5, -20).
|
||||
wait 0.001.
|
||||
}
|
||||
print "Landed".
|
||||
lock throttle to 0.
|
||||
}
|
||||
|
||||
function WaitFalling{
|
||||
declare function WaitFalling{
|
||||
parameter targetSpeed is 100.
|
||||
sas off.
|
||||
wait until altitude < 10000.
|
||||
@@ -84,20 +94,24 @@ function WaitFalling{
|
||||
}
|
||||
|
||||
|
||||
function Descent {
|
||||
declare function Descent {
|
||||
parameter margin is 100.0.
|
||||
parameter speedTarget is 30.
|
||||
|
||||
|
||||
local lock curAlt to alt:radar.
|
||||
local lock vertSpeed to verticalSpeed.
|
||||
local lock localGravity to GetLocalGravity(altitude).
|
||||
local lock drag to GetDragDir(localGravity, ship:up:vector).
|
||||
local lock burnDist to CalculateSuicideBurnAltitude(vertSpeed, localGravity, 100, drag).
|
||||
local lock burnDist to CalculateSuicideBurnAltitude(vertSpeed, localGravity, margin, drag).
|
||||
|
||||
wait until burnDist >= curAlt.
|
||||
print "Gravity " + localGravity + "| Drag " + drag.
|
||||
print "Starting Burn".
|
||||
print burnDist.
|
||||
gear on.
|
||||
|
||||
until abs(verticalSpeed) < 30{
|
||||
until abs(verticalSpeed) < speedTarget{
|
||||
lock throttle to 1.
|
||||
}
|
||||
lock throttle to 0.
|
||||
@@ -107,10 +121,3 @@ function Descent {
|
||||
}
|
||||
|
||||
|
||||
print "Launch to start.".
|
||||
WaitForEngineStart().
|
||||
TestSetup(10000).
|
||||
WaitFalling(100).
|
||||
Descent().
|
||||
Landing().
|
||||
|
||||
|
||||
Reference in New Issue
Block a user