Fix satdeploy.
This commit is contained in:
parent
1860572067
commit
324d9ab7a3
|
@ -25,26 +25,21 @@ function GetAscentVector {
|
||||||
function CreateCircularizationNode {
|
function CreateCircularizationNode {
|
||||||
parameter where is "APO".
|
parameter where is "APO".
|
||||||
|
|
||||||
local dt is 0.
|
local t is TIME.
|
||||||
local a is 0.
|
|
||||||
local t is 0.
|
|
||||||
if where:IsType("String") {
|
if where:IsType("String") {
|
||||||
if where = "APO" {
|
if where = "APO" {
|
||||||
set dt to SHIP:ORBIT:ETA:APOAPSIS.
|
set t to TIME + SHIP:ORBIT:ETA:APOAPSIS.
|
||||||
set a to SHIP:ORBIT:APOAPSIS.
|
|
||||||
} else if where = "PERI" {
|
} else if where = "PERI" {
|
||||||
set dt to SHIP:ORBIT:ETA:PERIAPSIS.
|
set t to TIME + SHIP:ORBIT:ETA:PERIAPSIS.
|
||||||
set a to SHIP:ORBIT:PERIAPSIS.
|
|
||||||
} else {
|
} else {
|
||||||
print "WARNING: Invalid string passed to CreateCirculazationNode(). Node is invalid.".
|
print "WARNING: Invalid string passed to CreateCirculazationNode(). Node is invalid.".
|
||||||
}
|
}
|
||||||
|
|
||||||
set t to TIME + dt.
|
|
||||||
} else {
|
} else {
|
||||||
|
// we've been passed a time at which to circularize.
|
||||||
set t to where.
|
set t to where.
|
||||||
}
|
}
|
||||||
|
|
||||||
local Vc is sqrt(SHIP:BODY:MU/(SHIP:BODY:RADIUS + a)).
|
local Vc is sqrt(SHIP:BODY:MU/(PositionAt(SHIP, t) - SHIP:BODY:POSITION):MAG).
|
||||||
local dV is Vc - VelocityAt(SHIP, t):ORBIT:MAG.
|
local dV is Vc - VelocityAt(SHIP, t):ORBIT:MAG.
|
||||||
local n is Node(t, 0, 0, dV).
|
local n is Node(t, 0, 0, dV).
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ function ExecNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Adjusting heading".
|
print "Adjusting heading".
|
||||||
lock STEERING to LookDirUp(NEXTNODE:DELTAV, SHIP:FACING:TOPVECTOR).
|
// The vector constant here should always align our "sides" with the universal up/down axis, so we can predictably place solar panels.
|
||||||
|
lock STEERING to LookDirUp(NEXTNODE:DELTAV, V(0,0,90)).
|
||||||
wait until VAng(SHIP:FACING:FOREVECTOR, STEERINGMANAGER:TARGET:FOREVECTOR) <= 0.1.
|
wait until VAng(SHIP:FACING:FOREVECTOR, STEERINGMANAGER:TARGET:FOREVECTOR) <= 0.1.
|
||||||
|
|
||||||
print "Warping to node.".
|
print "Warping to node.".
|
||||||
|
|
14
prog/circ.ks
14
prog/circ.ks
|
@ -2,14 +2,6 @@
|
||||||
|
|
||||||
runoncepath("/lib/navigation").
|
runoncepath("/lib/navigation").
|
||||||
|
|
||||||
parameter where is "a".
|
parameter where.
|
||||||
parameter whereStr is "apoapsis".
|
add CreateCircularizationNode(where).
|
||||||
|
print "Circularization node created.".
|
||||||
local usePeri is false.
|
|
||||||
if where = "p" {
|
|
||||||
set usePeri to true.
|
|
||||||
set whereStr to "periapsis".
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateCircularizationNode(usePeri).
|
|
||||||
print "Circularization node created at " + whereStr.
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@lazyglobal off.
|
@lazyglobal off.
|
||||||
|
|
||||||
runoncepath("/lib/node").
|
runoncepath("/lib/node").
|
||||||
ExecuteNode().
|
ExecNode().
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Run this program on a staged multi-satellite deploy mission. (e.g. using a fairing with interstage nodes and stack separators) To use:
|
// Run this program on a staged multi-satellite deploy mission. (e.g. using a fairing with interstage nodes and stack separators) To use:
|
||||||
//
|
//
|
||||||
// 1. Make sure the next stage will decouple a satellite and activate its engines.
|
// 1. Make sure the next stage will decouple a satellite and activate its engines.
|
||||||
// 2. Pull up the PAW for the satellite's probe core and "Control from Here".
|
// 2. Pull up the PAW for the satellite's probe core and "Control from Here", so KSP stays focused on the satellite after deploy.
|
||||||
// 3. Run this program from that satellite's computer.
|
// 3. Run this program from that satellite's computer.
|
||||||
//
|
//
|
||||||
// This program will decouple the satellite and circularize its orbit. Ideally done on a resonant satellite injection orbit.
|
// This program will decouple the satellite and circularize its orbit. Ideally done on a resonant satellite injection orbit.
|
||||||
|
@ -14,13 +14,23 @@ runoncepath("/lib/navigation").
|
||||||
runoncepath("/lib/node").
|
runoncepath("/lib/node").
|
||||||
|
|
||||||
stage.
|
stage.
|
||||||
PANELS on.
|
|
||||||
|
wait until SHIP:UNPACKED.
|
||||||
|
wait 0.001.
|
||||||
|
|
||||||
|
// KSP does not intelligently figure out staging on the fly here, so stage again
|
||||||
|
stage.
|
||||||
|
|
||||||
set SHIP:NAME to name.
|
set SHIP:NAME to name.
|
||||||
add CreateCircularizationNode(TIME + 2).
|
|
||||||
|
PANELS on.
|
||||||
|
for p in SHIP:PARTS {
|
||||||
|
if p:MODULES:Find("ModuleRTAntenna") > -1 and p:GetModule("ModuleRTAntenna"):ALLEVENTS:Find("Activate") > -1 {
|
||||||
|
p:GetModule("ModuleRTAntenna"):DoEvent("Activate").
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add CreateCircularizationNode(TIME + 5).
|
||||||
|
add CreateCircularizationNode("PERI").
|
||||||
ExecNode().
|
ExecNode().
|
||||||
|
|
||||||
for p in SHIP:PARTS {
|
|
||||||
if p:MODULES:Find("ModuleRTAntenna") > -1 {
|
|
||||||
p:GetModule("ModuleRTAntenna"):DoEvent("ACTIVATE").
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user