beeg sana
This commit is contained in:
28
beegSana.ks
Normal file
28
beegSana.ks
Normal file
@@ -0,0 +1,28 @@
|
||||
run "defaults".
|
||||
|
||||
run "poweredLanding".
|
||||
|
||||
declare function Reentry{
|
||||
print "Re-entry.".
|
||||
lock steering to heading(90, 60, 0).
|
||||
ag1 on.
|
||||
rcs off.
|
||||
|
||||
wait until (groundSpeed < 500 and altitude < 11000).
|
||||
print "Flipping.".
|
||||
rcs on.
|
||||
lock steering to srfRetrograde.
|
||||
}
|
||||
|
||||
wait until (periapsis < 0 and throttle = 0).
|
||||
print "Prep for re-entry".
|
||||
sas off.
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
lock steering to heading(90, 60, 0).
|
||||
wait until (altitude < 70000).
|
||||
Reentry().
|
||||
brakes on.
|
||||
Descent(200, 20).
|
||||
Landing(0, -20).
|
||||
|
||||
|
||||
5
boot/beegSanaBoot.ks
Normal file
5
boot/beegSanaBoot.ks
Normal file
@@ -0,0 +1,5 @@
|
||||
wait until ship:unpacked.
|
||||
clearscreen.
|
||||
switch to 0.
|
||||
|
||||
run beegSana.
|
||||
7
boot/radenBoot9.ks
Normal file
7
boot/radenBoot9.ks
Normal file
@@ -0,0 +1,7 @@
|
||||
wait until ship:unpacked.
|
||||
set rotateSpeed to 100.
|
||||
if ship:status = "LANDED" or ship:status = "PRELAUNCH" {
|
||||
clearscreen.
|
||||
switch to 0.
|
||||
run radenLaunch.
|
||||
}
|
||||
@@ -89,41 +89,19 @@ declare function CalculateSuicideBurnAltitude
|
||||
parameter tgtAltitude is 0.0.
|
||||
parameter drag is 0.0.
|
||||
|
||||
local vertAcc is CalculateAverageDecceleration(localGravity).
|
||||
local vertAcc is CalculateAverageDecceleration(localGravity, drag).
|
||||
local burnAltitude is ((vertSpeed^2) / (2 * (vertAcc))).
|
||||
return burnAltitude + tgtAltitude.
|
||||
}
|
||||
|
||||
declare function CalculateSuicideBurnAltitudeV2
|
||||
{
|
||||
|
||||
parameter vertSpeed.
|
||||
parameter localGravity.
|
||||
parameter tgtAltitude is 0.0.
|
||||
|
||||
|
||||
local vs is vertSpeed * -1.
|
||||
local a is CalculateAverageDecceleration(localGravity).
|
||||
local dt is 0.05.
|
||||
local result is 0.0.
|
||||
local h is alt:radar.
|
||||
|
||||
until vs <= 0 {
|
||||
set vs to vs + a * dt.
|
||||
set result to result + vs * dt.
|
||||
|
||||
if result > h { return result. }
|
||||
}
|
||||
|
||||
return result.
|
||||
}
|
||||
|
||||
|
||||
declare function CalculateAverageDecceleration{
|
||||
parameter localGravity.
|
||||
parameter drag is 0.
|
||||
local maxVertAcc is (ship:availablethrust / ship:mass) - localGravity.
|
||||
|
||||
return maxVertAcc + localGravity.
|
||||
return maxVertAcc + drag.
|
||||
}
|
||||
|
||||
declare function GetLocalGravity{
|
||||
|
||||
@@ -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().
|
||||
|
||||
|
||||
@@ -9,39 +9,54 @@ clearScreen.
|
||||
BRAKES on.
|
||||
print "Waiting for engine ignition".
|
||||
WaitForEngineStart().
|
||||
if not (defined rotateSpeed){
|
||||
set rotateSpeed to 140.
|
||||
}
|
||||
|
||||
print "Preparing to launch".
|
||||
from { local c is 5.} until c = 0 step {set c to c - 1.} do {
|
||||
print c.
|
||||
wait 1.
|
||||
}
|
||||
set runwayPitch to (90 - vectorangle(UP:FOREVECTOR, FACING:FOREVECTOR)).
|
||||
clearScreen.
|
||||
print "Launching!".
|
||||
// stage.
|
||||
lock throttle to 1.
|
||||
lock steering to heading(90, 1).
|
||||
lock steering to heading(90, runwayPitch).
|
||||
brakes off.
|
||||
sas off.
|
||||
|
||||
print "Phase: Takeoff".
|
||||
|
||||
wait until groundspeed > 120.
|
||||
print "Waiting for rotate speed: " + rotateSpeed.
|
||||
wait until groundspeed > rotateSpeed.
|
||||
|
||||
print "Phase: Rotate".
|
||||
lock steering to heading(90, 4).
|
||||
lock steering to heading(90, runwayPitch + 4).
|
||||
wait until altitude > 80.
|
||||
print "Gear up".
|
||||
gear off.
|
||||
wait until altitude > 150.
|
||||
|
||||
set accelPitch to runwayPitch + 4.
|
||||
local accelPitchLoop is PIDLoop(1.0, 0.06, 0.3, runwayPitch, 15).
|
||||
set accelPitchLoop:setpoint to 4.
|
||||
|
||||
print "Phase: Athmospheric Acceleration".
|
||||
lock steering to heading(90, 3, 0).
|
||||
wait until groundspeed > athmoAccelTarget.
|
||||
lock steering to heading(90, accelPitch, 0).
|
||||
until groundspeed > athmoAccelTarget {
|
||||
set accelPitch to accelPitchLoop:update(time:seconds, verticalSpeed).
|
||||
wait 0.001.
|
||||
}
|
||||
|
||||
print "Phase: Athmospheric Climb".
|
||||
lock tgtPitch to Map(groundSpeed, athmoAccelTarget, 1600, 3, 15).
|
||||
lock tgtPitch to Map(groundSpeed, athmoAccelTarget, 1600, 5, 15).
|
||||
lock steering to heading(90, tgtPitch, 0).
|
||||
until altitude > 20000 {
|
||||
print tgtPitch.
|
||||
}
|
||||
|
||||
wait until altitude > 25000.
|
||||
wait until altitude > 20000.
|
||||
|
||||
print "Phase: Mode Switch".
|
||||
ag1 on. //Switch engine mode
|
||||
|
||||
Reference in New Issue
Block a user