Remove RT and tweaked ascent profile
This commit is contained in:
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
wait until ship:unpacked.
|
wait until ship:unpacked.
|
||||||
if addons:RT:hasKSCConnection(ship) {
|
|
||||||
runPath("0:/scripts/basic.ks").
|
runPath("0:/scripts/basic.ks").
|
||||||
} else {
|
//if addons:RT:hasKSCConnection(ship) {
|
||||||
print "No connection to the KSC".
|
//} else {
|
||||||
}
|
// print "No connection to the KSC".
|
||||||
|
//}
|
||||||
|
|||||||
+61
-20
@@ -13,6 +13,47 @@ function signedHeading {
|
|||||||
return mod(hdg + 360, 360).
|
return mod(hdg + 360, 360).
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gravityTurn {
|
||||||
|
parameter targetHeading.
|
||||||
|
|
||||||
|
set tarSteer to heading(targetHeading, 90).
|
||||||
|
lock steering to tarSteer.
|
||||||
|
until ship:velocity:surface:mag >= 100 {
|
||||||
|
set tarSteer to heading(targetHeading, 90 - (ship:velocity:surface:mag / 20)).
|
||||||
|
wait 0.
|
||||||
|
}
|
||||||
|
|
||||||
|
// lock steering to the target heading, but account for drift, and the pitch
|
||||||
|
// of the surface normal vector
|
||||||
|
lock calculatedHeading to mod(targetHeading + 2 * (targetHeading - signedHeading()) + 360, 360).
|
||||||
|
lock steering to heading(
|
||||||
|
calculatedHeading,
|
||||||
|
max(5, 90 - vAng(up:vector, ship:srfprograde:vector))
|
||||||
|
).
|
||||||
|
print "Locked steering to surface prograde pitch and target heading".
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// function structuredAscent {
|
||||||
|
// parameter targetHeading.
|
||||||
|
|
||||||
|
// set tarSteer to heading(targetHeading, 90).
|
||||||
|
// lock steering to tarSteer.
|
||||||
|
// until ship:velocity:surface:mag >= 100 {
|
||||||
|
// set tarSteer to heading(targetHeading, 90 - (ship:velocity:surface:mag / 10)).
|
||||||
|
// wait 0.
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // lock steering to the target heading, but account for drift, and the pitch
|
||||||
|
// // of the surface normal vector
|
||||||
|
// lock calculatedHeading to mod(targetHeading + 2 * (targetHeading - signedHeading()) + 360, 360).
|
||||||
|
// lock steering to heading(
|
||||||
|
// calculatedHeading,
|
||||||
|
// max(5, 90 - vAng(up:vector, ship:srfprograde:vector))
|
||||||
|
// ).
|
||||||
|
// print "Locked steering to surface prograde pitch and target heading".
|
||||||
|
// }
|
||||||
|
|
||||||
function basicAscent {
|
function basicAscent {
|
||||||
parameter targetHeading is 90, targetAltitude is 80000.
|
parameter targetHeading is 90, targetAltitude is 80000.
|
||||||
|
|
||||||
@@ -40,22 +81,7 @@ function basicAscent {
|
|||||||
return true.
|
return true.
|
||||||
}.
|
}.
|
||||||
|
|
||||||
// initial pitch-over
|
gravityTurn(targetHeading).
|
||||||
set tarSteer to heading(targetHeading, 90).
|
|
||||||
lock steering to tarSteer.
|
|
||||||
until ship:velocity:surface:mag >= 100 {
|
|
||||||
set tarSteer to heading(targetHeading, 90 - (ship:velocity:surface:mag / 10)).
|
|
||||||
wait 0.
|
|
||||||
}
|
|
||||||
|
|
||||||
// lock steering to the target heading, but account for drift, and the pitch
|
|
||||||
// of the surface normal vector
|
|
||||||
lock calculatedHeading to mod(targetHeading + 2 * (targetHeading - signedHeading()) + 360, 360).
|
|
||||||
lock steering to heading(
|
|
||||||
calculatedHeading,
|
|
||||||
max(5, 90 - vAng(up:vector, ship:srfprograde:vector))
|
|
||||||
).
|
|
||||||
print "Locked steering to surface prograde pitch and target heading".
|
|
||||||
|
|
||||||
when ship:q < 0.01 then {
|
when ship:q < 0.01 then {
|
||||||
for f in fairings {
|
for f in fairings {
|
||||||
@@ -69,16 +95,31 @@ function basicAscent {
|
|||||||
panels on.
|
panels on.
|
||||||
radiators on.
|
radiators on.
|
||||||
for a in antennas {
|
for a in antennas {
|
||||||
set m to a:getmodule("ModuleRTAntenna").
|
set m to a:getmodule("ModuleDeployableAntenna").
|
||||||
if m:hasevent("activate") m:doevent("activate").
|
if m:hasevent("extend antenna") m:doevent("extend antenna").
|
||||||
if m:getfield("target") = "no-target" m:setfield("target", "Mission Control").
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to limit the throttle to get a good ascent
|
||||||
|
set ascentPID to pidLoop(1/30, 0, 0, 0.1, 1).
|
||||||
|
set ascentPID:setpoint to 60.
|
||||||
|
set ascentThrottle to 1.
|
||||||
|
lock throttle to ascentThrottle.
|
||||||
|
lock pitchAngle to 90 - vAng(up:vector, ship:prograde:vector).
|
||||||
|
until ship:apoapsis >= targetAltitude or pitchAngle < 10 {
|
||||||
|
set ascentThrottle to ascentPID:update(time:seconds, eta:apoapsis).
|
||||||
|
}
|
||||||
|
|
||||||
|
// we're pitched down so much we might as well just burn
|
||||||
|
if ship:apoapsis < targetAltitude {
|
||||||
|
lock throttle to 1.
|
||||||
|
wait until ship:apoapsis >= targetAltitude.
|
||||||
|
}
|
||||||
|
|
||||||
// coast to apoapsis
|
// coast to apoapsis
|
||||||
wait until ship:apoapsis >= targetAltitude.
|
|
||||||
unlock calculatedHeading.
|
unlock calculatedHeading.
|
||||||
|
unlock pitchAngle.
|
||||||
lock steering to ship:prograde.
|
lock steering to ship:prograde.
|
||||||
lock throttle to 0.
|
lock throttle to 0.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user