Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LogData {
- parameter text.
- // print to both the console and log
- print "[" + time:clock + "] " + text.
- log "[" + time:clock + "] " + text to missionlog.
- // make a copy on the local KSC archive
- copy missionlog to 0.
- }.
- clearscreen.
- LogData("Sounding Rocket Flight Program initiating...").
- // find all our parts
- set sep to ship:partstagged("sep")[0].
- set exp to ship:partstagged("exp")[0].
- set srb to ship:partstagged("srb")[0].
- set chute to ship:partstagged("chute")[0].
- set clamp to ship:partstagged("clamp")[0].
- set probe to ship:partstitled("Avionics Package")[0].
- set fairings to ship:partstagged("fairing").
- // all good, begin the countdown
- LogData("GO for launch!").
- wait 1.
- LogData("T-10").
- wait 1.
- LogData("T-9").
- wait 1.
- LogData("T-8").
- wait 1.
- LogData("T-7").
- wait 1.
- LogData("T-6").
- wait 1.
- LogData("T-5").
- wait 1.
- LogData("T-4").
- wait 1.
- LogData("T-3").
- wait 1.
- LogData("T-2").
- wait 1.
- LogData("T-1").
- wait 1.
- // fire the engine and detach from the launch stick
- srb:getmodule("ModuleEngines"):doevent("activate engine").
- clamp:getmodule("ModuleAnchoredDecoupler"):doevent("decouple").
- LogData("Liftoff!!").
- // wait until engine expires
- until srb:getmodule("ModuleEngines"):getfield("status") = "flame-out!" {}.
- LogData("SRB flame out detected. Decoupling").
- // ditch the SRB and then await negative vertical velocity
- sep:getmodule("ModuleDecouple"):doevent("decouple").
- LogData("Awaiting apoapsis for chute deployment").
- until ship:verticalspeed <= 0 {}.
- // pop the chute and dump the fairings
- // TODO: Change to wait until ship speed is below supersonic
- LogData("Deploying chute, releasing payload fairings").
- chute:getmodule("ModuleParachute"):doevent("deploy chute").
- for fairing in fairings {
- fairing:getmodule("ModuleDecouple"):doevent("decouple").
- }
- // confirm chute is open and run science experiments
- until chute:getmodule("ModuleParachute"):hasevent("cut chute") {}.
- LogData("Chute deployed, running experiments").
- exp:getmodule("moduleScienceExperiment"):doevent("record aeronomical data").
- probe:getmodule("moduleScienceExperiment"):doevent("collect data").
- // done! All data will be stored for retrieval, as battery power will not last until landing
- LogData("All events have executed. Awaiting landing & retrieval").
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement