diff --git a/.buildinfo b/.buildinfo deleted file mode 100644 index 1664b0062..000000000 --- a/.buildinfo +++ /dev/null @@ -1,4 +0,0 @@ -# Sphinx build info version 1 -# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 0de43e56489e9d1580241dcaccb36136 -tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_images/KSP_body_coords.png b/_images/KSP_body_coords.png deleted file mode 100644 index 65c2fb841..000000000 Binary files a/_images/KSP_body_coords.png and /dev/null differ diff --git a/_images/KSP_body_latlong.png b/_images/KSP_body_latlong.png deleted file mode 100644 index 0df993d6b..000000000 Binary files a/_images/KSP_body_latlong.png and /dev/null differ diff --git a/_images/SCS_parts_bin.png b/_images/SCS_parts_bin.png deleted file mode 100644 index 9971a2d5a..000000000 Binary files a/_images/SCS_parts_bin.png and /dev/null differ diff --git a/_images/applauncher_panel.png b/_images/applauncher_panel.png deleted file mode 100644 index 339195728..000000000 Binary files a/_images/applauncher_panel.png and /dev/null differ diff --git a/_images/designpatterns_rocket.png b/_images/designpatterns_rocket.png deleted file mode 100644 index 68318d70a..000000000 Binary files a/_images/designpatterns_rocket.png and /dev/null differ diff --git a/_images/editor.png b/_images/editor.png deleted file mode 100644 index 6a5b51439..000000000 Binary files a/_images/editor.png and /dev/null differ diff --git a/_images/example_2_1.png b/_images/example_2_1.png deleted file mode 100644 index 469e5b5cb..000000000 Binary files a/_images/example_2_1.png and /dev/null differ diff --git a/_images/example_2_2.png b/_images/example_2_2.png deleted file mode 100644 index 747bb0a59..000000000 Binary files a/_images/example_2_2.png and /dev/null differ diff --git a/_images/example_2_3.png b/_images/example_2_3.png deleted file mode 100644 index 6833d466d..000000000 Binary files a/_images/example_2_3.png and /dev/null differ diff --git a/_images/example_2_4.png b/_images/example_2_4.png deleted file mode 100644 index 3898ec833..000000000 Binary files a/_images/example_2_4.png and /dev/null differ diff --git a/_images/example_2_5.png b/_images/example_2_5.png deleted file mode 100644 index c51a301e5..000000000 Binary files a/_images/example_2_5.png and /dev/null differ diff --git a/_images/example_2_6.png b/_images/example_2_6.png deleted file mode 100644 index 3fab8a28e..000000000 Binary files a/_images/example_2_6.png and /dev/null differ diff --git a/_images/hello_list.png b/_images/hello_list.png deleted file mode 100644 index 3baa19cc4..000000000 Binary files a/_images/hello_list.png and /dev/null differ diff --git a/_images/hello_world1.png b/_images/hello_world1.png deleted file mode 100644 index d017e585c..000000000 Binary files a/_images/hello_world1.png and /dev/null differ diff --git a/_images/pidtune1.png b/_images/pidtune1.png deleted file mode 100644 index a1e08a9a2..000000000 Binary files a/_images/pidtune1.png and /dev/null differ diff --git a/_images/pidtune2.png b/_images/pidtune2.png deleted file mode 100644 index a3604516d..000000000 Binary files a/_images/pidtune2.png and /dev/null differ diff --git a/_images/pidtune3.png b/_images/pidtune3.png deleted file mode 100644 index 9963eabeb..000000000 Binary files a/_images/pidtune3.png and /dev/null differ diff --git a/_images/pidtune4.png b/_images/pidtune4.png deleted file mode 100644 index 6d5524c2e..000000000 Binary files a/_images/pidtune4.png and /dev/null differ diff --git a/_images/pidtune5.png b/_images/pidtune5.png deleted file mode 100644 index 9ab121115..000000000 Binary files a/_images/pidtune5.png and /dev/null differ diff --git a/_images/pidtune_rocket_design_maxtwr8.png b/_images/pidtune_rocket_design_maxtwr8.png deleted file mode 100644 index 376245a95..000000000 Binary files a/_images/pidtune_rocket_design_maxtwr8.png and /dev/null differ diff --git a/_images/resources.png b/_images/resources.png deleted file mode 100644 index 224447aeb..000000000 Binary files a/_images/resources.png and /dev/null differ diff --git a/_images/terminal_open_1.png b/_images/terminal_open_1.png deleted file mode 100644 index fe1376dea..000000000 Binary files a/_images/terminal_open_1.png and /dev/null differ diff --git a/_images/terminal_open_2.png b/_images/terminal_open_2.png deleted file mode 100644 index 2c370c927..000000000 Binary files a/_images/terminal_open_2.png and /dev/null differ diff --git a/_sources/about.txt b/_sources/about.txt deleted file mode 100644 index 45f536ca8..000000000 --- a/_sources/about.txt +++ /dev/null @@ -1,10 +0,0 @@ -.. _about: - -About **kOS** and **KerboScript** -================================= - -kOS was originally created by Nivekk. It is under `active development`_ by `Chris Woerz`_ and `Steven Mading`_. - -.. _active development: https://github.com/KSP-KOS -.. _Chris Woerz: https://github.com/erendrake -.. _Steven Mading: https://github.com/Dunbaratu diff --git a/_sources/bindings.txt b/_sources/bindings.txt deleted file mode 100644 index f93c41d59..000000000 --- a/_sources/bindings.txt +++ /dev/null @@ -1,289 +0,0 @@ -.. _bindings: - -Catalog of Bound Variable Names -=============================== - -This is the list of special reserved keyword variable names that kOS -will interpret -to mean something special. If they are used as normal variable names by -your kOS script -program they may not work. Understanding them and their meaning is -crucial to creating -effective kOS scripts. - -NAMED VESSELS AND BODIES ------------------------- - -Variable Name \| Can Read \| Can Set \| Type \| Description -==============\|==========\|=========\|======\|============ -SHIP \| yes \| no \| `Vessel <../structure/vessel/index.html>`__ \| -Whichever vessel happens to be the one containing the CPU part that is -running this Kerboscript code at the moment. This is the `CPU -Vessel <../summary_topics/CPU_vessel/index.html>`__. -TARGET \| yes \| yes \| `Vessel <../structure/vessel/index.html>`__ or -`Body <../structure/body/index.html>`__ \| Whichever -`Orbitable <../structure/orbitable/index.html>`__ object happens to be -the one selected as the current KSP target. If set to a string, it will -assume the string is the name of a vessel being targetted and set it to -a vessel by that name. For best results set it to Body("some name") or -Vessel("some name") explicitly. - -Alias shortcuts for SHIP fields -------------------------------- - -The following are all alias shortcuts for accessing the fields of the -SHIP vessel. -To see their definition, please consult the -`Vessel <../structure/vessel/index.html>`__ -page, as they are all just instances of the standard vessel suffixes. - -Variable \| Same as -=========\|=========== -HEADING \| Same as SHIP:HEADING -PROGRADE \| Same as SHIP:PROGRADE -RETROGRADE \| Same as SHIP:RETROGRADE -FACING \| Same as SHIP:FACING -MAXTHRUST \| Same as SHIP:MAXTHRUST -VELOCITY \| Same as SHIP:VELOCITY -GEOPOSITION \| Same as SHIP:GEOPOSITION -LATITUDE \| Same as SHIP:LATITUDE -LONGITUDE \| Same as SHIP:LONGITUDE -UP \| Same as SHIP:UP -NORTH \| Same as SHIP:NORTH -BODY \| Same as SHIP:BODY -ANGULARMOMENTUM \| Same as SHIP:ANGULARMOMENTUM -ANGULARVEL \| Same as SHIP:ANGULARVEL -ANGULARVELOCITY \| Same as SHIP:ANGULARVEL -COMMRANGE \| Same as SHIP:COMMRANGE -MASS \| Same as SHIP:MASS -VERTICALSPEED \| Same as SHIP:VERTICALSPEED -SURFACESPEED \| Same as SHIP:SURFACESPEED -AIRSPEED \| Same as SHIP:AIRSPEED -VESSELNAME \| Same as SHIP:VESSELNAME -ALTITUDE \| Same as SHIP:ALTITUDE -APOAPSIS \| Same as SHIP:APOAPSIS -PERIAPSIS \| Same as SHIP:PERIAPSIS -SENSOR \| Same as SHIP:SENSOR -SRFPROGRADE \| Same as SHIP:SRFPROGRADE -SRFREROGRADE \| Same as SHIP:SRFREROGRADE -OBT \| Same as SHIP:OBT -STATUS \| Same as SHIP:STATUS -VESSELNAME \| Same as SHIP:NAME -*Any resource* \| Same as SHIP:\ *resource name*, eg. LIQUIDFUEL is the -same as SHIP:LIQUIDFUEL - -Resource Types --------------- - -Any time there is a resource on the ship it can be queried. The -resources are the values that appear when you click on the upper-right -corner of the screen in the KSP window. |Resources| - -:: - - LIQUIDFUEL - OXIDIZER - ELECTRICCHARGE - MONOPROPELLANT - INTAKEAIR - SOLIDFUEL - -All of the above resources can be queried using either the prefix SHIP -or STAGE, depending on whether you are trying to query how much is left -in the curent stage or the entire ship: - -How much liquid fuel is left in the entire ship: - -:: - - PRINT "There is " + SHIP:LIQUIDFUEL + " liquid fuel on the ship.". - -How much liquid fuel is left in just the current stage: - -:: - - PRINT "There is " + STAGE:LIQUIDFUEL + " liquid fuel in this stage.". - -How much liquid fuel is left in the target vessel: - -:: - - PRINT "There is " + TARGET:LIQUIDFUEL + " liquid fuel in the target ship.". - -Any other resources that you have added using other mods should be -query-able this way, provided that you spell -the term exactly as it appears in the resources window. - -ALT ALIAS ---------- - -The special variable ALT is a unique exception. It behaves like a -structure with suffixes but it's acually a bit "fake" in that it's not -really a structure. The following terms are just exceptions that don't -fit anywhere else: - -Variable \| Type \| Meaning -==============\|========\|========== -ALT:APOAPSIS \| number \| The altitude of the apoapsis of the current -ship. Identical to SHIP:APOAPSIS. -ALT:PERIAPSIS \| number \| The altitude of the periapsis of the current -ship. Identical to SHIP:PERIAPSIS. -ALT:RADAR \| number \| The altitude of the current ship above the -terrain, rather than above the sea level. Does not have an alias -anywhere. - -ETA ALIAS ---------- - -The special variable ETA is a unique exception. It behaves like a -structure with suffixes but it's acually a bit "fake" in that it's not -really a structure. The following terms are just exceptions that don't -fit anywhere else: - -Variable \| Type \| Meaning -===============\|========\|========== -ETA:APOAPSIS \| number \| The number of seconds until the current ship -will reach its apoapsis. -ETA:PERIAPSIS \| number \| The number of seconds until the current ship -will reach its periapsis. -ETA:TRANSITION \| number \| The number of seconds until the current ship -will leave the current sphere of influence and enter the sphere of -influence of another celestial body. - -ENCOUNTER ---------- - -The body being encountered next by the current vessel. Returns the -special string "None" if there is no expected encounter, or an object of -type `Body <../structures/body/index.html>`__ if an encounter is -expected. - -BOOLEAN TOGGLE FIELDS: ----------------------- - -These are variables that behave like boolean flags. They can be True or -False, and can be set or toggled -using the "ON" and "OFF" and "TOGGLE" commands. -Many of these are for action group flags. -**NOTE ABOUT ACTION GROUP FLAGS:** If the boolean flag is for an action -group, be aware that each time the -user presses the action group keypress, it *toggles* the action group, -so you might need to check for both -the change in state from false to true AND the change in state from true -to false to see if the key was hit. - -Variable Name \| Can Read \| Can Set \| Description -==============\|==========\|=========\|=============== -SAS \| yes \| yes \| Is the SAS stabalizer control enabled right now? -(Same as "SAS" indicator on the navball.) -RCS \| yes \| yes \| Is the RCS thrust flag enbabled right now? (Same as -"RCS" indicator on the navball.) -GEAR \| yes \| yes \| Is the GEAR enabled right now? (Note, KSP does -some strange things with this flag, like needing to hit it twice the -first time). -LEGS \| yes \| yes \| Are the landing LEGS extended? (as opposed to GEAR -which is for the wheels of a plane.) -CHUTES \| yes \| yes \| Are the parachutes extended? (Treats all -parachutes as one single unit. Does not activate them individually.) -LIGHTS \| yes \| yes \| Are the lights on? (like the "U" key in manual -flight.) -PANELS \| yes \| yes \| Are the solar panels extended? (Treats all solar -panels as one single unit. Does not activate them individually.) -BRAKES \| yes \| yes \| Are the brakes on? -ABORT \| yes \| yes \| Abort Action Group. -AG1 \| yes \| yes \| Action Group 1. -AG2 \| yes \| yes \| Action Group 2. -AG3 \| yes \| yes \| Action Group 3. -AG4 \| yes \| yes \| Action Group 4. -AG5 \| yes \| yes \| Action Group 5. -AG6 \| yes \| yes \| Action Group 6. -AG7 \| yes \| yes \| Action Group 7. -AG8 \| yes \| yes \| Action Group 8. -AG9 \| yes \| yes \| Action Group 9. -AG10 \| yes \| yes \| Action Group 10. - -Flight Control --------------- - -A summary page describing the basics of controlling the flight of a ship -`can be found here <../summary_topics/ship_control/index.html>`__ - -Controls that must be used with LOCK -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -:: - - THROTTLE // Lock to a decimal value between 0 and 1. - STEERING // Lock to a direction, either a Vector or a Direction. - WHEELTHROTTLE // Seperate throttle for wheels - WHEELSTEERING // Seperate steering system for wheels - -System Variables ----------------- - -Returns values about kOS and hardware - -:: - - PRINT VERSION. // Returns operating system version number. i.e. 0.8.6 - PRINT VERSION:MAJOR. // Returns major version number. e.g. 0 - PRINT VERSION:MINOR. // Returns minor version number. e.g. 8 - PRINT SESSIONTIME. // Returns amount of time, in seconds, from vessel load. - -NOTE the following important difference: - -SESSIONTIME is the time since the last time this vessel was loaded from -on-rails into full physics. - -TIME is the time since the entire saved game campaign started, in the -kerbal universe's time. i.e. TIME = 0 means a brand new campaign was -just started. - -Config ------- - -CONFIG is a special variable name that refers to the configuration -settings for -the kOS mod, and can be used to set or get various options. - -`CONFIG has its own page <../structure/config/index.html>`__ for further -details. - -Game State ----------- - -Variables that have something to do with the state of the universe. - -Variable \| Type \| Meaning -=========\|======\|========= -TIME \| `Time <../structure/time/index.html>`__ \| Simulated amount of -time that passed since the beginning of the game's universe epoch. (A -brand new campaign that just started begins at TIME zero.) -MAPVIEW \| boolean \| Both settable and gettable. If you query MAPVIEW, -it's true if on the map screen, and false if on the flight view screen. -If you SET MAPVIEW, you can cause the game to switch between mapview and -flight view or visa versa. - -TIME is a useful system variable for calculating the passage of time -between taking -physical measurements (i.e. to calulate how fast a phenomenon is -changing in a loop). -It returns the KSP *simulated* time, rather than the actual realtime -sitting in the -chair playing the game. If everything is running smoothly on a fast -computer, one -second of simulated time will match one second of real time, but if -anything is -causing the game to stutter or lag a bit, then the simulated time will -be a bit -slower than the real time. For any script program trying to calculate -physical -properties of the KSP universe, the time that matters is the simulated -time, which -is what TIME returns. - -It's important to be aware of the `frozen update -nature <../summary_topics/CPU_hardware/index.html#FROZEN>`__ of the kOS -computer when reading TIME. - -.. |Resources| image:: /_images/reference/bindings/resources.png diff --git a/_sources/commands.txt b/_sources/commands.txt deleted file mode 100644 index fc9b92606..000000000 --- a/_sources/commands.txt +++ /dev/null @@ -1,14 +0,0 @@ -.. _commands: - -Command Reference -================= - -.. toctree:: - :maxdepth: 2 - - Flight Control - Prediction - Listing Data - Parts Information - File I/O - Terminal diff --git a/_sources/commands/files.txt b/_sources/commands/files.txt deleted file mode 100644 index f3c52c587..000000000 --- a/_sources/commands/files.txt +++ /dev/null @@ -1,274 +0,0 @@ -.. _files: - -File I/O -======== - -For information about where files are kept and how to deal with volumes see the :ref:`Volumes ` page in the general topics section of this documentation. - -.. note:: - - All file names (program names) must be valid Identifiers. They can not contain spaces or special characters. For example, you can't have a file name called "this is my-file". - -.. warning:: - - .. versionchanged:: 0.15 - - **Archive location and file extension change** - - The Archive where KerboScript files are kept has been changed from ``Plugins/PluginData/Archive`` to ``Ships/Script``, but still under the top-level **KSP** installation directory. The file name extensions have also changes from ``.txt`` to ``.ks``. - -Volume and Filename arguments ------------------------------ - -Any of the commands below which use filename arguments, \*\*with the -exception -of the RUN command\*\*, follow these rules: - -- (expression filenames) A filename may be an expression which - evaluates to a string. -- (bareword filenames) A filename may also be an undefined identifier - which does not match a variable name, in which case the bare word - name of the identifier will be used as the filename. If the - identifier does match a variable name, then it will be evaluated as - an expression and the variable's contents will be used as the - filename. -- A bareword filename may contain file extensions with dots, provided - it does not end in a dot. -- If the filename does not contain a file extension, kOS will pad it - with a ".ks" extension and use that. - -Putting the above rules together, you can refer to filenames in any of -the following ways: - -- copy myfilename to 1. // This is an example of a bareword filename. -- copy "myfilename" to 1. // This is an example of an EXPRESSION - filename. -- copy myfilename.ks to 1. // This is an example of a bareword - filename. -- copy myfilename.txt to 1. // This is an example of a bareword - filename. -- copy "myfilename.ks" to 1. // This is an example of an EXPRESSION - filename -- set str to "myfile" + "name" + ".ks". copy str to 1. // This is an - example of an EXPRESSION filename - -**Limits:** - -The following rules apply as limitations to the bareword filenames: - -- The **RUN command only works with bareword filenames**, not - expression filenames. Every other command works with either type of - filename. -- Filenames containing any characters other than A-Z, 0-9, underscore, - and the period extension separator ('.'), can only be referred to - using a string expression (with quotes), and cannot be used as a - bareword expression (without quotes). -- If your filesystem is case-senstive (Linux and sometimes Mac OSX, or - even Windows if using some kinds of remote network drives), then - bareword filenames will only work properly on filenames that are all - lowercase. If you try to use a file with capital letters in the name - on these systems, you will only be able to do so by quoting it. - -**Volumes too:** - -The rules for filenames also apply to volumes. You may do this for -example: - -- set volNum to 1. copy "myfile" to volNum. - - -``COMPILE program (TO compiledProgram).`` ------------------------------------------ - -**(experimental)** - -Arguments: - - argument 1 - Name of source file. - argument 2 - Name of destination file. If the optional argument 2 is missing, it will assume it's the same as argument 1, but with a file extension changed to ``*.ksm``. - -Pre-compiles a script into an :ref:`Kerboscript ML Exceutable -image ` that can be used -instead of executing the program discript directly. - -The RUN command (elsewhere on this page) can work with either *.ks -script files or *.ksm compiled files. - -The full details of this process are long and complex enough to be -placed on a separate page. - -Please see :ref:`the details of the Kerboscript ML -Executable `. - -``COPY programFile FROM/TO voumeNumber.`` ------------------------------------------ - -Arguments -^^^^^^^^^ - -- argument 1: Name of target file. -- argument 2: Target volume. - -Copies a file to or from another volume. Volumes can be referenced by -their ID numbers or their names if they’ve been given one. See LIST, -SWITCH and RENAME. - -Understanding how :ref:`volumes -work ` is important to -understanding this command. - -Example:: - - SWITCH TO 1. // Makes volume 1 the active volume - COPY file1 FROM 0. // Copies a file called file1.ks from volume 0 to volume 1 - COPY file2 TO 0. // Copies a file called file1.ks from volume 1 to volume 0 - COPY file1.ks FROM 0. // Copies a file called file1.ks from volume 0 to volume 1 - COPY file2.ksm TO 0. // Copies a file called file1.ksm from volume 1 to volume 0 - COPY "file1.ksm" FROM 0. // Copies a file called file1.ksm from volume 0 to volume 1 - COPY "file1" + "." + "ks" FROM 0. // Copies a file called file1.ks from volume 0 to volume 1 - - -``DELETE filename FROM volumeNumber.`` --------------------------------------- - -Deletes a file. You can delete a file from the current volume, or from a named volume. - -Arguments -^^^^^^^^^ - -- argument 1: Name of target file. -- argument 2: (optional) Target volume. - -Example:: - - DELETE file1. // Deletes file1.ks from the active volume. - DELETE "file1". // Deletes file1.ks from the active volume. - DELETE file1.txt. // Deletes file1.txt from the active volume. - DELETE "file1.txt". // Deletes file1.txt from the active volume. - DELETE file1 FROM 1. // Deletes file1.ks from volume 1 - - -``EDIT program.`` ------------------ - -Edits a program on the currently selected volume. - -Arguments -^^^^^^^^^ - -- argument 1: Name of file for editing. - -.. note:: - - The Edit feature was lost in version 0.11 but is back again after version 0.12.2 under a new guise. The new editor is unable to show a monospace font for a series of complex reasons involving how Unity works and how squad bundled the KSP game. The editor works, but will be in a proporional width font, which isn't ideal for editing code. The best way to edit code remains to use a text editor external to KSP, however for a fast peek at the code during play, this editor is useful. - -Example:: - - EDIT filename. // edits filename.ks - EDIT filename.ks. // edits filename.ks - EDIT "filename.ks". // edits filename.ks - EDIT "filename". // edits filename.ks - EDIT "filename.txt". // edits filename.txt - - -``LOG text TO filename.`` -------------------------- - -Logs the selected text to a file on the local volume. Can print strings, or the result of an expression. - -Arguments -^^^^^^^^^ - -- argument 1: Value you would like to log. -- argument 2: Name of file to log into. - -Example:: - - LOG “Hello” to mylog.txt. // logs to "mylog.txt". - LOG 4+1 to "mylog" . // logs to "mylog.ks" because .ks is the default extension. - LOG “4 times 8 is: “ + (4*8) to mylog. // logs to mylog.ks because .ks is the default extension. - - -``RENAME name1 TO name2.`` --------------------------- - -Renames a file or volume. - -Arguments -^^^^^^^^^ - -- argument 1: Volume/File Name you would like to change. -- argument 2: New name for $1. - -Example:: - - RENAME VOLUME 1 TO AwesomeDisk - RENAME FILE MyFile TO AutoLaunch. - -``RUN .`` ------------------- - -Runs the specified file as a program, optionally passing information to the program in the form of a comma-separated list of arguments in parentheses. - -Arguments -^^^^^^^^^ - -- : File to run. -- comma-separagted-args: a list of values to pass into the program. - -Example:: - - RUN AutoLaunch.ks. - RUN AutoLaunch.ksm. - RUN AutoLaunch. // runs AutoLaunch.ksm if available, else runs AutoLaunch.ks. - RUN AutoLaunch( 75000, true, "hello" ). - RUN AutoLaunch.ks( 75000, true, "hello" ). - RUN AutoLaunch.ksm( 75000, true, "hello" ). - -The program that is reading the arguments sees them in the variables it -mentions in :ref:`DECLARE PARAMETER`. - -Important exceptions to the usual filename rules for RUN -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The RUN command does not allow the same sorts of generic open-ended -filenames that the other -file commands allow. This is very important. - -RUN only works when the filename is a bareword filename. It cannot use expression filenames:: - - RUN "ProgName" // THIS WILL FAIL. Run needs a bare word filename. - SET ProgName to "MyProgram". - RUN ProgName // THIS WILL FAIL also. It will attempt to run a file - // called "ProgName.ksm" or "ProgName.ks", when it sees this, - // rather than "MyProgram". - - The reasons for the exception to how filenames work for the RUN - command are too complex to go into in large detail here. Here's the - short version: While the kOS system does defer the majority of the - work - of actually compiling subprogram scripts until run-time, it still - has to - generate some header info about them at compile time, and the - filename - has to be set in stone at that time. Changing this would require a - large re-write of some of the archetecture of the virtual machine. - - -``SWITCH TO .`` ------------------------------ - -Switches to the specified volume. Volumes can be specified by number, or -it’s name (if it has one). See LIST and RENAME. Understanding how -:ref:`volumes work ` is important -to understanding this command. - -Example:: - - SWITCH TO 0. // Switch to volume 0. - RENAME VOLUME 1 TO AwesomeDisk. // Name volume 1 as AwesomeDisk. - SWITCH TO AwesomeDisk. // Switch to volume 1. - PRINT VOLUME:NAME. // Prints "AwesomeDisk". - diff --git a/_sources/commands/flight.txt b/_sources/commands/flight.txt deleted file mode 100644 index c70d56683..000000000 --- a/_sources/commands/flight.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _flight: - -Flight Control -++++++++++++++ - -.. toctree:: - :hidden: - - flight/cooked - flight/raw - flight/pilot - flight/systems - flight/warp - -.. contents:: - :local: - :depth: 1 - -Unless otherwise stated, all controls that a **kOS** CPU attempts will be done on the :ref:`CPU Vessel `. There are three styles of control: - -:ref:`Cooked ` - Give a goal direction to seek, and let **kOS** find the way to maneuver toward it. - -:ref:`Raw ` - Control the craft just like a manual pilot would do from a keyboard or joystick. - -:ref:`Pilot ` - This is the stock way of controlling craft, the state of which can be read in **KerboScript**. - -.. warning:: **SAS OVERRIDES kOS** - - With the current implementation of flight control, if you leave ``SAS`` turned on, it will override **kOS**'s attempts to steer the ship. In order for **kOS** to be able to turn the ship, you need to set ``SAS OFF``. In manual control, you can pilot with ``SAS ON``, because the pilot's manual controls override the ``SAS`` and "fight" against it. In **KOS** no such ability exists. If ``SAS`` is on, **kOS** won't be able to turn the ship. It is common for people writing **kOS** scripts to explicitly start them with a use of the ``SAS OFF`` command just in case you forgot to turn it off before running the script. - -.. _cooked: -.. include:: flight/cooked.rst - -.. _raw: -.. include:: flight/raw.rst - -.. _pilot: -.. include:: flight/pilot.rst - -.. _systems: -.. include:: flight/systems.rst - -.. _warp: -.. include:: flight/warp.rst diff --git a/_sources/commands/flight/cooked.txt b/_sources/commands/flight/cooked.txt deleted file mode 100644 index b10331834..000000000 --- a/_sources/commands/flight/cooked.txt +++ /dev/null @@ -1,65 +0,0 @@ -Cooked Control -============== - -In this style of controlling the craft, you do not steer the craft directly, but instead select a goal direction and let kOS pick the way to steer toward that goal. This method of controlling the craft consists primarily of the following two commands: - -.. _LOCK THROTTLE: -.. object:: LOCK THROTTLE TO value. - - This sets the main throttle of the ship to *value*. Where *value* is a floating point number between 0.0 and 1.0. A value of 0.0 means the throttle is idle, and a value of 1.0 means the throttle is at maximum. A value of 0.5 means the throttle is at the halfway point, and so on. - -.. _LOCK STEERING: -.. object:: LOCK STEERING TO value. - - This sets the direction **kOS** should point the ship where *value* is a :ref:`Vector ` or a :ref:`Direction ` created from a :ref:`Rotation ` or :ref:`Heading `: - - :ref:`Rotation ` - - A Rotation expressed as ``R(pitch,yaw,roll)``. Note that pitch, yaw and roll are not based on the horizon, but based on an internal coordinate system used by **KSP** that is hard to use. Thankfully, you can force the rotation into a sensible frame of reference by adding a rotation to a known direction first. - - To select a direction that is 20 degrees off from straight up:: - - LOCK STEERING TO Up + R(20,0,0). - - To select a direction that is due east, aimed at the horizon:: - - LOCK STEERING TO North + R(0,90,0). - - ``UP`` and ``NORTH`` are the only two predefined rotations. - - :ref:`Heading ` - - A heading expressed as ``HEADING(compass, pitch)``. This will aim 30 degrees above the horizon, due south:: - - LOCK STEERING TO HEADING(180, 30). - - :ref:`Vector ` - - Any vector can also be used to lock steering:: - - LOCK STEERING TO V(100,50,10). - - Note that the internal coordinate system for ``(X,Y,Z)`` is quite complex to explain. To aim in the opposite of the surface velocity direction:: - - LOCK STEERING TO (-1) * SHIP:VELOCITY:SURFACE. - - The following aims at a vector which is the cross product of velocity and direction down to the SOI planet - in other words, it aims at the "normal" direction to the orbit:: - - LOCK STEERING TO VCRS(SHIP:VELOCITY:ORBIT, BODY:POSITION). - -Like all ``LOCK`` expressions, the steering and throttle continually update on their own when using this style of control. If you lock your steering to velocity, then as your velocity changes, your steering will change to match it. Unlike with other ``LOCK`` expressions, the steering and throttle are special in that the lock expression gets executed automatically all the time in the background, while other ``LOCK`` expressions only get executed when you try to read the value of the variable. The reason is that the **kOS** computer is constantly querying the lock expression multiple times per second as it adjusts the steering and throttle in the background. - -Unlocking controls ------------------- - -If you ``LOCK`` the ``THROTTLE`` or ``STEERING``, be aware that this prevents the user from manually controlling them. Until they unlock, the manual controls are prevented from working. You can free up the controls by issuing these two commands:: - - UNLOCK STEERING. - UNLOCK THROTTLE. - -When the program ends, these automatically unlock as well, which means that to control a craft you must make sure the program doesn't end. The moment it ends it lets go of the controls. - -Advantages/Disadvantages ------------------------- - -The advantge of "Cooked" control is that it is simpler to write scripts for, but the disadvantage is that you have no control over the details of the motion. You can't dictate how fast or slow the craft rotates, or which axis it tries to rotate around first, and if your craft is wobbly, you can't dampen the wobbliness. diff --git a/_sources/commands/flight/pilot.txt b/_sources/commands/flight/pilot.txt deleted file mode 100644 index de370d21c..000000000 --- a/_sources/commands/flight/pilot.txt +++ /dev/null @@ -1,176 +0,0 @@ -Pilot Input -=========== - -This is not, strictly speaking, a method of controlling the craft. "Pilot" controls are a way to read the input from the pilot. Most of these controls share the same name as their flight control, prefixed with ``PILOT`` (eg ``YAW`` and ``PILOTYAW``) the one exception to this is the ``PILOTMAINTHROTTLE``. This suffix has a setter and allows you to change the behavior of the throttle that persists even after the current program ends:: - - SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. - -Will ensure that the throttle will be 0 when execution stops. These suffixes allow you to read the input given to the system by the user. - -.. structure:: Control - -.. list-table:: - :widths: 1 1 1 - :header-rows: 1 - - * - Suffix - - Type, Range - - Equivalent Key - - * - :ref:`PILOTMAINTHROTTLE ` - - scalar [0,1] - - ``LEFT-CTRL``, ``LEFT-SHIFT`` - - * - :ref:`PILOTYAW ` - - scalar [-1,1] - - ``D``, ``A`` - * - :ref:`PILOTPITCH ` - - scalar [-1,1] - - ``W``, ``S`` - * - :ref:`PILOTROLL ` - - scalar [-1,1] - - ``Q``, ``E`` - * - :ref:`PILOTROTATION ` - - :ref:`Vector ` - - ``(YAW,PITCH,ROLL)`` - - * - :ref:`PILOTYAWTRIM ` - - scalar [-1,1] - - ``ALT+D``, ``ALT+A`` - * - :ref:`PILOTPITCHTRIM ` - - scalar [-1,1] - - ``ALT+W``, ``ALT+S`` - * - :ref:`PILOTROLLTRIM ` - - scalar [-1,1] - - ``ALT+Q``, ``ALT+E`` - - * - :ref:`PILOTFORE ` - - scalar [-1,1] - - ``N``, ``H`` - * - :ref:`PILOTSTARBOARD ` - - scalar [-1,1] - - ``L``, ``J`` - * - :ref:`PILOTTOP ` - - scalar [-1,1] - - ``I``, ``K`` - * - :ref:`PILOTTRANSLATION ` - - :ref:`Vector ` - - ``(FORE,STARBOARD,TOP)`` - - * - :ref:`PILOTWHEELSTEER ` - - scalar [-1,1] - - ``A``, ``D`` - * - :ref:`PILOTWHEELTHROTTLE ` - - scalar [-1,1] - - ``W``, ``S`` - - * - :ref:`PILOTWHEELSTEERTRIM ` - - scalar [-1,1] - - ``ALT+A``, ``ALT+D`` - * - :ref:`PILOTWHEELTHROTTLETRIM ` - - scalar [-1,1] - - ``ALT+W``, ``ALT+S`` - - * - :ref:`PILOTNEUTRAL ` - - boolean - - Is **kOS** Controlling? - - -.. _SHIP CONTROL PILOTMAINTHROTTLE: -.. object:: SHIP:CONTROL:MAINTHROTTLE - - Returns the pilot's input for the throttle. This is the only ``PILOT`` variable that is settable and is used to set the throttle upon termination of the current **kOS** program. - -.. _SHIP CONTROL PILOTYAW: -.. object:: SHIP:CONTROL:YAW - - Returns the pilot's rotation input about the "up" vector as the pilot faces forward. Essentially left :math:`(-1)` or right :math:`(+1)`. - -.. _SHIP CONTROL PILOTPITCH: -.. object:: SHIP:CONTROL:PITCH - - Returns the pilot's rotation input about the starboard vector up :math:`(+1)` or down :math:`(-1)`. - -.. _SHIP CONTROL PILOTROLL: -.. object:: SHIP:CONTROL:ROLL - - Returns the pilot's rotation input about the logintudinal axis of the ship left-wing-down :math:`(-1)` or left-wing-up :math:`(+1)`. - -.. _SHIP CONTROL PILOTROTATION: -.. object:: SHIP:CONTROL:ROTATION - - Returns the pilot's rotation input as a :ref:`Vector ` object containing ``(YAW, PITCH, ROLL)`` in that order. - - - -.. _SHIP CONTROL PILOTYAWTRIM: -.. object:: SHIP:CONTROL:YAWTRIM - - Returns the pilot's input for the ``YAW`` of the rotational trim. - -.. _SHIP CONTROL PILOTPITCHTRIM: -.. object:: SHIP:CONTROL:PITCHTRIM - - Returns the pilot's input for the ``PITCH`` of the rotational trim. - -.. _SHIP CONTROL PILOTROLLTRIM: -.. object:: SHIP:CONTROL:ROLLTRIM - - Returns the pilot's input for the ``ROLL`` of the rotational trim. - - - - -.. _SHIP CONTROL PILOTFORE: -.. object:: SHIP:CONTROL:FORE - - Returns the the pilot's input for the translation of the ship forward :math:`(+1)` or backward :math:`(-1)`. - -.. _SHIP CONTROL PILOTSTARBOARD: -.. object:: SHIP:CONTROL:STARBOARD - - Returns the the pilot's input for the translation of the ship to the right :math:`(+1)` or left :math:`(-1)` from the pilot's perspective. - -.. _SHIP CONTROL PILOTTOP: -.. object:: SHIP:CONTROL:TOP - - Returns the the pilot's input for the translation of the ship up :math:`(+1)` or down :math:`(-1)` from the pilot's perspective. - -.. _SHIP CONTROL PILOTTRANSLATION: -.. object:: SHIP:CONTROL:TRANSLATION - - Returns the the pilot's input for translation as a :ref:`Vector ` ``(FORE, STARBOARD, TOP)``. - -.. _SHIP CONTROL PILOTWHEELSTEER: -.. object:: SHIP:CONTROL:WHEELSTEER - - Returns the the pilot's input for wheel steering left :math:`(-1)` or right :math:`(+1)`. - -.. _SHIP CONTROL PILOTWHEELTHROTTLE: -.. object:: SHIP:CONTROL:WHEELTHROTTLE - - Returns the the pilot's input for the wheels to move the ship forward :math:`(+1)` or backward :math:`(-1)` while on the ground. - -.. _SHIP CONTROL PILOTWHEELSTEERTRIM: -.. object:: SHIP:CONTROL:WHEELSTEERTRIM - - Returns the the pilot's input for the trim of the wheel steering. - -.. _SHIP CONTROL PILOTWHEELTHROTTLETRIM: -.. object:: SHIP:CONTROL:WHEELTHROTTLETRIM - - Returns the the pilot's input for the trim of the wheel throttle. - -.. _SHIP CONTROL PILOTNEUTRAL: -.. object:: SHIP:CONTROL:NEUTRAL - - Returns true or false if the pilot is active or not. - -Be aware that **kOS** can't control a control at the same time that a player controls it. If **kOS** is taking control of the yoke, then the player can't manually control it. Remember to run:: - - SET SHIP:CONTROL:NEUTRALIZE TO TRUE. - -after the script is done using the controls, or the player will be locked out of control. - - - diff --git a/_sources/commands/flight/raw.txt b/_sources/commands/flight/raw.txt deleted file mode 100644 index 5227f438c..000000000 --- a/_sources/commands/flight/raw.txt +++ /dev/null @@ -1,231 +0,0 @@ -Raw Control -=========== - -If you wish to have your kOS script manipulate a vessel's flight controls directly in a raw way, rather than relying on kOS to handle the flying for you, then this is the type of structure you will need to use to do it. This is offered as an alternative to using the combination of ``LOCK STEERING`` and ``LOCK THROTTLE`` commands. To obtain the CONTROL variable for a vessel, use its :CONTROL suffix:: - - SET controlStick to SHIP:CONTROL. - SET controlStick:PITCH to 0.2. - -Unlike with so-called "Cooked" steering, "raw" steering uses the ``SET`` command, not the ``LOCK`` command. Using ``LOCK`` with these controls won't work. When controlling the ship in a raw way, you must decide how to move the controls in detail. Here is another example:: - - SET SHIP:CONTROL:YAW to 0.2. - -This will start pushing the ship to rotate a bit faster to the right, like pushing the ``D`` key gently. All the following values are set between :math:`-1` and :math:`+1`. Zero means the control is neutral. You can set to values smaller in magnitude than :math:`-1` and :math:`+1` for gentler control:: - - print "Gently pushing forward for 3 seconds.". - SET SHIP:CONTROL:FORE TO 0.2. - SET now to time:seconds. - WAIT until time:seconds > now + 3. - SET SHIP:CONTROL:FORE to 0.0. - - print "Gently Pushing leftward for 3 seconds.". - SET SHIP:CONTROL:STARBOARD TO -0.2. - SET now to time:seconds. - WAIT until time:seconds > now + 3. - SET SHIP:CONTROL:STARBOARD to 0.0. - - print "Starting an upward rotation.". - SET SHIP:CONTROL:PITCH TO 0.2. - SET now to time:seconds. - WAIT until time:seconds > now + 0.5. - SET SHIP:CONTROL:PITCH to 0.0. - - print "Giving control back to the player now.". - SET SHIP:CONTROL:NEUTRALIZE to True. - -One can use :ref:`SHIP:CONTROL:ROTATION ` and :ref:`SHIP:CONTROL:TRANSLATION ` to see the ship's current situation. - -Raw Flight Controls Reference ------------------------------ - -These "Raw" controls allow you the direct control of flight parameters while the current program is running. - -.. note:: - The ``MAINTHROTTLE`` requires active engines and, of course, sufficient and appropriate fuel. The rotational controls ``YAW``, ``PITCH`` and ``ROW`` require active reaction wheels with sufficient energy or *RCS* to be ``ON`` with properly placed thrusters and appropriate fuel. The translational controls ``FORE``, ``STARBOARD`` and ``TOP`` require *RCS* to be ``ON`` with properly placed thrusters and appropriate fuel. - - -.. list-table:: - :widths: 1 1 1 - :header-rows: 1 - - * - Suffix - - Type, Range - - Equivalent Key - - * - :ref:`MAINTHROTTLE ` - - scalar [0,1] - - ``LEFT-CTRL``, ``LEFT-SHIFT`` - - * - :ref:`YAW ` - - scalar [-1,1] - - ``D``, ``A`` - * - :ref:`PITCH ` - - scalar [-1,1] - - ``W``, ``S`` - * - :ref:`ROLL ` - - scalar [-1,1] - - ``Q``, ``E`` - * - :ref:`ROTATION ` - - :ref:`Vector ` - - ``(YAW,PITCH,ROLL)`` - - * - :ref:`YAWTRIM ` - - scalar [-1,1] - - ``ALT+D``, ``ALT+A`` - * - :ref:`PITCHTRIM ` - - scalar [-1,1] - - ``ALT+W``, ``ALT+S`` - * - :ref:`ROLLTRIM ` - - scalar [-1,1] - - ``ALT+Q``, ``ALT+E`` - - * - :ref:`FORE ` - - scalar [-1,1] - - ``N``, ``H`` - * - :ref:`STARBOARD ` - - scalar [-1,1] - - ``L``, ``J`` - * - :ref:`TOP ` - - scalar [-1,1] - - ``I``, ``K`` - * - :ref:`TRANSLATION ` - - :ref:`Vector ` - - ``(FORE,STARBOARD,TOP)`` - - * - :ref:`WHEELSTEER ` - - scalar [-1,1] - - ``A``, ``D`` - * - :ref:`WHEELTHROTTLE ` - - scalar [-1,1] - - ``W``, ``S`` - - * - :ref:`WHEELSTEERTRIM ` - - scalar [-1,1] - - ``ALT+A``, ``ALT+D`` - * - :ref:`WHEELTHROTTLETRIM ` - - scalar [-1,1] - - ``ALT+W``, ``ALT+S`` - - * - :ref:`NEUTRAL ` - - boolean - - Is **kOS** Controlling? - * - :ref:`NEUTRALIZE ` - - boolean - - Releases Control - - - - -.. _SHIP CONTROL MAINTHROTTLE: -.. object:: SHIP:CONTROL:MAINTHROTTLE - - Set between 0 and 1 much like the cooked flying ``LOCK THROTTLE`` command. - -.. _SHIP CONTROL YAW: -.. object:: SHIP:CONTROL:YAW - - This is the rotation about the "up" vector as the pilot faces forward. Essentially left :math:`(-1)` or right :math:`(+1)`. - -.. _SHIP CONTROL PITCH: -.. object:: SHIP:CONTROL:PITCH - - Rotation about the starboard vector up :math:`(+1)` or down :math:`(-1)`. - -.. _SHIP CONTROL ROLL: -.. object:: SHIP:CONTROL:ROLL - - Rotation about the logintudinal axis of the ship left-wing-down :math:`(-1)` or left-wing-up :math:`(+1)`. - -.. _SHIP CONTROL ROTATION: -.. object:: SHIP:CONTROL:ROTATION - - This is a :ref:`Vector ` object containing ``(YAW, PITCH, ROLL)`` in that order. - - - -.. _SHIP CONTROL YAWTRIM: -.. object:: SHIP:CONTROL:YAWTRIM - - Controls the ``YAW`` of the rotational trim. - -.. _SHIP CONTROL PITCHTRIM: -.. object:: SHIP:CONTROL:PITCHTRIM - - Controls the ``PITCH`` of the rotational trim. - -.. _SHIP CONTROL ROLLTRIM: -.. object:: SHIP:CONTROL:ROLLTRIM - - Controls the ``ROLL`` of the rotational trim. - - - - -.. _SHIP CONTROL FORE: -.. object:: SHIP:CONTROL:FORE - - Controls the translation of the ship forward :math:`(+1)` or backward :math:`(-1)`. - -.. _SHIP CONTROL STARBOARD: -.. object:: SHIP:CONTROL:STARBOARD - - Controls the translation of the ship to the right :math:`(+1)` or left :math:`(-1)` from the pilot's perspective. - -.. _SHIP CONTROL TOP: -.. object:: SHIP:CONTROL:TOP - - Controls the translation of the ship up :math:`(+1)` or down :math:`(-1)` from the pilot's perspective. - -.. _SHIP CONTROL TRANSLATION: -.. object:: SHIP:CONTROL:TRANSLATION - - Controls the translation as a :ref:`Vector ` ``(FORE, STARBOARD, TOP)``. - -.. _SHIP CONTROL WHEELSTEER: -.. object:: SHIP:CONTROL:WHEELSTEER - - Turns the wheels left :math:`(-1)` or right :math:`(+1)`. - -.. _SHIP CONTROL WHEELTHROTTLE: -.. object:: SHIP:CONTROL:WHEELTHROTTLE - - Controls the wheels to move the ship forward :math:`(+1)` or backward :math:`(-1)` while on the ground. - -.. _SHIP CONTROL WHEELSTEERTRIM: -.. object:: SHIP:CONTROL:WHEELSTEERTRIM - - Controls the trim of the wheel steering. - -.. _SHIP CONTROL WHEELTHROTTLETRIM: -.. object:: SHIP:CONTROL:WHEELTHROTTLETRIM - - Controls the trim of the wheel throttle. - -.. _SHIP CONTROL NEUTRAL: -.. object:: SHIP:CONTROL:NEUTRAL - - Returns true or false depending if **kOS** has any set controls. *This is not settable.* - -.. _SHIP CONTROL NEUTRALIZE: -.. object:: SHIP:CONTROL:NEUTRALIZE - - This causes manual control to let go. When set to true, **kOS** lets go of the controls and allows the player to manually control them again. *This is not gettable.* - - -Unlocking controls ------------------- - -Once any of the ``SET SHIP:CONTROL`` commands have been used to control the ship, then the manual control by the player is locked out. To give control back to the player you must execute:: - - SET SHIP:CONTROL:NEUTRALIZE to TRUE. - - -Advantages/Disadvantages ------------------------- - -The control over *RCS* translation requires the use of Raw control. Also, with raw control you can choose how gentle to be with the controls and it can be possible to control wobbly craft better with raw control than with cooked control. - - - - - diff --git a/_sources/commands/flight/systems.txt b/_sources/commands/flight/systems.txt deleted file mode 100644 index 0d1a3efbf..000000000 --- a/_sources/commands/flight/systems.txt +++ /dev/null @@ -1,50 +0,0 @@ -Ship Systems -============ - -.. _CONTROLFROM: -.. object:: SET somepart:CONTROLFROM TO (true|false). - - If you have a handle on a part, from ``LIST PARTS``, you can select that part to set the orientation of the craft, just like using the "control from here" in the right-click menu in the game. For more information see :attr:`Part:CONTROLFROM`. - -.. global:: RCS - - :access: Toggle ON/OFF - - Turns the RCS **on** or **off**, like using ``R`` at the keyboard:: - - RCS ON. - -.. global:: SAS - - :access: Toggle ON/OFF - - Turns the SAS **on** or **off**, like using ``T`` at the keybaord:: - - SAS ON. - -.. global:: LIGHTS - - :access: Toggle ON/OFF - - Turns the lights **on** or **off**, like using the ``U`` key at the keyboard:: - - LIGHTS ON. - -.. global:: BRAKES - - :access: Toggle ON/OFF - - Turns the brakes **on** or **off**, like clicking the brakes button, though *not* like using the ``B`` key, because they stay on:: - - BRAKES ON. - -.. global:: TARGET - - :access: Get/Set - :type: string - - Where ``name`` is the name of a target vessel or planet, this will set the current target:: - - SET TARGET TO name. - -Note that the above options also can refer to a different vessel besides the current ship, for example, ``TARGET:THROTTLE`` to read the target's throttle. But not all "set" or "lock" options will work with a different vessel other than the current one, because there's no authority to control a craft the current program is not attached to. diff --git a/_sources/commands/flight/warp.txt b/_sources/commands/flight/warp.txt deleted file mode 100644 index 2bb70285a..000000000 --- a/_sources/commands/flight/warp.txt +++ /dev/null @@ -1,9 +0,0 @@ -Time Warping -============ - - -.. global:: WARP - The :global:`WARP` global variable can be set to change the game warp to a value between 0 and 7:: - - SET WARP TO 5. // Sets warp to 1000x - SET WARP TO 0. // Sets warp to 0x (real time) diff --git a/_sources/commands/list.txt b/_sources/commands/list.txt deleted file mode 100644 index 39c6c7fd9..000000000 --- a/_sources/commands/list.txt +++ /dev/null @@ -1,108 +0,0 @@ -.. _list command: - -.. index:: LIST (command) - -``LIST`` Command -================ - -A :struct:`List` is a type of :ref:`Structure ` that stores a list of variables in it. The ``LIST`` command either prints or crates a :struct:`List` object containing items queried from the game. For more information, see the :ref:`page about the List structure `. - -``FOR`` Loop ------------- - -Lists need to be iterated over sometimes, to help with this we have the :ref:`FOR loop, explained on the flow control page `. The ``LIST`` Command comes in 4 forms: - -1. ``LIST.`` - When no parameters are given, the LIST command is exactly equivalent to the command:: - - LIST FILES. - -2. ``LIST ListKeyword.`` - This variant prints items to the termianl sceen. Depending on the *ListKeyword* used (see below), different values are printed. - -3. ``LIST ListKeyword IN YourVariable.`` - This variant takes the items that would otherwise have been printed to the terminal screen, and instead makes a :struct:`List` of them in ``YourVariable``, that you can then iterate over with a :ref:`FOR loop ` if you like. - -4. ``LIST ListKeyword FROM SomeVessel IN YourVariable.`` - This variant is just like variant (3), except that it gives a list of the items that exist on some other vessel that might not necessarily be the current :ref:`CPU_vessel `. - -Available Listable Keywords ---------------------------- - -The *ListKeyword* in the above command variants can be any of the -following: - -Universal Lists -^^^^^^^^^^^^^^^ - -These generate :struct:`lists ` that are not dependent on which :struct:`Vessel`: - -``Bodies`` - :struct:`List` of :struct:`Celestial Bodies ` - -``Targets`` - :struct:`List` of possible target :struct:`Vessels ` - -Vessel Lists -^^^^^^^^^^^^ - -These generate :struct:`lists ` of items on the :struct:`Vessel`: - -``Resources`` - :struct:`List` of :struct:`Resources ` -``Parts`` - :struct:`List` of :struct:`Parts ` -``Engines`` - :struct:`List` of :struct:`Engines ` -``Sensors`` - :struct:`List` of :struct:`Sensors ` -``Elements`` - ?? -``DockingPorts`` - list of `DockingPorts ` - -File System Lists -^^^^^^^^^^^^^^^^^ - -These generate :struct:`lists ` about the files in the system: - -``Files`` - :struct:`List` the :struct:`files ` on the current Volume. (note below) -``Volumes`` - :struct:`List` all the :ref:`volumes` that exist. - -.. note:: - - ``LIST FILES.`` is the default if you give the ``LIST`` command no parameters. - -Examples:: - - LIST. // Prints the list of files on current volume. - LIST FILES. // Does the same exact thing, but more explicitly. - LIST VOLUMES. // which volumes can be seen by this CPU? - LIST FILES IN fileList. // fileList is now a LIST() containing file structures. - -The file structures returned by ``LIST FILES IN fileList.`` are documented :ref:`on a separate page `. - -Here are some more examples:: - - // Prints the list of all - // Celestial bodies in the system. - LIST BODIES. - - // Puts the list of bodies into a variable. - LIST BODIES IN bodList. - // Iterate over everything in the list: - SET totMass to 0. - FOR bod in bodList { - SET totMass to totMass + bod:MASS. - }. - PRINT "The mass of the whole solar system is " + totMass. - - // Adds variable foo that contains a list of - // resources for my currently target vessel - LIST RESOURCES FROM TARGET IN foo. - FOR res IN foo { - PRINT res:NAME. // Will print the name of every - // resource in the vessel - }. diff --git a/_sources/commands/parts.txt b/_sources/commands/parts.txt deleted file mode 100644 index 83414d561..000000000 --- a/_sources/commands/parts.txt +++ /dev/null @@ -1,83 +0,0 @@ -Querying a vessel's parts -========================= - -This is a quick list to get the idea across fast. The actual -details of the meaning of these things is complex enough to -warrant `its own -topic <../../summary_topics/ship_parts_and_modules/index.html>`__. - -To get the parts of a vessel (such as your current vessel, -called SHIP), you can do the following things: - -These are equivalent. They get the full list of all the parts: - -:: - - LIST PARTS IN MyPartList. - SET MyPartlist TO SHIP:PARTS. - -This gets all the parts that have the name given, as either a -nametag (Part:TAG), a title (Part:TITLE), or a name, (Part:NAME): - -:: - - SET MyPartList to SHIP:PARTSDUBBED("something"). - -These are other ways to get parts that are more specific about what -exact nomenclature system is being used: - -:: - - SET MyPartList to SHIP:PARTSTAGGED("something"). // only gets parts with Part:TAG = "something". - SET MyPartList to SHIP:PARTSTITLED("something"). // only gets parts with Part:TITLE = "something". - SET MyPartList to SHIP:PARTSNAMED("something"). // only gets parts with Part:NAME = "something". - -This gets all the PartModules on a ship that have the same module name: - -:: - - SET MyModList to SHIP:MODULESNAMED("something"). - -This gets all the parts that have been defined to have some sort -of activity occur from a particular action group: - -:: - - SET MyPartList to SHIP:PARTSINGROUP( AG1 ). // all the parts in action group 1. - -This gets all the modules that have been defined to have some sort -of activity occur from a particular action group: - -:: - - SET MyModList to SHIP:MODULESINGROUP( AG1 ). // all the parts in action group 1. - -This gets the primary root part of a vessel (the command core that you -placed FIRST when building the ship in the VAB or SPH): - -:: - - SET firstPart to SHIP:ROOTPART. - -This lets you query all the parts that are immediate children of the -current part in the tree: - -:: - - SET firstPart to SHIP:ROOTPART. - FOR P IN firstPart:CHILDREN { - print "The root part as an immediately attached part called " + P:NAME. - }. - -You could keep walking down the tree this way, or go upward with PARENT -and HASPARENT: - -:: - - IF thisPart:HASPARENT { - print "This part's parent part is "+ thisPart:PARENT:NAME. - }. - -This tree method of walking the parts is slightly less useful because -user -functions don't exist, making recursive algorithms messy to implement. diff --git a/_sources/commands/prediction.txt b/_sources/commands/prediction.txt deleted file mode 100644 index d61bb3b32..000000000 --- a/_sources/commands/prediction.txt +++ /dev/null @@ -1,74 +0,0 @@ -Predictions of Flight Path -========================== - -.. contents:: - :local: - :depth: 1 - -.. note:: - - **Manipulating the maneuver nodes** - - To alter the maneuver nodes on a vessel's flight plan, use the ADD and REMOVE commands as described on the :ref:`maneuver node manipulation page `. - - Using the Add and Remove commands as described on that page, you may alter the flight plan of the CPU\_vessel, however kOS does not automatically execute the nodes. You still have to write the code to decide how to successfully execute a planned maneuver node. - -The following prediction functions do take into account the future maneuver nodes planned, and operate under the assumption that they will be executed as planned. - -These return predicted information about the future position and velocity of an object. - -.. function:: POSITIONAT(orbitable,time) - - :param orbitable: A :Ref:`Vessel `, :ref:`Body ` or other :ref:`Orbitable ` object - :type orbitable: :ref:`Orbitable ` - :param time: Time of prediction - :type time: :ref:`Timestamp ` - :return: A position :ref:`Vector ` expressed as the coordinates in the :ref:`ship-center-raw-rotation ` frame - - Returns a prediction of where the :ref:`Orbitable ` will be at some :ref:`universal Timestamp `. If the :ref:`Orbitable ` is a :ref:`Vessel `, and the :ref:`Vessel ` has planned :ref:`maneuver nodes `, the prediction assumes they will be executed exactly as planned. - -.. function:: VELOCITYAT(orbitable,time) - - :param orbitable: A :Ref:`Vessel `, :ref:`Body ` or other :ref:`Orbitable ` object - :type orbitable: :ref:`Orbitable ` - :param time: Time of prediction - :type time: :ref:`Timestamp ` - :return: An :ref:`ObitalVelocity ` structure. - - Returns a prediction of what the :ref:`Orbitable's ` velocity will be at some :ref:`universal Timestamp `. If the :ref:`Orbitable ` is a :ref:`Vessel `, and the :ref:`Vessel ` has planned :ref:`maneuver nodes `, the prediction assumes they will be executed exactly as planned. - -.. function:: ORBITAT(orbitable,time) - - :param orbitable: A :Ref:`Vessel `, :ref:`Body ` or other :ref:`Orbitable ` object - :type orbitable: :ref:`Orbitable ` - :param time: Time of prediction - :type time: :ref:`Timestamp ` - :return: An :ref:`Orbit ` structure. - - Returns the :ref:`Orbit patch ` where the :ref:`Orbitable ` object is predicted to be at some :ref:`universal Timestamp `. If the :ref:`Orbitable ` is a :ref:`Vessel `, and the :ref:`Vessel ` has planned :ref:`maneuver nodes `, the prediction assumes they will be executed exactly as planned. - -Examples:: - - //kOS - // test the future position and velocity prediction. - // Draws a position and velocity vector at a future predicted time. - - declare parameter item. // thing to predict for, i.e. SHIP. - declare parameter offset. // how much time into the future to predict. - declare parameter velScale. // how big to draw the velocity vectors. - // If they're far from the camera you should draw them bigger. - - - set predictUT to time + offset. - set stopProg to false. - - set futurePos to positionat( item, predictUT ). - set futureVel to velocityat( item, predictUT ). - - set drawPos to vecdrawargs( v(0,0,0), futurePos, green, "future position", 1, true ). - set drawVel to vecdrawargs( futurePos, velScale*futureVel:orbit, yellow, "future velocity", 1, true ). - -Example Screenshot: - -.. figure: /_images/commands/maneuver_nodes.png - :width: 80 % diff --git a/_sources/commands/terminal.txt b/_sources/commands/terminal.txt deleted file mode 100644 index 13f250fa2..000000000 --- a/_sources/commands/terminal.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _terminal: - -Terminal and game environment -============================= - -.. global:: CLEARSCREEN - - - Clears the screen and places the cursor at the top left:: - - CLEARSCREEN. - -.. global:: PRINT - - Prints the selected text to the screen. Can print strings, or the result of an expression:: - - PRINT “Hello”. - PRINT 4+1. - PRINT “4 times 8 is: “ + (4*8). - -.. function:: AT(col,line) - - :parameter col: (integer) column starting with zero (left) - :parameter line: (integer) line starting with zero (top) - - Used in combination with :global:`PRINT`. Prints the selected text to the screen at specified location. Can print strings, or the result of an expression:: - - PRINT “Hello” AT(0,10). - PRINT 4+1 AT(0,10). - PRINT “4 times 8 is: “ + (4*8) AT(0,10). - -.. global:: MAPVIEW - - :access: Get/Set - :type: boolean - - A variable that controls or queries whether or not the game is in map view:: - - IF MAPVIEW { - PRINT "You are looking at the map.". - } ELSE { - PRINT "You are looking at the flight view.". - }. - - You can switch between map and flight views by setting this variable:: - - SET MAPVIEW TO TRUE. // to map view - SET MAPVIEW TO FALSE. // to flight view - -.. global:: REBOOT - - Reboots the kOS module. - -.. global:: SHUTDOWN - - Causes kOS module to shutdown. diff --git a/_sources/contribute.txt b/_sources/contribute.txt deleted file mode 100644 index bc9ee809d..000000000 --- a/_sources/contribute.txt +++ /dev/null @@ -1,23 +0,0 @@ -.. _contribute: - -Contribute -========== - -How to Contribute to this Project ---------------------------------- - -Do you know or are willing to learn C# and the **KSP** public API? Great, we could use your help! The source code for **kOS** is kept on `github`_ and is currently maintained by `Chris Woerz`_ and `Steven Mading`_. The first steps you will want to take is to clone the latest version of **kOS** from github and try to build it using your favorite C# compiler suite. - -.. _github: https://github.com/KSP-KOS -.. _Chris Woerz: https://github.com/erendrake -.. _Steven Mading: https://github.com/Dunbaratu - -How to Edit this Documentation ------------------------------- - -This documentation was written using `reStructuredText`_ and compiled into HTML using `Sphinx`_ and the `Read The Docs Theme`_. It is maintained by `Steven Mading`_, `Chris Woerz`_ and `Johann Goetz`_ - -.. _reStructuredText: http://docutils.sourceforge.net/rst.html -.. _Sphinx: http://sphinx-doc.org/ -.. _Read The Docs Theme: https://github.com/snide/sphinx_rtd_theme -.. _Johann Goetz: http://github.com/theodoregoetz diff --git a/_sources/general.txt b/_sources/general.txt deleted file mode 100644 index 31cb6910c..000000000 --- a/_sources/general.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _general: - -General Topics -============== - -These topics discuss the interfacing between **kOS** and **Kerbal Space Program**. - -.. toctree:: - :maxdepth: 2 - - CPU Vessel (SHIP) - CPU Hardware - - Launcher Panel - - Files & Volumes - Machine Code - - Name Tags - Parts & PartModules - - Communication Range diff --git a/_sources/general/applauncher_panel.txt b/_sources/general/applauncher_panel.txt deleted file mode 100644 index 40f56278c..000000000 --- a/_sources/general/applauncher_panel.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _applauncher: - -kOS Control Panel -================= - -As of kOS v0.15, kOS now makes use of Kerbal Space Program's built-in -Application Launcher toolbar, to open a config/status panel for kOS. - -This panel behaves like the other display panels the launcher creates, -and operates mutually exclusively with them. (For example you can't -make the kOS App Control Panel appear at the same time as the stock -Resource display panel. Opening one toggles the other one off, -and visa versa.) - -Here is an annotated image of the control panel and what it does: - -.. figure:: /_images/general/applauncher_panel.png - :width: 80 % diff --git a/_sources/general/comm_range.txt b/_sources/general/comm_range.txt deleted file mode 100644 index 95fcf8c95..000000000 --- a/_sources/general/comm_range.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _comm range: - -Communication Range For Remote Updates -====================================== - -.. warning:: - .. deprecated:: 0.12.2 - The stock game and the future of this feature is still fuzzy, and will likely be related to RemoteTech2 in some way. If you don't use RemoteTech2, then there will be no check for range anymore as of version 0.12.2. The following shortcuts are now used. - - ``COMMRANGE`` - always returns a Very Big Number, and - - ``INRANGE`` - always returns true. - - If you are using a version of ``kOS >= 0.12.2``, then most of what this page says won't be true. - -Communication Range (Deprecated) --------------------------------- - -Kerbin must be within CommRange of the vessel in order for the following operations to work: - -- COPY a file from a local volume to Archive -- COPY a file from Archive to a local volume. -- LIST the files on the Archive. - -You can always find out whether or not the vessel is within transmission range of Kerbin using the following: - -- PRINT COMMRANGE. // Shows a number, in meters. -- PRINT INCOMMRANGE. // Shows a boolean true/false, for whether or not - you are in range. - -A future plan is to implement a feature that when the RemoteTech mod is installed, kOS will query RemoteTech to ask whether or not the vessel is in communications range, and allow RemoteTech to override the calculation described below. - -The system described below is meant to be used only when RemoteTech2 is not installed. - -How to calculate communications range -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Communications range is decided by how many antennae are installed, and of what type. There are three categories of antenna: - -- longAntenna: (The Communotron 16 'stick') -- mediumDishAntenna: (The Comms DTS-M1) -- commDish: (The Communotron 88-88) - -The number of meters of range is decided by this formula: - -max range = ( (100,000 + L\ *1,000,000) *\ 100^M \* 200^D ) meters Where: \* L = number of longAntenna's on the vessel. \* M = number of mediumDishAntenna's on the vessel. \* D = number of commDish's on the vessel. - - -+----------------+----------------+-----------------------------------+ -|No. of Antennae | | | -+----+------+----+Max range |Context for comparison | -| |Medium| | | | -|Long|Dish |Dish| | | -+====+======+====+================+===================================+ -|0 |0 |0 |100 km | | -+----+------+----+----------------+-----------------------------------+ -|1 |0 |0 |1100 km | | -+----+------+----+----------------+-----------------------------------+ -|2 |0 |0 |2100 km | | -+----+------+----+----------------+-----------------------------------+ -|0 |1 |0 |10,000 km | | -+----+------+----+----------------+-----------------------------------+ -|0 |0 |1 |20,000 km |Mun-to-Kerbin = 12,000 km | -+----+------+----+----------------+-----------------------------------+ -|1 |0 |1 |220,000 km | | -+----+------+----+----------------+-----------------------------------+ -|2 |0 |1 |420,000 km | | -+----+------+----+----------------+-----------------------------------+ -|0 |2 |0 |1,000,000 km | | -+----+------+----+----------------+-----------------------------------+ -|0 |0 |2 |4,000,000 km |Almost the closest distance | -| | | | |Moho gets to the Sun | -+----+------+----+----------------+-----------------------------------+ -|1 |1 |1 |22,000,000 km | | -+----+------+----+----------------+-----------------------------------+ -|1 |0 |2 |44,000,000 km |A bit bigger than the 'diameter' | -| | | | |of Duna's orbit of the Sun | -+----+------+----+----------------+-----------------------------------+ -|2 |0 |2 |84,000,000 km |A bit bigger than the biggest | -| | | | |distance between Jool and the Sun | -+----+------+----+----------------+-----------------------------------+ -|3 |0 |2 |124,000,000 km |A bit bigger than the biggest | -| | | | |distance between Eeloo and the Sun | -+----+------+----+----------------+-----------------------------------+ -|1 |2 |1 |2,200,000,000 km| | -+----+------+----+----------------+-----------------------------------+ -|1 |0 |3 |8,800,000,000 km|Larger than any distance in the | -| | | | |Kerbal system | -+----+------+----+----------------+-----------------------------------+ diff --git a/_sources/general/compiling.txt b/_sources/general/compiling.txt deleted file mode 100644 index daac4eb9e..000000000 --- a/_sources/general/compiling.txt +++ /dev/null @@ -1,103 +0,0 @@ -.. _compiling: - -KerboScript Machine Code -======================== - -.. contents:: - :local: - :depth: 1 - -Compiling to a KSM File ------------------------ - -When you run your Kerboscript programs, behind the scenes they get compiled into a form in memory that runs much smoother but at the same time is quite hard for a Kerbal to read and understand. The actual computer hardware built by your friends at Compotronix incorporated actually run the program using these tiny instructions called "opcodes". In the early days of room-sized computers before we were able to get them down to the compact size of just a meter or so across, all programmers had to use this difficult system, referred to as "machine language". Ah, those were heady days, but they were hard. - -The commands you actually write when you say something like ``SET X TO 1.0.`` are really a euphemism for these "machine language" opcodes under the surface. - -When you try to "RUN" your script, the first thing that kOS does is transform your script into this ancient and arcane "machine language" form, storing it in its memory, and from then on it runs using that. - -This process of transforming your script into Machine Language, or "ML" is called "Compiling". - -The "RUN" command does this silently, without telling you. This is why you may have noticed the universe slightly stutter for a moment when you first run your program. Compiling is hard work for the universe to do. - -Why Do I Care? -~~~~~~~~~~~~~~ - -.. warning:: - - This is an experimental feature. - -The reason it matters is this: Although once it's loaded into memory and running, these opcodes actually have a lot of baggage and take up a lot of space, when they're stored passively on the disk not doing anything, they can be smaller than your script programs are. For one thing, they don't care about your comments (only other Kerbals reading your script do), and they don't care about your indenting (only other Kerbals reading your script do). - -So, given that the compiled "ML" codes are the only thing your program really needs to be run, why not just store THAT instead of storing the entire script, and then you can put the ML files on your remote probes instead of putting the larger script files on them. - -And THAT is the purpose of the COMPILE command. - -It does some, but not all, of the compiling work that the RUN command does, and then stores the results in a file that you can run instead of running the original script. - -The output of the COMPILE command is a file in what we call KSM format. - -KSM stands for "KerboScript Machine code", and it has nearly the same information the program will have when it's loaded and running, minus a few extra steps about relocating it in memory. - -How to Use KSM Files --------------------- - -Let's say that you have 3 programs your probe needs, called: - -- myprog1.ks -- myprog2.ks -- myprog3.ks - -And that myprog1 calls myprog2 and myprog3, and you normall would call the progam this way:: - - SWITCH TO 1. - COPY myprog1 from ARCHIVE. - COPY myprog2 from ARCHIVE. - COPY myprog3 from ARCHIVE. - RUN myprog1(1,2,"hello"). - -Then you can put just the compiled KSM versions of them on your vessel and run it this way:: - - SWITCH TO ARCHIVE. - - COMPILE myprog1.ks to myprog1.ksm. - COPY myprog1.ksm to 1. - - COMPILE myprog2. // If you leave the arguments off, it assumes you are going from .ks to .ksm - COPY myprog2.ksm to 1. - - COMPILE myprog3. // If you leave the arguments off, it assumes you are going from .ks to .ksm - COPY myprog2.ksm to 1. - - SWITCH TO 1. - RUN myprog1(1,2,"hello"). - -Default File Naming Conventions -------------------------------- - -When you have both a .ks and a .ksm file, the RUN command allows you to specify which one you meant explicitly, like so:: - - RUN myprog1.ks. - RUM myprog1.ksm. - -But if you just leave the file extension off, and do this:: - - RUN myprog1. - -Then the RUN command will first try to run a file called "myprog1.ksm" and if it cannot find such a file, then it will try to run one called "myprog1.ks". - -In this way, if you decide to take the plunge and attempt the use of KSM files, you shouldn't have to change the way any of your scripts call each other, provided you just used versions of the filenames without mentioning the file extensions. - -Downsides to Using KSM Files ----------------------------- - -1. Be aware that if you use this feature, you do lose the ability to have the line of code printed out for you when the kOS computer finds an error in your program. It will still tell you what line number the error happened on, but it cannot show you the line of code. Just the number. - -2. Know that you cannot view the program inside the in-game editor anymore when you do this. A KSM file will not appear right in the editor. It requires a magic tool called a "hex editor" to properly see what's happening inside the file. - -3. **The file isn't always smaller**. There's a threshold at which the KSM file is actually bigger than the source KS file. For large KS files, the KSM file will be smaller, but for short KS files, the KSM file will be bigger, because there's a small amount of overhead they have to store that is only efficient if the data was large enough. - -More Reading and Fiddling with Your Bits ----------------------------------------- - -So, if you are intrigued by all this and want to see how it all *REALLY* works under the hood, Computronix has deciced to make `internal document MLfile-zx1/a `__ on the basic plan of the ML file system open for public viewing, if you are one of those rare Kerbals that enjoys fiddling with your bits. No, not THOSE kind of bits, the computery kind! diff --git a/_sources/general/cpu_hardware.txt b/_sources/general/cpu_hardware.txt deleted file mode 100644 index ae7eb5061..000000000 --- a/_sources/general/cpu_hardware.txt +++ /dev/null @@ -1,169 +0,0 @@ -.. _cpu hardware: - -The kOS CPU hardware -==================== - -While it's possible to write some software without knowing anything about the underlying computer hardware, and there are good design principles that state one should never make assumptions about the computer hardware when writing software, there are still some basic things about how computers work in general that a good programmer needs to be aware of to write good code. Along those lines, the KSP player writing a Kerboscript program needs to know a few basic things about how the simulated kOS CPU operates in order to be able to write more advanced scripts. This page contains that type of information. - -.. contents:: - :local: - :depth: 2 - -Update Ticks and Physics Ticks ------------------------------- - -Kerbal Space Program simulates the universe by running the universe in small incremental time intervals that for the purpose of this document, we will call "**physics ticks**\ ". The exact length of time for a physics tick varies as the program runs. One physics tick might take 0.09 seconds while the next one might take 0.085 seconds. (The default setting for the rate of physics ticks is 25 ticks per second, just to give a ballpark figure, but you **must not** write any scripts that depend on this assumption because it's a setting the user can change, and it can also vary a bit during play depending on system load. The setting is a target goal for the game to try to achieve, not a guarantee. If it's a fast computer with a speedy animation frame rate, it will try to run physics ticks less often than it runs animation frame updates, to try to make the physics tick rate match this setting. On the other hand, If it's a slow computer, it will try to sacrifice animation frame rate to archive this number (meaning physics get calculated faster than you can see the effects.) The game will try as hard as it can to keep the physics rate matched to the setting, not faster and not slower, because when the physics rate isn't steady, the simulation breaks down and starts making erroneous things happen, like miscalculating forces on part joints and breaking ships. But however hard the game tries to stick to the setting, it can't do it 100% the same every single moment, thus the need to actually measure elapsed time in the TIME variable in your scripts. - -The entire simulated universe is utterly frozen during the duration of a physics tick. For example, if one physics tick occurs at timestamp 10.51 seconds, and the next physics tick occurs 0.08 seconds later at timestamp 10.59 seconds, then during the entire intervening time, at timestamp 10.52 seconds, 10.53 seconds, and so on, nothing moves. The clock is frozen at 10.51 seconds, and the fuel isn't being consumed, and the vessel is at the same position. On the next physics tick at 10.59 seconds, then all the numbers are updated. The full details of the physics ticks system are more complex than that, but that quick description is enough to describe what you need to know about how kOS's CPU works. - -There is another kind of time tick called an **Update tick**. It is similar to, but different from, a **physics tick**. *Update ticks* often occur a bit more often than *physics ticks*. Update ticks are exactly the same thing as your game's Frame Rate. Each time your game renders another animation frame, it performs another Update tick. On a good gaming computer with fast speed and a good graphics card, It is typical to have about 2 or even 3 *Update ticks* happen within the time it takes to have one *physics tick* happen. On a slower computer, it is also possible to go the other way and have *Update ticks* happening *less* frequently than *physics tics*. Basically, look at your frame rate. Is it higher than 25 fps? If so, then your *update ticks* happen faster than your *physics ticks*, otherwise its the other way around. - -.. note:: - - The kOS CPU runs every **update tick** rather than every **physics tick**. - -On each update tick, each kOS CPU that's within physics range (i.e. 2.5 km), wakes up and performs the following steps, in this order: - -1. Run the conditional checks of all TRIGGERS (see below) -2. For any TRIGGERS who's conditional checks are true, execute the entire body of the trigger. -3. If there's a pending WAIT statement, check if it's done. If so wake up. -4. If awake, then execute the next :attr:`Config:IPU` number of instructions of the main program. - -Note that the number of instructions being executed (CONFIG:IPU) are NOT lines of code or kerboscript statements, but rather the smaller instruction opcodes that they are compiled into behind the scenes. A single kerboscript statement might become anywhere from one to ten or so instructions when compiled. - -Triggers --------- - -There are multiple things within kerboscript that run "in the background" always updating, while the main script continues on. The way these work is a bit like a real computer's multithreading, but not *quite*. Collectively all of these things are called "triggers". - -Triggers are all of the following: - -- LOCKS which are attached to flight controls (THROTTLE, STEERING, - etc), but not other LOCKS. -- ON condition { some commands }. -- WHEN condition THEN { some commands }. - -The way these work is that once per **update tick**, all the LOCK expressions which directly affect flight control are re-executed, and then each conditional trigger's condition is checked, and if true, then the entire body of the trigger is executed all the way to the bottom \*before any more instructions of the main body are executed\*. This means that execution of a trigger never gets interleaved with the main code. Once a trigger happens, the entire trigger occurs all in one go before the rest of the main body continues. - -Do Not Loop a Long Time in a Trigger Body! -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because the entire body of a trigger will execute all the way to the bottom on *within a single* **update tick**, *before* any other code continues, it is vital that you not write code in a trigger body that takes a long time to execute. The body of a trigger must be kept quick. An infinite loop in a trigger body could literally freeze all of KSP, because the kOS mod will never finish executing its update. - -*As of kOS version 0.14 and higher, this condition is now being checked for* and the script will be **terminated with a runtime error** if the triggers like WHEN/THEN and ON take more than :attr:`Config:IPU` instructions to execute. The sum total of all the code within your WHEN/THEN and ON code blocks MUST be designed to complete within one update tick. - -**This may seem harsh**. Ideally, kOS would only generate a runtime error if it thought your script was stuck in an **infinite loop**, and allow it to exceed the :attr:`Config:IPU` number of instructions if it was going to finish and just needed a little longer to to finish its work. But, because of a well known problem in computer science called **`the halting problem `__**, it's literally impossible for kOS, or any other software for that matter, to detect the difference between another program's infinite loop versus another program's loop that will end soon. kOS only knows how long your triggers have taken so far, not how long they're going to take before they're done, or even if they'll be done. - -If you suspect that your trigger body would have ended if it was allowed to run a little longer, try setting your :attr:`Config:IPU` setting a bit higher and see if that makes the error go away. - -If it does not make the error go away, then you will need to redesign your script to not depend on running a long-lasting amount of code inside triggers. - -But I Want a Loop!! -~~~~~~~~~~~~~~~~~~~ - -If you want a trigger body that is meant to loop, the only acceptable way to do it is to design it to execute just once, but then use the PRESERVE keyword to keep the trigger around for the next update. Thus your trigger becomes a sort of "loop" that executes one iteration per **update tick**. - -It is also important to consider the way triggers execute for performance reasons too. Every time you write an expression for a trigger, you are creating a bit of code that gets executed fully to the end before your main body will continue, once each **update tick**. A complex expression in a trigger condition, which in turn calls other complex LOCK expressions, which call other complex LOCK expressions, and so on, may cause kOS to bog itself down during each update. (And as of version 0.14, it may cause kOS to stop your program and issue a runtime error if it's taking too long.) - -Because of how WAIT works, you cannot put a WAIT statement inside a trigger. If you try, it will have no effect. This is because WAIT requires the ability of the program to go to sleep and then in a later update tick, continue from where it left off. Because triggers run to the bottom entirely within one update tick, they can't do that. - -Wait!!! -~~~~~~~ - -Any WAIT statement causes the kerboscript program to immediately stop executing the main program where it is, even if far fewer than :attr:`Config:IPU` instructions have been executed in this **update tick**. It will not continue the execution until at least the next **update tick**, when it will check to see if the WAIT condition is satisfied and it's time to wake up and continue. - -Therefore ANY WAIT of any kind will guarantee that your program will allow at least one **update tick** to have happened before continuing. If you attempt to:: - - WAIT 0.001. - -But the duration of the next update tick is actually 0.09 seconds, then you will actually end up waiting at least 0.09 seconds. It is impossible to wait a unit of time smaller than one update tick. Using a very small unit of time in a WAIT statement is an effective way to force the CPU to allow a update tick to occur before continuing to the next line of code. Similarly, if you just say:: - - WAIT UNTIL TRUE. - -Then even though the condition is immediately true, it will still wait one update tick to discover this fact and continue. - -The Frozen Universe -------------------- - -Each **update** *tick*, the kOS mod wakes up and runs through all the currently loaded CPU parts that are in "physics range" (i.e. 2.5 km), and executes a batch of instructions from your script code that's on them. It is important to note that during the running of this batch of instructions, because no **physics ticks** are happening during it, none of the values that you might query from the KSP system will change. The clock time returned from the TIME variable will keep the same value throughout. The amount of fuel left will remain fixed throughout. The position and velocity of the vessel will remaining fixed throughout. It's not until the next physics tick occurs that those values will change to new numbers. It's typical that several lines of your kerboscript code will run during a single update tick. - -Effectively, as far as the *simulated* universe can tell, it's as if your script runs several instructions in literally zero amount of time, and then pauses for a fraction of a second, and then runs more instructions in literally zero amount of time, then pauses for a fraction of a second, and so on, rather than running the program in a smoothed out continuous way. - -If your animation rate is slow enough, it gets even weirder. If your animation *update ticks* occur less often than your *physics ticks*, then it's as if your program spends the majority of the time paused, and only occasionally wakes up to execute a short burst of instructions. - -Because of the difference between *update ticks* and *physics ticks*, it's entirely possible that your kOS script runs multiple updates in a row while the universe is still frozen, or it's possible to go the other way around and have the universe move more than one physics tick before your program has time to notice and react. A well written kOS script should be able to handle both cases. - -This is a vital difference between how a kOS CPU behaves versus how a real world computer behaves. In a real world computer, you would know for certain that time will pass, even if it's just a few picoseconds, between the execution of one statement and the next. - -So Why Does This Matter? -~~~~~~~~~~~~~~~~~~~~~~~~ - -The reason this matters is because of code that tries to do things like this: Imagine something like this inside a script designed to hover in place:: - - PRINT "Waiting until altitude is". - PRINT "holding stable within 0.1 meters.". - - SET PREV_ALT TO -99999. // bogus start value - UNTIL ABS( PREV_ALT - SHIP:ALTITUDE ) < 0.1 { - - SET PREV_ALT TO SHIP:ALTITUDE. - - // Assume there's fancy PID controller - // commands here, omitted for this example. - - } - -This bit of code, if you assume you've written a nice bit of code where the comment is, looks like it would make sense at first. It looks like it should work. It records the previous altitude at the start of the loop body, and if the altitude hasn't changed by much by the start of the next loop, it assumes the altitude has become stable and it stops. - -BUT, due to the frozen nature of the measurements during a **physics tick**, it's entirely possible, and quite likely, that the loop would exit prematurely because no simulation time has passed between the two altitude measurements. The previous altitude and the current altitude are the same. Not because the vessel has no vertical motion, but because the loop is executing fast enough to finish more than one iteration within the same **physics tick**. The two altitude measurements are the same because no time has passed in the simulated universe. - -The Fix: Wait for Time to Change -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you are executing a loop like the one above in which it is absolutely vital that the next iteration of the loop must occur in a *different* **physics tick** than the previous one, so that it can take *new* measurements that are different, the solution is to use a WAIT statement that will delay until there's evidence that the physics clock has moved a tick. - -The most effective way to do that is to check the `TIME <../../structure/timespan/index.html>`__ and see if it's different than it was before. As long as you are still within the same *physics tick*, the TIME will not move:: - - PRINT "Waiting until altitude is holding stable within 0.1 meters.". - - SET PREV_ALT TO -99999. // bogus start value - UNTIL ABS( PREV_ALT - SHIP:ALTITUDE ) < 0.1 { - - SET PREV_ALT TO SHIP:ALTITUDE. - - // Assume there's fancy PID controller - // commands here, omitted for this example. - - SET TIMESTAMP TO TIME:SECONDS. - WAIT UNTIL TIME:SECONDS > TIMESTAMP. // clock will not move - // until we are in a new - // physics tick. - } - -A More Elegant Solution -~~~~~~~~~~~~~~~~~~~~~~~ - -Thanks to user *Cairan*, who suggested this very good idea in the -forums. You may put this code up near the top of your script:: - - // force it to trigger immediately the first time through - SET LASTPHYS TO -99999. - - LOCK PHYSICS TO MIN(1,FLOOR((TIME:SECONDS-LASTPHYS) / 0.04 )). - - WHEN PHYSICS THEN { - SET LASTPHYS TO TIME:SECONDS. - - // Store your measurements from - // the physical world here during - // the body of this WHEN - - PRESERVE. - } - -An Even Better Solution -~~~~~~~~~~~~~~~~~~~~~~~ - -There has been talk of instituting a special command: WAIT UNTIL PHYSICS that will sleep until there has been a physics update, and it's a good idea but it hasn't been implemented yet. - -.. |CONFIG:IPU| replace:: :ref:`CONFIG:IPU ` diff --git a/_sources/general/cpu_vessel.txt b/_sources/general/cpu_vessel.txt deleted file mode 100644 index 6e311f0bf..000000000 --- a/_sources/general/cpu_vessel.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _cpu vessel: - -CPU Vessel (SHIP) -================= - -.. note:: - - When kOS documentation refers to the "CPU vessel", it has the following definition: - - - The "CPU Vessel" is whichever vessel happens to currently contain the CPU in which the executing code is running. - -It's important to distinguish this from "active vessel", which is a KSP term referring to whichever vessel the camera is centered on, and therefore the vessel that will receive the keyboard controls for ``W`` ``A`` ``S`` ``D`` and so on. - -The two terms can differ when you are in a situation where there are two vessels near each other, both of them within full physics range (i.e. 2.5 km), such as would happen during a docking operation. In such a situation it is possible for kOS programs to be running on one, both, or neither of the two vessels. The vessel on which a program is executing is not necessarily the vessel the KSP game is currently considering the "active" one. - -.. note:: - - The built-in variable called ``SHIP`` is always set to the current CPU vessel. Whenever you see the documentation refer to CPU vessel, you can think of that as being "the ``SHIP`` variable". - -For all places where a kOS program needs to do something with *this vessel*, for the sake of centering |SHIP-RAW| coordinates, for the sake of deciding which ship is having maneuver nodes added to it and for the sake of deciding which vessel is being controlled by the autopilot. The vessel it is referring to is itself the **CPU vessel** and not necessarily what KSP thinks of as the "active vessel". - -.. |SHIP-RAW| replace:: :ref:`SHIP-RAW ` diff --git a/_sources/general/nametag.txt b/_sources/general/nametag.txt deleted file mode 100644 index 643abb6a6..000000000 --- a/_sources/general/nametag.txt +++ /dev/null @@ -1,93 +0,0 @@ -.. _nametag: - -The Name Tag System -=================== - -One useful thing to do is to be able to give parts on a craft your own chosen names that you can use to get a reference to the parts, utterly bypassing the naming schemes used by KSP, and ignoring the complex part tree system. The Name Tag system was designed to make it possible for you to just give any part on a craft whatever arbitrary name you feel like. - -.. contents:: - :local: - :depth: 1 - -Giving a Part a Name --------------------- - -1. Right click on any part. \*\*You can do this in either the editor - VAB/SPH, - or during flight.\*\* It is more useful to do beforehand when making - the - craft, but you can do it in the midst of a flight, which is useful - for - experimenting and testing. - -2. Click the "change name tag" button. A small text pop-up will appear - with the ability to type a name for the part. Type any value you - like. In the example picture here, the value "the big tank" was typed - in. - -3. From now on this part can be retrieved using either the :PARTSDUBBED - or - the :PARTSTAGGED methods of the vessel, as described - `on the Vessel Page <../../structure/vessel/index.html>`__ - -Cloning with Symmetry ---------------------- - -If you name a part in the editor *first*, and then remove it from the -vessel and place it again with symmetry, all the symmetry copies of the -part will get the same nametag cloned to them. This is not an error. It -is allowed to give the same nametag to more than one part. If you do -this, -it just means that the :PARTSTAGGED or :PARTSDUBBED methods will return -lists containing more than one part. - -If you want each part in a symmetrical group to get a unique nametag, -you -can change their names one at a time after you've placed the parts. - -Where is it saved? ------------------- - -If you add a nametag to a part in the editor (VAB or SPH), then that -nametag will get saved inside the craft file for that vessel design. -All new instances of that craft design that you launch will get the -same nametag configuration on them. - -On the other hand, if you added a nametag to a part after the vessel -was launched, during flight or on the launchpad, then that nametag -will only be attached to that part on *that one instance* of the -vessel. Other copies of the same design won't have the name. In this -case the name is saved inside the saved game's persistence file, but -not in the editor's craft design file. - -Examples of Using the Name --------------------------- - -:: - - // Only if you expected to get - // exactly 1 such part, no more, no less. - SET myPart TO SHIP:PARTSDUBBED("my nametag here")[0]. - - // OR - - // Only if you expected to get - // exactly 1 such part, no more, no less. - SET myPart TO SHIP:PARTSTAGGED("my nametag here")[0]. - - // Handling the case of more than - // one part with the same nametag, - // or the case of zero parts with - // the name: - SET allSuchParts TO SHIP:PARTSDUBBED("my nametag here"). - - // OR - - SET allSuchParts TO SHIP:PARTSTAGGED("my nametag here"). - - // Followed by using the list returned: - FOR onePart IN allSuchParts { - // do something with onePart here. - } - -For more details on how this system works see the :ref:`Parts and PartModules Section `. diff --git a/_sources/general/parts_and_partmodules.txt b/_sources/general/parts_and_partmodules.txt deleted file mode 100644 index a33e37050..000000000 --- a/_sources/general/parts_and_partmodules.txt +++ /dev/null @@ -1,240 +0,0 @@ -.. _parts and partmodules: - -Ship Parts and PartModules -========================== - -As of v0.15, kOS has introduced the ability to access the functionality of Parts' actions, and right-click context menus. However, to understand how to use them it is necessary to first understand a little bit about the structure of parts in a vessel in Kerbal Space Program. - -In Kerbal Space Program, a Vessel is a collection of Parts arranged in a tree Structure. In kOS, you can access the parts one of two ways: - -Tutorial --------- - -If you prefer the tutorial approach to learning, the following links will walk you through a specific pair of tasks to introduce you to this system. If you prefer a methodical reference approach, skip the tutorials and read on, then come back to the tutorials afterward. - -TODO: PUT LINKS POINTING TO A TUTORIAL WALKING THROUGH WHAT THIS IS TEACHING. - -THERE NEEDS TO BE TWO TUTORIALS MINIMUM: - -1. A Tuturial made on an ONLY STOCK (other than kOS of course) install, using only STOCK parts to do something interesting. - -2. A Tutorial more complex showing that this can be used with mods too, probably the Leg Leveller example from the teaser video, but with the code updated to use the newer part query methods. - -Parts ------ - -.. note:: - - **The short and quick thing to remember** - - If you only remember one technique, it should be using the :meth:`Part:PARTSDUBBED` method described down below. It's the most useful one that covers all the other cases. - -Accessing the parts by various naming systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Any time you have a vessel variable, you can use these suffixes to get lists of parts on it by their names using several different naming schemes: - -**Part Tag**: A part's *tag* is whatever custom name you have given it using the `nametag system described here <../nametag/index.html>`__. This is probably the best naming convention to use because it lets you make up whatever name you like for the part and use it to pick the parts you want to deal with in your script. - -**Part Title**: A part's *title* is the name it has inside the GUI interface on the screen that you see as the user. - -**Part Name**: A part's *name* is the name it is given behind the scenes in KSP. It never appears in the normal GUI for the user to see, but it is used in places like Part.cfg files, the saved game persistence file, the ModuleManager mod, and so on. - -Assuming you've done one of these:: - - SET somevessel to SHIP. - // Or this: - SET somevessel to VESSEL("some vessel's name"). - // Or this: - SET somevessel to TARGET. // assuming TARGET is a vessel and not a body or docking port. - -Then you can do one of these to query based on any of the above schemes:: - - // --------- :PARTSTAGGED ----------- - // Finds all parts that have a nametag (Part:Tag suffix) matching the value given: - SET partlist to somevessel:PARTSTAGGED(nametag_of_part) - - // --------- :PARTSTITLED ----------- - // Finds all parts that have a title (Part:Title suffix) matching the value given: - SET partlist to somevessel:PARTSTITLED(title_of_part) - - // --------- :PARTSNAMED ----------- - // Finds all parts that have a name (Part:Name suffix) matching the value given: - SET partlist to somevessel:PARTSNAMED(name_of_part) - - // --------- :PARTSDUBBED ----------- - // Finds all parts matching the string in any naming scheme, without caring what kind of naming scheme it is - // This is essentially the combination of all the above three searches. - SET partlist to somevessel:PARTSDUBBED(any_of_the_above) - -In all cases the checks are performed case-insensitively. - -These are different styles of naming parts, all slightly different, and you can use any of them you like to get access to the part or parts you're interested in. - -They all return a `List <../../structure/list/index.html>`__ of `Parts <../../structure/index.html>`__ rather than just one single part. This is because any name could have more than one hit. If you expect to get just one single hit, you can just look at the zero-th value of the list, like so:: - - SET onePart TO somevessel:PARTSDUBBED("my favorite engine")[0]. - -If the name does not exist, you can tell by seeing if the list returned -has a length of zero:: - - IF somevessel:PARTSDUBBED("my favorite engine"):LENGTH == 0 { - PRINT "There is no part named 'my favorite engine'.". - }. - -Examples:: - - // Change the altitude at which all the drouge chutes will deploy: - FOR somechute IN somevessel:PARTSNAMED("parachuteDrogue") { - somechute:GETMODULE("ModuleParachute"):SETFIELD("DEPLOYALTITUDE", 1500). - }. - -Accessing the parts list as a tree -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Starting from the root part, Vessel:ROOTPART (SHIP:ROOTPART, TARGET:ROOTPART, or Vessel("some ship name"):ROOTPART). You can get all its children parts with the Part:CHILDREN suffix. Given any Part, you can access its Parent part with Part:PARENT, and detect if it doesn't have a parent with Part:HASPARENT. By walking this tree you can see how the parts are connected together. - -The diagram here shows an example of a small vessel and how it might get represented as a tree of parts in KSP. - -Accessing the parts list as a list -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can get a list of all the parts on a vessel using the suffix :PARTS, or by using the LIST PARTS IN command. When you do this, the resulting list is a "flattening" of the tree of parts, created by use of a depth-first search starting from the root part. In the diagram shown here, the red numbers indicate one possible way the parts might be represented in LIST indeces if you used SHIP:PARTS on such a vessel. Note there is no guarantee it would look exactly like this, as it depends on exactly what order the parts were attached in the VAB. - -Shortcuts to smaller lists of parts -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you know some of the properties of the parts you're interested in, you can ask kOS to give you a shorter list of parts that just includes those parts, using the following suffixes: - -Return a List of just the parts who's name is "someNameHere":: - - SET ves TO SHIP. // or Target or Vessel("ship name"). - SET PLIST TO ves:PARTSNAMED("someNameHere"). - -Return a List of just the parts that have had some sort of activity attached to action group 1:: - - SET ves TO SHIP. // or Target or Vessel("ship name"). - SET PLIST TO ves:PARTSINGROUP(AG1). - -PartModules and the right-click menu: -------------------------------------- - -Each Part, in turn has a list of what are called `PartModules <../../structure/partmodule/index.html>`__ on it. A PartModule is a collection of variables and executable program hooks that gives the part some of its behaviors and properties. Without a PartModule, a part is really nothing more than a passive bit of structure that has nothing more than a shape, a look, and a strength to it. Some of the parts in the "structure" tab of the parts bin, like pure I-beams and girders, are like this - they have no PartModules on them. But all of the *interesting* parts you might want to do something with will have a PartModule on them. Through PartModules, \*\*kOS will now allow you to manipulate or query anything that any KSP programmer, stock or mod, has added to the rightclick menu\*\*, or action group actions, for a part. - -PartModules, Stock vs Mods: -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -It should be noted that even if you play an entirely stock installation of KSP (well, stock other than for kOS, obviously, otherwise you wouldn't be reading this), you will still have PartModules on your Parts. Some people have muddied the terminology difference between "Mod" meaning "modification" and "Mod" meaning "module". It should be made absolutely clear that PartModules are a feature of stock KSP, and BOTH stock KSP parts and Modded KSP Parts use them. Even if all you want to do is affect the stock behavior of stock parts in a completely unmodded way, you'll still want to know about PartModules in order to do so. - -PartModules and ModuleManager-like behavior: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some Mods (meaning "modifications" here) operate by adding a new PartModule to every single part in the game. One example of such a mod is the Deadly Reentry mod. In order to track how fragile each part is and how well it withstands re-entry heat, the Deadly Re-entry mod adds a small module to each part in the game, even the stock parts that would normally have no mods at all on them. - -Other Mods allow the user to add PartModule's to any part they feel like, through the use of the ModuleManager mod. - -Because of these, it's impossible in this explanatory document to make blanket statements about which PartModules will exist on which Parts. Everything that is said here needs to be taken with a grain of salt, as depending on the mods you've installed on your game, you may find PartModules on your parts that are not normally on those parts for most other players. - -What a PartModule means to a kOS script ---------------------------------------- - -There are 3 ways that a kOS script may interface with a PartModule. - -TODO - TAKE SOME SCREENSHOTS TO PUT ALONGSIDE THIS TEXT, SHOWING EXAMPLES OF THESE THINGS IN THE USER INTERFACE. WE NEED A SCREENSHOT THAT SHOWS BOTH A KSPFIELD AND A KSPEVENT IN A PART'S RMB CONTEXT MENU, A SCREENSHOT THAT SHOWS FIELDS COMING FROM MULTIPLE PARTMODULES, AND A SCREENSHOT SHOWING THE KSPACTIONS IN THE VAB ACTION EDITOR. - -KSPFields -~~~~~~~~~ - -A KSPField is a single variable that a PartModule attaches to a part. Some of the KSPFields are also displayed in the RMB context menu of a part. It has a current value, and if the field has had a "tweakable" GUI interface attached to it, then it's also a settable field by the user manipulating the field in the context menu. In kOS, you can only access those KSPFields that are currently visible on the RMB context menu. We, the developers of kOS, instituted this rule out of respect for the developers of other mods and the stock KSP game. If they didn't allow the user to see or manipulate the variable directly in the GUI, then we shouldn't allow it to be manipulated or seen by a kOS script either. - -KSPFields are read or manipulated by the following `suffixes of PartModule <../../structure/partmodule/index.html>`__ - -- :GETFIELD("name of field"). - -- :SETFIELD("name of field", new\_value\_for\_field). - -Note, that these are suffixes of the partmodule and NOT suffixes of the Part itself. This is because two different PartModule's on the same Part might have used the same field name as each other, and it's important to keep them separate. - -KSPEvents -~~~~~~~~~ - -A KSPEvent, just like a KSPField, is a thing that a PartModule can put on the RMB context menu for a part. The difference is that a KSPEvent does not actually HAVE a value. It's not a variable. Rather it's just a button with a label next to it. When you press the button, it causes some sort of software inside the PartModule to run. An example of this is the "undock node" button you see on many of the docking ports. - -**Difference between a KSPEvent and a boolean KSPField**: If you see a label next to a button in the RMB context menu, it might be a KSPEvent, OR it might be a boolean KSPField variable which is editable with a tweakable GUI. They look exactly the same in the user interface. To tell the difference, you need to look at what happens when you click the button. If clicking the button causes the button to depress inward and stay pressed in until you click it again, then this is a boolean value KSPField. If clicking the button pops the button in and then it pops out again right away, then this is a KSPEvent instead. - -KSPEvents are manipulated by the following `suffix of PartModule <../../structure/partmodule/index.html>`__ - -- :DOEVENT("name of event"). - -This causes the event to execute once. - -KSPActions: -~~~~~~~~~~~ - -A KSPAction is a bit different from a KSPField or KSPEvent. A KSPAction is like a KSPEvent in that it causes some software inside the PartModule to be run. But it doesn't work via the RMB context menu for the part. Instead KSPAction's are those things you see being made avaiable to you as options you can assign into an Action Group in the VAB or SPH. When you have the action group editor tab enabled in the VAB or SPH, and then click on a part, that part asks all of its PartModules if they have any KSPActions they'd like to provide access to, and gathers all those answers and lists them in the user interface for you to select from and assign to the action group. - -kOS now allows you to access any of those actions without necessarily having had to assign them to any action groups if you didn't want to. - -KSPActions are manipulated by the following `suffix of PartModule <../../structure/partmodule/index.html>`__ - -- :DOACTION("name of action", new\_boolan\_value). - -The name of the action is the name you see in the action group editor interface, and the new boolean value is either True or False. Unlike KSPEvents, a KSPAction has two states, true and false. When you toggle the brakes, for example, they go from on to off, or from off to on. When you call :DOACTION, you are specifying if the KSPAction should behave as if you have just toggled the group on, or just toggled the group off. But instead of actually toggling an action group - you are just telling the single PartModule on a single Part to perform the same behavior it would have performed had that action been assigned to an action group. You don't *actually* have to assign the action to an action group for this to work. - -Exploring what's there to find Field/Event/Action Names: --------------------------------------------------------- - -Okay, so you understand all that, but you're still thinking "but how do I KNOW what the names of part modules are, or what the names of the fields on them are? I didn't write all that C# source code for all the modules." - -There are some additional suffixes that are designed to help you explore what's available so you can learn the answers to these questions. Also, some of the questions can be answered by other means: - -What PartModules are there on a part? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To answer this question you can do one of two things: - -A: **Use the part.cfg file** All parts in KSP come with a part.cfg file defining them, both for modded parts and stock parts. If you look at this file, it will contain sections looking something like this:: - - // Example snippet from a Part.cfg file: - MODULE - { - name = ModuleCommand - -That would tell you that this part has a PartModule on it called ModuleCommand. there can be multiple such modules per part. But it doesn't let you know about PartModules that get added afterward during runtime, by such things as the ModuleManager mod. - -B: **Use the :MODULES suffix of Part:** If you have a handle on any part in kOS, you can print out the value of :MODULES and it will tell you the string names of all the modules on the part. For example:: - - FOR P IN SHIP:PARTS { - LOG ("MODULES FOR PART NAMED " + P:NAME) TO MODLIST. - LOG P:MODULES TO MODLIST. - }. - -Do that, and the file MODLIST should now contain a verbose dump of all the module names of all the parts on your ship. You can get any of the modules now by using Part:GETMODULE("module name"). - -What are the names of the stuff that a PartModule can do? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -These three suffixes tell you everything a part module can do:: - - SET MOD TO P:GETMODULE("some name here"). - LOG ("These are all the things that I can currently USE GETFIELD AND SETFIELD ON IN " + MOD:NAME + ":") TO NAMELIST. - LOG MOD:ALLFIELDS TO NAMELIST. - LOG ("These are all the things that I can currently USE DOEVENT ON IN " + MOD:NAME + ":") TO NAMELIST. - LOG MOD:ALLEVENTS TO NAMELIST. - LOG ("These are all the things that I can currently USE DOACTION ON IN " + MOD:NAME + ":") TO NAMELIST. - LOG MOD:ALLACTIONS TO NAMELIST. - -After that, the file NAMELIST would contain a dump of all the fields on this part module that you can use. - -BE WARNED! Names are able to dynamically change! -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some PartModules are written to change the name of a field when something happens in the game. For example, you might find that after you've done this:: - - SomeModule:DOEVENT("Activate"). - -That this doesn't work anymore after that, and the "Activate" event now causes an error. - -And the reason is that the PartModule chose to change the label on the event. It changed to the word "Deactivate" now. kOS can no longer trigger an event called "Activate" because that's no longer its name. - -Be on the lookout for cases like this. Experiment with how the context menu is being manipulated and keep in mind that the list of strings you got the last time you exectued :ALLFIELDS a few minutes ago might not be the same list you'd get if you ran it now, because the PartModule has changed what is being shown on the menu. diff --git a/_sources/general/volumes.txt b/_sources/general/volumes.txt deleted file mode 100644 index e7b3ed7c7..000000000 --- a/_sources/general/volumes.txt +++ /dev/null @@ -1,143 +0,0 @@ -.. _volumes: - - -Files and Volumes -================= - -Using the COPY, SWITCH, DELETE, and RENAME commands, you can manipulate the archive and the volumes as described in the :ref:`File I/O page `. But before you do that, it's useful to know how kOS manages the archive and the volumes, and what they mean. - -.. contents:: - :local: - :depth: 2 - -.. warning:: - - .. versionchanged:: 0.15 - - **Archive location and file extension change** - - The Archive where KerboScript files are kept has been changed from ``Plugins/PluginData/Archive`` to ``Ships/Script``, but still under the top-level **KSP** installation directory. The file name extensions have also changes from ``.txt`` to ``.ks``. - -Script Files ------------- - -There is one file per program. You can use the words "file" and "program" interchangeably in your thinking for the most part. Files are stored in volumes and there can be more than one file in a volume provided there's enough room. Volumes have small storage and there's no way to span a file across two volumes, so the limit to the size of a volume is also effectively a limit to the size of a program. - -File Storage Behind the Scenes ------------------------------- - -In the Archive: - -- If a file is stored on the volume called "Archive" (or volume number - zero to put it another way), then behind the scenes it's really - stored as an actual file, with the extension ``.ks``, on your - computer (As of right now it's located in ``Ships/Script`` but that - location is likely to change to somewhere in GameData in a future - version.) Each program is a simple text file you can edit with any - text editor, and your edits will be seen immediately by KOS the next - time it tries running that program from the archive volume. - -- Historical note: older versions of kOS (0.14 and earlier) used the - directory ``Plugins/PluginData/Archive`` for the archive. - -In any other volume besides Archive: - -- If a file is stored on any volume other than archive, then behind the - scenes it's stored actually inside the saved game's persistence file - in the section for the KOS part on the vessel. - What's a Volume - -A Volume is a small unit of disk storage that contains a single hard -drive with very limited storage capacity. It can store more than one -program on it. To simulate the sense that this game takes place at the -dawn of the space race with 1960's and 1970's technology, the storage -capacity of a volume is very limited. It can only store 10,000 bytes of -program text - less than 10 Kb The byte count of a program is just the -count of the characters in the source code text. Writing programs with -short cryptic variable names instead of long descriptive ones does save -space. This is old school programming, where squeezing every byte out -matters. - -Multiple Volumes on One Vessel ------------------------------- - -Each kOS CX-4181 Scriptable Control System part contains '''one''' such -volume inside it. Therefore to send a craft into space with more storage -capacity than 10,000 bytes requires putting multiple CX-4181 Scriptable -Control System parts on the craft. - -If you have multiple CX-4181 parts on the same craft, they are assumed -to be networked together on the same system, and capable of reading each -other's hard drives. Their disk drives each have a different Volume, and -by default they are simply numbered 1,2,3, … unless you rename them with -the RENAME command. - -For example, if you have two CX-4181's on the same craft, called 1 and -2, with volumes on them called 1 and 2, respectively, it is possible for -CPU 1 to run code stored on volume 2 by just having CPU number 1 issue -the command ''SWITCH TO 2.'' - -Naming Volumes --------------- - -It's important to note that if you have multiple volumes on the same -vessel, the numbering conventions for the volumes will differ on -different CPUs. The same volume which was called '2' when one CPU was -looking at it might instead be called '1' when a different CPU is -looking at it. Each CPU thinks of its OWN volume as number '1'. - -Therefore using the RENAME command on the volumes is useful when dealing -with multiple CX-4181's on the same vessel, so they all will refer to -the volumes using the same names. - -Archive -------- - -The "archive" is a special volume that behaves much like any other -volume but with the following exceptions: - -- It is globally the same even across save games. -- The archive represents the large bank of disk storage back at mission - control's mainframe, rather than the storage on an indivdual craft. - While "Volume 1" on one vessel might be a different disk than "Volume - 1" on another vessel, there is only volume called "archive" in the - entire solar system. Also, there's only one "archive" across all - saved universes. If you play a new campaign from scratch, your - archive in that new game will still have all the files in it from - your previous saved game. This is because behid the scenes it's - stored in the plugin's directory, not the save game directory. -- It is infinitely large. -- Unlike the other volumes, the archive volume does not have a byte - limit. This is because the mainframe back at home base can store a - lot more than the special drives sent on the vessels - so much so - that it may as well be infinite by comparison. -- Files saved there do not revert when you "revert flight". -- When you revert a flight, you are going back to a previous saved - state of the game, and therefore any disk data on the vessels - themselves also reverts to what it was at the time of the saved game. - Because the archive is saved outside the normal game save, changes - made there are retained even when reverting a flight. -- It's not always reachable if you are out in space, unless you have - antennae. -- Once a vessel is more than 100,000 meters away from mission control, - by default it cannot access the files on the archive. Commands such - as SWITCH TO , and COPY FROM will fail to work when trying to access - the archive volume while out of range. This can be changed by putting - antennae on the vessel. With enough - `antennae `__ it becomes possible - to reach the archive drive from farther away. Using this method it is - possible to alter the software stored on a vessel after launch. -- Files in Archive are editable with a text editor directly and they - will have the ``.ks`` extension. -- Files in the Archive are stored on your computer in the subdirectory: - ``Ships/Script``. You can pull them up in a text editor of your - choice and edit them directly, and the KOS Mod will see those changes - in its archive immediately. Files stored in other volumes, on the - other hand, are stored inside the vessel's data in the persistence - file of the saved game and are quite a bit bit harder to edit there. - Editing the files in the Archive directory is allowed and in fact is - an officially accepted way to use the plugin. Editing the section in - a persistence file, on the other hand, is a bad idea and probably - constitutes a form of cheating similar to any other edit of the - persistence file. - diff --git a/_sources/index.txt b/_sources/index.txt deleted file mode 100644 index aee7c51b9..000000000 --- a/_sources/index.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _index: - -Welcome to the **kOS** Documentation Website! -============================================= - -**kOS** is a scriptable autopilot modification for **Kerbal Space Program**. It allows you write small programs that automate specific tasks. - -.. toctree:: - :includehidden: - :titlesonly: - :maxdepth: 5 - - Home - Tutorials - General - Language - Mathematics - Commands - Structures - Contribute - About - -Introduction to **kOS** and **KerboScript** -=========================================== - -**KerboScript** is the language used to program the CPU device attached to your vessel and **kOS** is the operating system that interprets the code you write. The program can be as simple as printing the current altitude of the vessel and as complicated as a six-axis autopilot controller taking your vessel from the launchpad to Duna and back! With **kOS**, the sky is *not* the limit. - -This mod *is* compatible with `RemoteTech`_, you just have to make sure you copy the program onto the local CPU before it goes out of range of KSC. - -Installation ------------- - -Like other mods, simply merge the contents of the zip file into your -Kerbal Space Program folder. - -KerboScript ------------ - -**KerboScript** is a programming language that is derived from the language of planet Kerbin, which *sounds* like gibberish to non-native speakers but for some reason is *written* exactly like English. As a result, **KerboScript** is very English-like in its syntax. For example, it uses periods as statement terminators. - -The language is designed to be easily accessible to novice programmers, therefore it is case-insensitive, and types are cast automatically whenever possible. - -A typical command in **KerboScript** might look like this: - -:: - - PRINT "Hello World". - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - -.. _RemoteTech: https://kerbalstuff.com/mod/134/RemoteTech diff --git a/_sources/language.txt b/_sources/language.txt deleted file mode 100644 index 2bc7eeeb3..000000000 --- a/_sources/language.txt +++ /dev/null @@ -1,12 +0,0 @@ -.. _language: - -The **KerboScript** Language -============================ - -.. toctree:: - :maxdepth: 2 - - General Features - Language Syntax - Flow Control - Variables diff --git a/_sources/language/features.txt b/_sources/language/features.txt deleted file mode 100644 index 806c63b6f..000000000 --- a/_sources/language/features.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _features: - -General Features of the **KerboScript** Language -================================================ - -.. contents:: - :local: - :depth: 2 - -Case Insensitivity ------------------- - -Everything in **KerboScript** is case-insensitive, including your own variable names and filenames. The only exception is when you perform a string comparison, (``"Hello"="HELLO"`` will return false.) - -Most of the examples here will show the syntax in all-uppercase to help make it stand out from the explanatory text. - -Expressions ------------ - -KerboScript uses an expression evaluation system that allows you to perform math operations on variables. Some variables are defined by you. Others are defined by the system. There are four basic types: - -1. Numbers -~~~~~~~~~~ - -You can use mathematical operations on numbers, like this:: - - SET X TO 4 + 2.5. - PRINT X. // Outputs 6.5 - -The system follows the order of operations, but currently the implementation is imperfect. For example, multiplication will always be performed before division, regardless of the order they come in. This will be fixed in a future release. - -2. Strings -~~~~~~~~~~ - -Strings are pieces of text that are generally meant to be printed to the screen. For example:: - - PRINT "Hello World!". - -To concatenate strings, you can use the + operator. This works with mixtures of numbers and strings as well:: - - PRINT "4 plus 3 is: " + (4+3). - -.. _features structures: - -3. Structures -~~~~~~~~~~~~~ - -Structures are variables that contain more than one piece of information. For example, a Vector has an X, a Y, and a Z component. Structures can be used with SET.. TO just like any other variable. To access the sub-elements of a structure, you use the colon operator (":"). Here are some examples:: - - PRINT "The Mun's periapsis altitude is: " + MUN:PERIAPSIS. - PRINT "The ship's surface velocity is: " + SHIP:VELOCITY:SURFACE. - -Many structures also let you set a specific component of them, for example:: - - SET VEC TO V(10,10,10). // A vector with x,y,z components - // all set to 10. - SET VEC:X to VEC:X * 4. // multiply just the X part of VEC by 4. - PRINT VEC. // Results in V(40,10,10). - -.. _features methods: - -4. Structure Methods -~~~~~~~~~~~~~~~~~~~~ - -Structures also often contain methods. A method is a suffix of a structure that actually performs an activity when you mention it, and can sometimes take parameters. The following are examples of calling methods of a structure:: - - SET PLIST TO SHIP:PARTSDUBBED("my engines"). // calling a suffix - // method with one - // argument that - // returns a list. - PLIST:REMOVE(0). // calling a suffix method with one argument that - // doesn't return anything. - PRINT PLIST:SUBLIST(0,4). // calling a suffix method with 2 - // arguments that returns a list. - -.. note:: - .. versionadded:: 0.15 - Methods now perform the activity when the interpreter comes up to it. Prior to this version, execution was sometimes delayed until some later time depending on the trigger setup or flow-control. - -For more information, see the :ref:`Structures Section `. A full list of structure types can be found on the :doc:`Structures ` page. For a more detailed breakdown of the language, see the :doc:`Language Syntax Constructs ` page. - -.. _language structures: - -Structures ----------- - -Structures, :ref:`introduced above `, are variable *types* that contain more than one piece of information. All structures contain sub-values or :ref:`methods ` that can be accessed with a colon (``:``) operator. Multiple structures can be chained together with more than one colon (``:``) operator:: - - SET myCraft TO SHIP. - SET myMass TO myCraft:MASS. - SET myVel TO myCraft:VELOCITY:ORBIT. - -These terms are referred to as "suffixes". For example ``Velocity`` is a suffix of ``Vessel``. It is possible to **set** some suffixes as well. The second line in the following example sets the ``ETA`` of a ``NODE`` 500 seconds into the future:: - - SET n TO Node( TIME:SECONDS + 60, 0, 10, 10). - SET n:ETA to 500. - -The full list of available suffixes for each type :ref:`can be found here `. diff --git a/_sources/language/flow.txt b/_sources/language/flow.txt deleted file mode 100644 index 6743c3487..000000000 --- a/_sources/language/flow.txt +++ /dev/null @@ -1,281 +0,0 @@ -.. _flow: - -Flow Control -============ - -.. contents:: - :local: - :depth: 1 - -.. index:: BREAK -.. _break: - -``BREAK`` ---------- - -Breaks out of a loop:: - - SET X TO 1. - UNTIL 0 { - SET X TO X + 1. - IF X > 10 { BREAK. } // Exits the loop when - // X is greater than 10 - } - -.. index:: IF -.. _if: - -``IF`` / ``ELSE`` ------------------ - -Checks if the expression supplied returns true. If it does, ``IF`` executes the following command block. Can also have an optional ``ELSE`` to execute when the ``IF`` condition is not true. ``ELSE`` can have another ``IF`` after it, to make a chain of ``IF``/``ELSE`` conditions:: - - SET X TO 1. - IF X = 1 { PRINT "X equals one.". } // Prints "X equals one." - IF X > 10 { PRINT "X is greater than ten.". } // Does nothing - - // IF-ELSE structure: - IF X > 10 { PRINT "X is large". } ELSE { PRINT "X is small". } - - // An if-else ladder: - IF X = 0 { - PRINT "zero". - } ELSE IF X < 0 { - PRINT "negative". - } ELSE { - PRINT "positive". - } - -.. note:: - The period (``.``) is optional after the end of a set of curly braces like so:: - - // both of these lines are fine - IF TRUE { PRINT "Hello". } - IF TRUE { PRINT "Hello". }. - - In the case where you are using the ``ELSE`` keyword, you must *not* end the previous ``IF`` body with a period, as that terminates the ``IF`` command and causes the ``ELSE`` keyword to be without a matching ``IF``:: - - // works: - IF X > 10 { PRINT "Large". } ELSE { PRINT "Small". }. - - // syntax error - ELSE without IF. - IF X > 10 { PRINT "Large". }. ELSE { PRINT "Small". }. - -.. index:: LOCK -.. _lock: - -``LOCK`` --------- - -Locks an identifier to an expression. Each time the identifier is used in an expression, its value will be re-calculated on the fly:: - - SET X TO 1. - LOCK Y TO X + 2. - PRINT Y. // Outputs 3 - SET X TO 4. - PRINT Y. // Outputs 6 - -Unlike variables created with the ``SET`` or ``DECLARE`` commands, ``LOCK`` variables are local to the current program. If program **A** calls program **B**, and program **B** issues a ``LOCK`` command, program **A** will not be able to read that ``LOCK`` variable's result. - -.. note:: - If a ``LOCK`` expression is used with a flight control such as ``THROTTLE`` or ``STEERING``, then it will get continually evaluated in the background :ref:`each update tick `. - -.. index:: UNLOCK -.. _unlock: - -``UNLOCK`` ----------- - -Releases a lock on a variable. See ``LOCK``:: - - UNLOCK X. // Releases a lock on variable X - UNLOCK ALL. // Releases ALL locks - -.. index:: UNTIL -.. _until: - -``UNTIL`` ---------- - -Performs a loop until a certain condition is met:: - - SET X to 1. - UNTIL X > 10 { // Prints the numbers 1-10 - PRINT X. - SET X to X + 1. - } - -Note that if you are creating a loop in which you are watching a physical value that you expect to change each iteration, it's vital that you insert a small WAIT at the bottom of the loop like so:: - - SET PREV_TIME to TIME:SECONDS. - SET PREV_VEL to SHIP:VELOCITY. - SET ACCEL to V(9999,9999,9999). - PRINT "Waiting for accellerations to stop.". - UNTIL ACCEL:MAG < 0.5 { - SET ACCEL TO (SHIP:VELOCITY - PREV_VEL) / (TIME:SECONDS - PREV_TIME). - SET PREV_TIME to TIME:SECONDS. - SET PREV_VEL to SHIP:VELOCITY. - - WAIT 0.001. // This line is Vitally Important. - } - -The full explanation why is :ref:`in the CPU hardware description -page `. - -.. index:: FOR -.. _for: - -``FOR`` -------- - -Loops over a list collection, letting you access one element at a time. Syntax:: - - FOR variable1 IN variable2 { use variable1 here. } - -Where: - -- `variable1` is a variable to hold each element one at a time. -- `varaible2` is a LIST variable to iterate over. - -Example:: - - PRINT "Counting flamed out engines:". - SET numOUT to 0. - LIST ENGINES IN MyList. - FOR eng IN MyList { - IF ENG:FLAMEOUT { - set numOUT to numOUT + 1. - } - } - PRINT "There are " + numOut + "Flamed out engines.". - -.. index:: WAIT -.. _wait: - -``WAIT`` --------- - -Halts execution for a specified amount of time, or until a specific set of criteria are met. Note that running a ``WAIT UNTIL`` statement can hang the machine forever if the criteria are never met. Examples:: - - WAIT 6.2. // Wait 6.2 seconds - WAIT UNTIL X > 40. // Wait until X is greater than 40 - WAIT UNTIL APOAPSIS > 150000. // You can see where this is going - -Note that any ``WAIT`` statement, no matter what the actual expression is, will always result in a wait time that lasts at least :ref:`one physics tick `. - -.. index:: WHEN -.. _when: - -``WHEN`` / ``THEN`` -------------------- - -Executes a command when a certain criteria are met. Unlike ``WAIT``, ``WHEN`` -does not halt execution. It starts a check in the background that will keep actively looking for the trigger condition while the rest of the code continues. When it triggers, the body after the ``THEN`` will execute exactly once, after which the trigger is removed unless the ``PRESERVE`` is used, in which case the trigger is not removed. - -The body of a ``THEN`` or an ``ON`` statement interrupts the normal flow of a **kOS** program. When the event that triggers the body happens, the main **kOS** program is paused until the body of the ``THEN`` completes. - -.. warning:: - Do not make the body of a ``WHEN``/``THEN`` take a long time to execute. If you attempt to run code that lasts too long in the body of your ``WHEN``/``THEN`` statement, :ref:`it will cause an error `. Avoid looping during ``WHEN``/``THEN`` if you can. For details on how to deal with this, see the :ref:`tutorial on design patterns `. - -.. note:: - .. versionchanged:: 0.12 - **IMPORTANT BREAKING CHANGE:** In previous versions of **kOS**, the body of a ``WHEN``/``THEN`` would execute simultaneously in the background with the rest of the main program. This behavior has changed as of version *0.12* of **kOS**, as described above, and scripts that used to rely on this behavior will not work with version *0.12* of **kOS** - -Example:: - - WHEN BCount < 99 THEN PRINT BCount + " bottles of beer on the wall”. - - // Watch in the background for when the altitude is high enough. - // Once it is, then turn on the solar panels and action group 1 - WHEN altitude > 70000 THEN { - PRINT "ACTIVATING PANELS AND AG 1.". - PANELS ON. - AG1 ON. - } - -A ``WHEN``/``THEN`` trigger is removed when the program that created it exits, even if it has not occurred yet. The ``PRESERVE`` can be used inside the ``THEN`` clause of a ``WHEN`` statement. If you are going to make extensive use of ``WHEN``/``THEN`` triggers, it's important to understand more details of how they :ref:`work in the kOS CPU `. - -.. index:: ON -.. _on: - -``ON`` ------- - -The ``ON`` command is almost identical to the ``WHEN``/``THEN`` command. ``ON`` sets up a trigger in the background that will run the selected command exactly once when the boolean variable changes state from true to false or from false to true. This command is best used to listen for action group activations. - -Just like with the ``WHEN``/``THEN`` command, the ``PRESERVE`` command can be used inside the code block to cause the trigger to remain active and not go away. - -How does it differ from ``WHEN``/``THEN``? The ``WHEN``/``THEN`` triggers are executed whenever the conditional expression *becomes true*. ``ON`` triggers are executed whenever the boolean variable *changes state* either from false to true or from true to false. - -The body of an ``ON`` statement can be a list of commands inside curly braces, just like for ``WHEN``/``THEN``. Also just like with ``WHEN``/``THEN``, the body of the ``ON`` interrupts all of **KSP** while it runs, so it should be designed to be a short and finish quickly without getting stuck in a long loop:: - - ON AG3 { - PRINT "Action Group 3 Activated!”. - } - ON SAS PRINT "SAS system has been toggled”. - ON AG1 { - PRINT "Action Group 1 activated.". - PRESERVE. - } - -.. warning:: - DO NOT make the body of an ``ON`` statement take a long time to execute. If you attempt to run code that lasts too long in the body of your ``ON`` statement, :ref:`it will cause an error `. For general help on how to deal with this, see the :ref:`tutorial on design patterns `. - -Avoid looping during ``ON`` code blocks if you can. If you are going to make extensive use of ``ON`` triggers, it's important to understand more details of how they :ref:`work in the kOS CPU `. - -.. index:: PRESERVE -.. _preserve: - -``PRESERVE`` ------------- - -``PRESERVE`` is a command keyword that is only valid inside of ``WHEN``/``THEN`` and ``ON`` code blocks. - -When a ``WHEN``/``THEN`` or ``ON`` condition is triggered, the default behavior is to execute the code block body exactly once and only once, and then the trigger condition is removed and the trigger will never occur again. - -To alter this, execute the ``PRESERVE`` command anywhere within the body of the code being executed and it tells the **kOS** computer to keep the trigger condition active. When it finishes executing the code block of the trigger, if ``PRESERVE`` has happened anywhere within that run of the block of code, it will not remove the trigger. Instead it will allow it to re-trigger, possibly as soon as the very next tick. If the ``PRESERVE`` keyword is executed again and again each time the trigger occurs, the trigger could remain active indefinitely. - -The following example sets up a continuous background check to keep looking for if there's no fuel in the current stage, and if there is, then it activates the next stage, but no more often than once every half second. Once more than ``NUMSTAGES`` have happened, it allows the check to stop executing but it keeps the check alive until that happens:: - - SET NUMSTAGES TO 5. - SET COOLDOWN_START TO 0. - - WHEN (TIME:SECONDS > COOLDOWN_START + 0.5) AND STAGE:LIQUIDFUEL = 0 { - SET COOLDOWN_START TO TIME:SECONDS. - STAGE. - SET NUMSTAGES TO NUMSTAGES - 1. - IF NUMSTAGES > 0 { - PRESERVE. - } - } - - // Continue to the rest of the code - -.. index:: Boolean Operators -.. _booleans: - -Boolean Operators ------------------ - -All conditional statements, like ``IF``, can make use of boolean operators. The order of operations is as follows: - -- ``=`` ``<`` ``>`` ``<=`` ``>=`` ``<>`` -- ``AND`` -- ``OR`` -- ``NOT`` - -Boolean is a type that can be stored in a variable and used that way as well. The constants ``True`` and ``False`` (case insensitive) may be used as values for boolean variables. If a number is used as if it was a Boolean variable, it will be interpreted in the standard way (zero means false, anything else means true):: - - IF X = 1 AND Y > 4 { PRINT "Both conditions are true". } - IF X = 1 OR Y > 4 { PRINT "At least one condition is true". } - IF NOT (X = 1 or Y > 4) { PRINT "Neither condition is true". } - IF X <> 1 { PRINT "X is not 1". } - SET MYCHECK TO NOT (X = 1 or Y > 4). - IF MYCHECK { PRINT "mycheck is true." } - LOCK CONTINUOUSCHECK TO X < 0. - WHEN CONTINUOUSCHECK THEN { PRINT "X has just become negative.". } - IF True { PRINT "This statement happens unconditionally." } - IF False { PRINT "This statement never happens." } - IF 1 { PRINT "This statement happens unconditionally." } - IF 0 { PRINT "This statement never happens." } - IF count { PRINT "count isn't zero.". } diff --git a/_sources/language/syntax.txt b/_sources/language/syntax.txt deleted file mode 100644 index 23db72afa..000000000 --- a/_sources/language/syntax.txt +++ /dev/null @@ -1,122 +0,0 @@ -.. _syntax: - -**KerboScript** Syntax Specification -==================================== - -This describes what is and is not a syntax error in the **KerboScript** programming language. It does not describe what function calls exist or which commands and built-in variables are present. Those are contained in other documents. - -.. contents:: Contents - :local: - :depth: 2 - -General Rules -------------- - -*Whitespace* consisting of consecutive spaces, tabs, and line breaks are all considered identical to each other. Because of this, indentation is up to you. You may indent however you like. - -.. note:: - - Statements are ended with a **period** character ("."). - -The following are **reserved command keywords** and special -operator symbols: - -**Arithmetic Operators**:: - - + - * / ^ e ( ) - -**Logic Operators**:: - - not and or true false <> >= <= = > < - -**Instructions and keywords**:: - - set to if else until lock unlock print at on toggle - wait when then off stage clearscreen add remove log - break preserve declare parameter switch copy from rename - volume file delete edit run compile list reboot shutdown - for unset batch deploy in all - -**Other symbols**:: - - { } [ ] , : // - -*Comments* consist of everything from a "//" symbol to the end of the line:: - - set x to 1. // this is a comment. - -**Identifiers**: Identifiers consist of: a string of (letter, digit, or -underscore). The first character must be a letter. The rest may be letters, digits or underscores. **Identifiers are case-insensitive**. The following are identical identifiers:: - - My_Variable my_varible MY_VARAIBLE - -**case-insensitivity** - The same case-insensitivity applies throughout the entire language, with all keywords except when comparing literal strings. The values inside the strings are still case-sensitive, for example, the following will print "unequal":: - - if "hello" = "HELLO" { - print "equal". - } else { - print "unequal". - } - -**Suffixes** - Some variable types are structures that contain sub-portions. The separator between the main variable and the item inside it is a colon character (``:``). When this symbol is used, the part on the right-hand side of the colon is called the "suffix":: - - list parts in mylist. - print mylist:length. // length is a suffix of mylist - -Suffixes can be chained together, as in this example:: - - print ship:velocity:orbit:x. - -In the above example you'd say "``velocity`` is a suffix of ``ship``", and "``orbit`` is a suffix of ``ship:velocity``", and "``x`` is a suffix of ``ship:velocity:orbit``". - -Functions ---------- - -There exist a number of built-in functions you can call using their names. When you do so, you can do it like so:: - - functionName( *arguments with commas between them* ). - -For example, the ``ROUND`` function takes 2 arguments:: - - print ROUND(1230.12312, 2). - -The ``SIN`` function takes 1 argument:: - - print SIN(45). - -When a function requires zero arguments, it is legal to call it using the parentheses or not using them. You can pick either way:: - - // These both work: - CLEARSCREEN. - CLEARSCREEN(). - -Suffixes as Functions (Methods) -------------------------------- - -Some suffixes are actually functions you can call. When that is the case, these suffixes are called "method suffixes". Here are some examples:: - - set x to ship:partsnamed("rtg"). - print x:length(). - x:remove(0). - x:clear(). - -Built-In Special Variable Names -------------------------------- - -Some variable names have special meaning and will not work as identifiers. Understanding this list is crucial to using kOS effectively, as these special variables are the usual way to query flight state information. :ref:`The full list of reserved variable names is on its own page `. - -What does not exist (yet?) --------------------------- - -Concepts that many other languages have, that are missing from **KerboScript**, are listed below. Many of these are things that could be supported some day, but at the moment with the limited amount of developer time available they haven't become essential enough to spend the time on supporting them. - -**user-made functions** - There are built-in functions you can call, but you can't make your own in the script. The closest you can come to this is to make a separate script file and you can ``RUN`` the script file from another script file. - -**local variables** - All variables are in the same global namespace. You can't make local variables. If homemade functions are ever supported, that is when local variables would become useful. - -**user-made structures or classes** - Several of the built-in variables of **kOS** are essentially "classes" with methods and fields, however there's currently no way for user code to create its own classes or structures. Supporting this would open up a *large* can of worms, as it would then make the **kOS** system more complex. diff --git a/_sources/language/variables.txt b/_sources/language/variables.txt deleted file mode 100644 index 0035a5508..000000000 --- a/_sources/language/variables.txt +++ /dev/null @@ -1,110 +0,0 @@ -.. _variables: - -Variables & Statements -====================== - -.. contents:: - :local: - :depth: 1 - -.. _declare: -``DECLARE`` ------------ - -Declares a global variable. Alternatively, a variable can be implicitly declared by any ``SET`` or ``LOCK`` statement:: - - DECLARE X. - -.. _declare parameter: -``DECLARE PARAMETER`` ---------------------- - -Declares variables to be used as a parameter that can be passed in using the ``RUN`` command. - -Program 1:: - - // This is the contents of program1: - DECLARE PARAMETER X. - DECLARE PARAMETER Y. - PRINT "X times Y is " + X*Y. - -Program 2:: - - // This is the contents of program2, which calls program1: - SET A TO 7. - RUN PROGRAM1( A, A+1 ). - -The above example would give the output:: - - X times Y is 56. - -It is also possible to put more than one parameter into a single ``DECLARE PARAMETER`` statement, separated by commas, as shown below:: - - DECLARE PARAMETER X, Y, CheckFlag. - -This is exactly equivalent to:: - - DECLARE PARAMETER X. - DECLARE PARAMETER Y. - DECLARE PARAMETER CheckFlag. - -Note: Unlike normal variables, Parameter variables are local to the program. When program A calls program B and passes parameters to it, program B can alter their values without affecting the values of the variables in program A. - -Caveat - This is only true if the values are primitive singleton values like numbers or booleans. If the values are Structures like Vectors or Lists, then they do end up behaving as if they were passed by reference, in the usual way that should be familiar to people who have used languages like Java or C# before. - -The ``DECLARE PARAMETER`` statements can appear anywhere in a program as long as they are in the file at a point earlier than the point at which the parameter is being used. The order the arguments need to be passed in by the caller is the order the ``DECLARE PARAMETER`` statements appear in the program being called. - -.. note:: - - **Pass By Value** - - The following paragraph is important for people familiar with other programming languages. If you are new to programming and don't understand what it is saying, that's okay you can ignore it. - - At the moment the only kind of parameter supported is a pass-by-value parameter, and pass-by reference parameters don't exist. Be aware, however, that due to the way kOS is implemented on top of a reference-using object-oriented language (CSharp), if you pass an argument which is a complex aggregate structure (i.e. a Vector, or a List - anything that kOS lets you use a colon suffix with), then the parameters will behave exactly like being passed by reference because all you're passing is the handle to the object rather than the object itself. This should be familiar behavior to anyone who has written software in Java or C# before. - -.. _set: -``SET`` -------- - -Sets the value of a variable. Declares a global variable if it doesn’t already exist:: - - SET X TO 1. - -.. _lock: -``LOCK`` --------- - -Declares that the idenifier will refer to an expression that is always re-evaluated on the fly every time it is used:: - - SET Y TO 1. - LOCK X TO Y + 1. - PRINT X. // prints "2" - SET Y TO 2. - PRINT X. // prints "3" - -.. _toggle: -``TOGGLE`` ----------- - -Toggles a variable between ``TRUE`` or ``FALSE``. If the variable in question starts out as a number, it will be converted to a boolean and then toggled. This is useful for setting action groups, which are activated whenever their values are inverted:: - - TOGGLE AG1. // Fires action group 1. - TOGGLE SAS. // Toggles SAS on or off. - -.. _on: -``ON`` ------- - -Sets a variable to ``TRUE``. This is useful for the ``RCS`` and ``SAS`` bindings:: - - RCS ON. // Turns on the RCS - -.. _off: -``OFF`` -------- - -Sets a variable to ``FALSE``. This is useful for the ``RCS`` and ``SAS`` bindings:: - - RCS OFF. // Turns off the RCS - diff --git a/_sources/math.txt b/_sources/math.txt deleted file mode 100644 index cba3e7c89..000000000 --- a/_sources/math.txt +++ /dev/null @@ -1,13 +0,0 @@ -.. _math: - -Mathematics and Basic Geometry -============================== - -.. toctree:: - :maxdepth: 2 - - math/basic - math/vector - math/direction - math/geocoordinates - math/ref_frame diff --git a/_sources/math/basic.txt b/_sources/math/basic.txt deleted file mode 100644 index 7e654471d..000000000 --- a/_sources/math/basic.txt +++ /dev/null @@ -1,216 +0,0 @@ -.. _math: - -.. _constants: -.. index:: Fundamental Constants - -Fundamental Constants -===================== - -A few fundamental constants can be obtained by using the expression ``CONSTANT()`` followed by a colon (``:``) followed by one of the following: - -.. list-table:: - :header-rows: 1 - :widths: 1 4 - - * - Identifier - - Description - - * - :global:`G` - - Newton's Gravitational Constant - * - :global:`E` - - Natural Log - * - :global:`PI` - - :math:`π` - - -.. global:: Constant():G - - Newton's Gravitational Constant, 6.67384E-11:: - - PRINT "Gravitational parameter of Kerbin is:". - PRINT constant():G * Kerbin:Mass. - -.. global:: Constant():E - - Natural Log base "e":: - - PRINT "e^2 is:". - PRINT constant():e ^ 2. - -.. global:: Constant():PI - - Ratio of circumference of a circle to its diameter - -.. _math functions: -.. index:: Mathematical Functions - -Mathematical Functions -====================== - -==================== =================================================== - Function Description -==================== =================================================== - :func:`ABS(a)` absolute value - :func:`CEILING(a)` round up - :func:`FLOOR(a)` round down - :func:`LN(a)` natural log - :func:`LOG10(a)` log base 10 - :func:`MOD(a,b)` modulus - :func:`MIN(a,b)` minimum - :func:`MAX(a,b)` maximum - :func:`ROUND(a)` round to whole number - :func:`ROUND(a,b)` round to nearest place - :func:`SQRT(a)` square root -==================== =================================================== - -.. function:: ABS(a) - - Returns absolute value of input:: - - PRINT ABS(-1). // prints 1 - -.. function:: CEILING(a) - - Rounds up to the nearest whole number:: - - PRINT CEILING(1.887). // prints 2 - -.. function:: FLOOR(a) - - Rounds down to the nearest whole number:: - - PRINT FLOOR(1.887). // prints 1 - -.. function:: LN(a) - - Gives the natural log of the provided number:: - - PRINT LN(2). // prints 0.6931471805599453 - -.. function:: LOG10(a) - - Gives the log base 10 of the provided number:: - - PRINT LOG10(2). // prints 0.30102999566398114 - -.. function:: MOD(a,b) - - Returns remainder from integer division:: - - PRINT MOD(21,6). // prints 3 - -.. function:: MIN(a,b) - - Returns The lower of the two values:: - - PRINT MIN(0,100). // prints 0 - -.. function:: MAX(a,b) - - Returns The higher of the two values:: - - PRINT MAX(0,100). // prints 100 - -.. function:: ROUND(a) - - Rounds to the nearest whole number:: - - PRINT ROUND(1.887). // prints 2 - -.. function:: ROUND(a,b) - - Rounds to the nearest place value:: - - PRINT ROUND(1.887,2). // prints 1.89 - -.. function:: SQRT(a) - - Returns square root:: - - PRINT SQRT(7.89). // prints 2.80891438103763 - -.. _trig: -.. index:: Trigonometric Functions - -Trigonometric Functions ------------------------ - -.. list-table:: - :header-rows: 1 - :widths: 1 - - * - Function - * - :func:`SIN(a)` - * - :func:`COS(a)` - * - :func:`TAN(a)` - * - :func:`ARCSIN(x)` - * - :func:`ARCCOS(x)` - * - :func:`ARCTAN(x)` - * - :func:`ARCTAN2(x,y)` - -.. function:: SIN(a) - - :parameter a: (deg) angle - :return: sine of the angle - - :: - - PRINT SIN(6). // prints 0.10452846326 - -.. function:: COS(a) - - :parameter a: (deg) angle - :return: cosine of the angle - - :: - - PRINT COS(6). // prints 0.99452189536 - -.. function:: TAN(a) - - :parameter a: (deg) angle - :return: tangent of the angle - - :: - - PRINT TAN(6). // prints 0.10510423526 - -.. function:: ARCSIN(x) - - :parameter x: (scalar) - :return: (deg) angle whose sine is x - - :: - - PRINT ARCSIN(0.67). // prints 42.0670648 - -.. function:: ARCCOS(x) - - :parameter x: (scalar) - :return: (deg) angle whose cosine is x - - :: - - PRINT ARCCOS(0.67). // prints 47.9329352 - -.. function:: ARCTAN(x) - - :parameter x: (scalar) - :return: (deg) angle whose tangent is x - - :: - - PRINT ARCTAN(0.67). // prints 33.8220852 - -.. function:: ARCTAN2(y,x) - - :parameter y: (scalar) - :parameter x: (scalar) - :return: (deg) angle whose tangent is :math:`\frac{y}{x}` - - :: - - PRINT ARCTAN2(0.67, 0.89). // prints 36.9727625 - - The two parameters resolve ambiguities when taking the arctangent. See the `wikipedia page about atan2 `_ for more details. - diff --git a/_sources/math/direction.txt b/_sources/math/direction.txt deleted file mode 100644 index 59ba83d14..000000000 --- a/_sources/math/direction.txt +++ /dev/null @@ -1,229 +0,0 @@ -.. _direction: - -Directions -========== - -.. contents:: Contents - :local: - :depth: 1 - -:struct:`Direction` objects represent a rotation starting from an initial point in **KSP**'s coordinate system where the initial state was looking down the :math:`+z` axis, with the camera "up" being the :math:`+y` axis. This exists primarily to enable automated steering. - -In your thinking, you can largely think of Directions as being Rotations and Rotations as being Directions. The two concepts can be used interchangably. Used on its own to steer by, a rotation from the default XYZ axes of the universe into a new rotation does in fact provide an absolute direction, thus the name Direction for these objects even though in reality they are just Rotations. It's important to know that Directions are just rotations because you can use them to modify other directions or vectors. - -Creation --------- - -=============================================== =================================== - Method Description -=============================================== =================================== - :func:`R(pitch,yaw,roll)` Euler rotation - :func:`Q(x,y,z,rot)` Quaternion - :func:`HEADING(dir,pitch)` Compass heading - :func:`LOOKDIRUP(lookAt,lookUp)` Looking along vector *lookAt*, rolled so that *lookUp* is upward. - :func:`ANGLEAXIS(degress,axisVector)` A rotation that would rotate the universe around an axis - :func:`ROTATEFROMTO(fromVec,toVec)` A rotation that would go from vectors fromVec to toVec - :ref:`FACING ` From SHIP or TARGET - :ref:`UP ` From SHIP - :ref:`PROGRADE, etc. ` From SHIP, TARGET or BODY -=============================================== =================================== - -.. function:: R(pitch,yaw,roll) - - A :struct:`Direction` can be created out of a Euler Rotation, indicated with the :func:`R()` function, as shown below where the ``pitch``, ``yaw`` and ``roll`` values are in degrees:: - - SET myDir TO R( a, b, c ). - -.. function:: Q(x,y,z,rot) - - A :struct:`Direction` can also be created out of a *Quaternion* tuple, indicated with the :func:`Q()` function, as shown below where ``x``, ``y``, and ``z`` are a :struct:`Vector` to rotate around, and ``rot`` is how many degrees to rotate:: - - SET myDir TO Q( x, y, z, rot ). - - -.. function:: HEADING(dir,pitch) - - A :struct:`Direction` can be created out of a :func:`HEADING()` function. The first parameter is the compass heading, and the second parameter is the pitch above the horizon:: - - SET myDir TO HEADING(degreesFromNorth, pitchAboveHorizon). - -.. function:: LOOKDIRUP(lookAt,lookUp) - - A :struct:`Direction` can be created with the LOOKDIRUP function by using two vectors. This is like converting a vector to a direction directly, except that it also provides roll information, which a single vector lacks. *lookAt* is a vector describing the Direction's FORE orientation (its local Z axis), and *lookUp* is a vector describing the direction's TOP orientation (its local Y axis). Note that *lookAt* and *lookUp* need not actually be perpendicualr to each other - they just need to be non-parallel in some way. When they are not perpendicular, then a vector resulting from projecting *lookUp* into the plane that is normal to *lookAt* will be used as the effective *lookUp* instead:: - - // Aim up the SOI's north axis (V(0,1,0)), rolling the roof to point to the sun. - LOCK STEERING TO LOOKDIRUP( V(0,1,0), SUN:POSITION ). - // - // A direction that aims normal to orbit, with the roof pointed down toward the planet: - LOCK normVec to VCRS(SHIP:BODY:POSITION,SHIP:VELOCITY:ORBIT). // Cross-product these for a normal vector - LOCK STEERING TO LOOKDIRUP( normVec, SHIP:BODY:POSITION). - -.. function:: ANGLEAXIS(degress,axisVector) - - A :struct:`Direction` can be created with the ANGLEAXIS function. It represents a rotation of *degrees* around an axis of *axisVector*. To know which way a positive or negative number of degrees rotates, remember this is a left-handed coordinate system:: - - // Pick a new rotation that is pitched 30 degrees from the current one, taking into account - // the ship's current orientation to decide which direction is the 'pitch' rotation: - // - SET pitchUp30 to ANGLEAXIS(-30,SHIP:STARFACING). - SET newDir to pitchUp30*SHIP:FACING. - LOCK STEERING TO newDir. - -.. function:: ROTATEFROMTO(fromVec,toVec) - - A :struct:`Direction` can be created with the ROTATEFROMTO function. It is *one of the infinite number of* rotatations that could rotate vector *fromVec* to become vector *toVec* (or at least pointing in the same direction as toVec, since fromVec and toVec need not be the same magnitude). Note the use of the phrase "**infinite number of**". Because there's no guarantee about the roll information, there are an infinite number of rotations that could qualify as getting you from one vector to another, because there's an infinite number of roll angles that could result and all still fit the requirement:: - - SET myDir to ROTATEFROMTO( v1, v2 ). - -.. _Direction from suffix: -.. object:: Suffix terms from other structures - - A :struct:`Direction` can be made from many suffix terms of other structures, as shown below:: - - SET myDir TO SHIP:FACING. - SET myDir TO TARGET:FACING. - SET myDir TO SHIP:UP. - -Whenever a :struct:`Direction` is printed, it always comes out showing its Euler Rotation, regardless of how it was created:: - - // Initializes a direction to prograde - // plus a relative pitch of 90 - SET X TO SHIP:PROGRADE + R(90,0,0). - - // Steer the vessel in the direction - // suggested by direction X. - LOCK STEERING TO X. - - // Create a rotation facing northeast, - // 10 degrees above horizon - SET Y TO HEADING(45, 10). - - // Steer the vessel in the direction - // suggested by direction X. - LOCK STEERING TO Y. - - // Set by a rotation in degrees - SET Direction TO R(0,90,0). - -Structure ---------- - -.. structure:: Direction - - The suffixes of a :struct:`Direction` cannot be altered, so to get a new :struct:`Direction` you must construct a new one. - - ========================= =================== ================================ - Suffix Type Description - ========================= =================== ================================ - :attr:`PITCH` scalar (deg) Rotation around :math:`x` axis - :attr:`YAW` scalar (deg) Rotation around :math:`y` axis - :attr:`ROLL` scalar (deg) Rotation around :math:`z` axis - :attr:`FOREVECTOR` :struct:`Vector` This Direction's forward vector (z axis after rotation). - VECTOR :struct:`Vector` Alias synonym for :attr:`FOREVECTOR` - :attr:`TOPVECTOR` :struct:`Vector` This Direction's top vector (y axis after rotation). - UPVECTOR :struct:`Vector` Alias synonym for :attr:`TOPVECTOR` - :attr:`STARVECTOR` :struct:`Vector` This Direction's starboard vector (z axis after rotation). - RIGHTVECTOR :struct:`Vector` Alias synonym for :attr:`STARVECTOR` - :attr:`INVERSE` :struct:`Direction` The inverse of this direction. - ================ =================== ================================ - - The :struct:`Direction` object exists primarily to enable automated steering. You can initialize a :struct:`Direction` using a :struct:`Vector` or a ``Rotation``. :struct:`Direction` objects represent a rotation starting from an initial point in **KSP**'s coordinate system where the initial state was looking down the :math:`+z` axis, with the camera "up" being the :math:`+y` axis. So for example, a :struct:`Direction` pointing along the :math:`x` axis might be represented as ``R(0,90,0)``, meaning the initial :math:`z`-axis direction was rotated *90 degrees* around the :math:`y` axis. - - If you are going to manipulate directions a lot, it's important to note that the order in which the rotations occur is: - - 1. First rotate around :math:`z` axis. - 2. Then rotate around :math:`x` axis. - 3. Then rotate around :math:`y` axis. - - What this means is that if you try to ``ROLL`` and ``YAW`` in the same tuple, like so: ``R(0,45,45)``, you'll end up **rolling first and then yawing**, which might not be what you expected. There is little that can be done to change this as it's the native way things are represented in the underlying **Unity engine**. - - Also, if you are going to manipulate directions a lot, it's important to note how **KSP**'s `native coord system works `_. - -.. attribute:: Direction:PITCH - - :type: scalar (deg) - :access: Get only - - - Rotation around the :math:`x` axis. - -.. attribute:: Direction:YAW - - :type: scalar (deg) - :access: Get only - - Rotation around the :math:`y` axis. - -.. attribute:: Direction:ROLL - - :type: scalar (deg) - :access: Get only - - - Rotation around the :math:`z` axis. - -.. attribute:: Direction:FOREVECTOR - - :type: :struct:`Vector` - :access: Get only - - :struct:`Vector` of length 1 that is in the same direction as the "look-at" of this Direction. Note that it is the same meaning as "what the Z axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe". When you LOCK STEERING to a direction, that direction's FOREVECTOR is the vector the nose of the ship will orient to. SHIP:FACING:FOREVECTOR is the way the ship's nose is aimed right now. - -.. attribute:: Direction:TOPVECTOR - - :type: :struct:`Vector` - :access: Get only - - :struct:`Vector` of length 1 that is in the same direction as the "look-up" of this Direction. Note that it is the same meaning as "what the Y axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe". When you LOCK STEERING to a direction, that direction's TOPVECTOR is the vector the roof of the ship will orient to. SHIP:FACING:TOPVECTOR is the way the ship's roof is aimed right now. - -.. attribute:: Direction:STARVECTOR - - :type: :struct:`Vector` - :access: Get only - - :struct:`Vector` of length 1 that is in the same direction as the "starboard side" of this Direction. Note that it is the same meaning as "what the X axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe". When you LOCK STEERING to a direction, that direction's STARVECTOR is the vector the right wing of the ship will orient to. SHIP:FACING:STARVECTOR is the way the ship's right wing is aimed right now. - - -.. note:: **The difference between a :struct:`Direction` and a ``Vector``** - - ``Vector`` and a :struct:`Direction` can be represented with the exact same amount of information: a tuple of 3 floating point numbers. So you might wonder why it is that a ``Vector`` can hold information about the magnitude of the line segment, while a :struct:`Direction` cannot, given that both have the same amount of information. The answer is that a :struct:`Direction` does contain one thing a ``Vector`` does not. A :struct:`Direction` knows which way is "up", while a ``Vector`` does not. If you tell **kOS** to ``LOCK STEERING`` to a ``Vector``, it will be able to point the nose of the vessel in the correct direction, but won't know which way you want the roof of the craft rotated to. This works fine for axial symmetrical rockets but can be a problem for airplanes. - - -Operations and Methods ----------------------- - -You can use math operations on :struct:`Direction` objects as well. The next example uses a rotation of "UP" which is a system variable describing a vector directly away from the celestial body you are under the influence of:: - -Supported Direction Operators: - - **Direction Multiplied by Direction** ``Dir1 * Dir2`` - This operator returns the result of rotating Dir2 by the rotation of Dir1. Note that the order of operations matters here. ``Dir1*Dir2`` is not the same as ``Dir2*Dir1``. Example:: - - // A direction pointing along compass heading 330, by rotating NORTH by 30 degrees around UP axis: - SET newDir TO ANGLEAXIS(30,SHIP:UP) * NORTH. - - **Direction Multiplied by Vector** ``Dir * Vec`` - This operator returns the result of rotating the vector by Dir:: - - // What would the velocity of your ship be if it was angled 20 degrees to your left? - SET Vel to ANGLEAXIS(-20,SHIP:TOPVECTOR) * SHIP:VELOCITY:ORBIT. - // At this point Vel:MAG and SHIP:VELOCITY:MAG should be the same, but they don't point the same way - - **Direction Added to Direction** ``Dir1 + Dir2`` - This operator is less reliable because its exact behavior depends on the order of operations of the UnityEngine's X Y and Z axis rotations, and it can result in gimbal lock. It's supposed to perform a Euler rotation of one direction by another, but it's preferred to use Dir*Dir instead, as that doesn't experience gimbal lock, and does not require that you know the exact transformation order of Unity. - -For vector operations, you may use the ``:VECTOR`` suffix in combination with the regular vector methods:: - - SET dir TO SHIP:UP. - SET newdir TO VCRS(SHIP:PROGRADE:VECTOR, dir:VECTOR) - -Vectors and Directions ----------------------- - -There are some consequences when converting from a :struct:`Direction` to a ``Vector`` and vice versa which should not be overlooked. - -A ``Vector`` and a :struct:`Direction` can be represented with the exact same amount of information: a tuple of 3 floating point numbers. So you might wonder why it is that a ``Vector`` can hold information about the magnitude of the line segment, while a :struct:`Direction` cannot, given that both have the same amount of information. The answer is that a :struct:`Direction` does contain one thing a ``Vector`` does not. A :struct:`Direction` knows which way is "up", while a ``Vector`` does not. If you tell **kOS** to ``LOCK STEERING`` to a ``Vector``, it will be able to point the nose of the vessel in the correct direction, but won't know which way you want the roof of the craft rotated to. This works fine for axial symmetrical rockets but can be a problem for airplanes. - -Therefore if you do this:: - - SET MyVec to V(100,200,300). - SET MyDir to MyVec:DIRECTION. - -Then ``MyDir`` will be a :struct:`Direction`, but it will be a :struct:`Direction` where you have no control over which way is "up" for it. diff --git a/_sources/math/geocoordinates.txt b/_sources/math/geocoordinates.txt deleted file mode 100644 index d4d4dd093..000000000 --- a/_sources/math/geocoordinates.txt +++ /dev/null @@ -1,111 +0,0 @@ -.. _geocoordinates: - -Geographic Coordinates -====================== - -.. contents:: Contents - :local: - :depth: 1 - -The ``GeoCoordinates`` object (also ``LATLNG``) represents a latitude and longitude pair, which is a location on the surface of a :ref:`Body `. - -Creation --------- - -.. function:: LATLNG(lat,lng) - - :parameter lat: (deg) Latitude - :parameter lng: (deg) Longitude - :return: :struct:`GeoCoordinates` - - This function creates a :struct:`GeoCoordiantes` object with the given latitude and longitude. Once created it can't be changed. The :attr:`GeoCoordinates:LAT` and :attr:`GeoCoordinates:LNG` suffixes are get-only and cannot be set. To switch to a new location, make a new call to :func:`LATLNG()`. - - It is also possible to obtain a :struct:`GeoCoordiates` from some suffixes of some other structures. For example:: - - SET spot to SHIP:GEOPOSITION. - -Structure ---------- - -.. structure:: GeoCoordinates - - .. list-table:: - :widths: 2 1 4 - :header-rows: 1 - - * - Suffix - - Type - - Description - - * - :attr:`LAT` - - scalar (deg) - - Latitude - * - :attr:`LNG` - - scalar (deg) - - Longitude - * - :attr:`DISTANCE` - - scalar (m) - - distance from :ref:`CPU Vessel ` - * - :attr:`TERRAINHEIGHT` - - scalar (m) - - above or below sea level - * - :attr:`HEADING` - - scalar (deg) - - *absolute* heading from :ref:`CPU Vessel ` - * - :attr:`BEARING` - - scalar (deg) - - *relative* direction from :ref:`CPU Vessel ` - -.. attribute:: GeoCoordinates:LAT - - The latitude of this position on the surface. - -.. attribute:: GeoCoordinates:LNG - - The longitude of this position on the surface. - -.. attribute:: GeoCoordinates:DISTANCE - - Distance from the :ref:`CPU_Vessel ` to this point on the surface. - -.. attribute:: GeoCoordinates:TERRAINHEIGHT - - Distance of the terrain above "sea level" at this geographical position. Negative numbers are below "sea level." - -.. attribute:: GeoCoordinates:HEADING - - The *absolute* compass direction from the :ref:`CPU_Vessel ` to this point on the surface. - -.. attribute:: GeoCoordinates:BEARING - - The *relative* compass direction from the :ref:`CPU_Vessel ` to this point on the surface. For example, if the vessel is heading at compass heading 45, and the geo-coordinates location is at heading 30, then :attr:`GeoCoordinates:BEARING` will return -15. - -Examples Usage --------------- - -:: - - SET spot TO LATLNG(10, 20). // Initialize point at latitude 10, - // longitude 20 - - PRINT spot:LAT. // Print 10 - PRINT spot:LNG. // Print 20 - - PRINT spot:DISTANCE. // Print distance from vessel to x - // (same altitude is presumed) - PRINT spot:HEADING. // Print the heading to the point - PRINT spot:BEARING. // Print the heading to the point - // relative to vessel heading - - SET spot TO SHIP:GEOPOSITION. // Make spot into a location on the - // surface directly underneath the - // current ship - - SET spot TO LATLNG(spot:LAT,spot:LNG+5). // Make spot into a new - // location 5 degrees east - // of the old one - - PRINT "THESE TWO NUMBERS SHOULD BE THE SAME:". - PRINT (SHIP:ALTITIUDE - SHIP:GEOPOSITION:TERRAINHEIGHT). - PRINT ALT:RADAR. - diff --git a/_sources/math/ref_frame.txt b/_sources/math/ref_frame.txt deleted file mode 100644 index 3c2936512..000000000 --- a/_sources/math/ref_frame.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _ref frame: - -Reference Frames -================ - -This page describes the :math:`(x,y,z)` reference frame used for most of **kOS**'s vectors. The coordinate system of Kerbal Space Program does some strange things that don't make a lot of sense at first. For nomenclature, the following terms are used in this documentation: - -.. _ship-raw: -.. index:: SHIP-RAW (Reference Frame) -.. object:: SHIP-RAW - - The name of the reference frame in which the origin point is :ref:`CPU Vessel`, and the rotation is identical to **KSP**'s native raw coordinate grid. - -.. _soi-raw: -.. index:: SOI-RAW (Reference Frame) -.. object:: SOI-RAW - - The name of the reference frame in which the origin point is the center of the *SOI body*, and the rotation is identical to **KSP**'s native raw coordinate grid. - -.. _raw-raw: -.. index:: RAW-RAW (Reference Frame) -.. object:: RAW-RAW - - The name of the reference fraem in which both the origin point and the rotation of the axes is identical to **KSP**'s native raw coordinate grid. This is never exposed to the **KerbalScript** program, because the origin point is meaningless to work with. - -.. note:: - It is hoped that this may be expanded in the future, and conversion routines provided to let people pick a reference frame that makes sense depending on what the script is trying to do. At the moment the only reference frames used are SHIP-RAW and SOI-RAW, as they match closely to what **KSP** is using internally. - -Raw Orienatation ----------------- - -.. figure:: /_images/reference/math/KSP_body_coords.png - -The Y axis of **KSP** is the only consistent thing. Imagine a ray starting in the center of the SOI body and pointing upward out through the north pole. That is the direction of the Y axis. (If you move to the SOI of a body with an inclinded spin, presumably it will also change the angle of the Y axis to point in the new direction of the body's spin axis). - -The X and Z axes of the coordinate grid are then consequently aligned with the equator plane of the SOI body, 90 degrees to each other. **KSP** uses a left-handed coordinate system, so the Z axis will always be rotated 90 degrees to the east of the X axis. - -.. figure:: /_images/reference/math/KSP_body_latlong.png - -However, the X and Z axes are hard to predict where they'll exactly be. They keep moving depending on where you are, to the point where it's impossible to get a fix on just which direction they'll point. - -Origin Position ---------------- - -The origin position of the :math:`(x,y,z)` coordinate grid in **KSP** is also a bit messy. It's usually *near* but not exactly *on* the current ship. **kOS** performs some conversions for you to make this a bit simpler and keep everything consistent. - -Regardless of where the origin of the underlying **KSP** system is, in **kOS**, whenever a POSITION is reported, it will always be reported in a frame of reference where the origin is located at the :ref:`CPU Vessel `. - -However, for the sake of VELOCITY, the origin point of all vectors is usually not SHIP, but rather it's the SOI body's center. This is because if the origin point was the SHIP, then the ship's velocity would always be zero in that frame of reference, and that would not be useful. - -The makers of **kOS** are aware that this is not technically a proper frame of reference, because the origin point varies depending on if you're getting POSITION or getting VELOCITY. Fixing it at this point would break a lot of existing scripts, however. - -So the rule of thumb is: - -- For POSITION returned by **KSP**, the SHIP-RAW reference frame is used: centered on SHIP, with raw axes rotation. -- For VELOCITY returned by **KSP**, the SOI-RAW reference frame is used: centered on SOI Body, with raw axes rotation. - -Converting ----------- - -Converting between SHIP-RAW and SOI-RAW reference frames is a simple matter of adding or subtracting the SHIP:BODY:POSITION vector from the coordinate, to move the origin point. This is because both are using the same axes rotation. - -- Any SHIP-RAW vector Minus SHIP:BODY:POSITION Gives the vector in SOI-RAW coordinates. -- Any SOI-RAW vector Plus SHIP:BODY:POSITION Gives the vector in SHIP-RAW coordinates. diff --git a/_sources/math/vector.txt b/_sources/math/vector.txt deleted file mode 100644 index 5958f7787..000000000 --- a/_sources/math/vector.txt +++ /dev/null @@ -1,276 +0,0 @@ -Vectors -======= - -.. contents:: Contents - :local: - :depth: 1 - -Creation --------- - -.. function:: V(x,y,z) - - :parameter x: (scalar) :math:`x` coordinate - :parameter y: (scalar) :math:`y` coordinate - :parameter z: (scalar) :math:`z` coordinate - :return: :struct:`Vector` - - This creates a new vector from 3 components in :math:`(x,y,z)`:: - - SET vec TO V(x,y,z). - - Here, a new :struct:`Vector` called ``vec`` is created . The object :struct:`Vector` represents a `three-dimensional euclidean vector `__ To deeply understand most vectors in kOS, you have to understand a bit about the :ref:`underlying coordinate system of KSP `. If you are having trouble making sense of the direction the axes point in, go read that page. - -Structure ---------- - -.. structure:: Vector - - .. list-table:: **Members** - :widths: 4 2 1 1 - :header-rows: 1 - - * - Suffix - - Type - - Get - - Set - - * - :attr:`X` - - scalar - - yes - - yes - * - :attr:`Y` - - scalar - - yes - - yes - * - :attr:`Y` - - scalar - - yes - - yes - * - :attr:`MAG` - - scalar - - yes - - yes - * - :attr:`NORMALIZED` - - :struct:`Vector` - - yes - - no - * - :attr:`SQRMAGNITUDE` - - scalar - - yes - - no - * - :attr:`DIRECTION` - - :struct:`Direction` - - yes - - yes - * - :attr:`VEC` - - :struct:`Vector` - - yes - - no - -.. attribute:: Vector:X - - :type: scalar - :access: Get/Set - - The :math:`x` component of the vector. - -.. attribute:: Vector:Y - - :type: scalar - :access: Get/Set - - The :math:`y` component of the vector. - -.. attribute:: Vector:Z - - :type: scalar - :access: Get/Set - - The :math:`z` component of the vector. - -.. attribute:: Vector:MAG - - :type: scalar - :access: Get/Set - - The magnitude of the vector, as a scalar number, by the Pythagorean Theorem. - -.. attribute:: Vector:NORMALIZED - - :type: :struct:`Vector` - :access: Get only - - This creates a unit vector pointing in the same direction as this vector. This is the same effect as multiplying the vector by the scalar ``1 / vec:MAG``. - -.. attribute:: Vector:SQRMAGNITUDE - - :type: scalar - :access: Get only - - The magnitude of the vector, squared. Use instead of ``vec:MAG^2`` if you need to square of the magnitude as this skips the step in the Pythagorean formula where you take the square root in the first place. Taking the square root and then squaring that would introduce floating point error needlessly. - -.. attribute:: Vector:DIRECTION - - :type: :struct:`Direction` - :access: Get/Set - - GET: - The vector rendered into a :ref:`Direction ` (see note at the bottom of this page about information loss when doing this). - - SET: - Tells the vector to keep its magnitude as it is but point in a new direction, adjusting its :math:`(x,y,z)` numbers accordingly. - -.. attribute:: Vector:VEC - - :type: :struct:`Vector` - :access: Get only - - This is a suffix that creates a *COPY* of this vector. Useful if you want to copy a vector and then change the copy. Normally if you ``SET v2 TO v1``, then ``v1`` and ``v2`` are two names for the same vector and changing one would change the other. - - -Operations and Methods ----------------------- - -============================================================= ============= -Method / Operator Return Type -============================================================= ============= - :ref:`* (asterisk) ` scalar or :struct:`Vector` - :ref:`+ (plus) ` :struct:`Vector` - :ref:`- (minus) ` :struct:`Vector` - :func:`VDOT`, :func:`VECTORDOTPRODUCT`, :ref:`* ` scalar - :func:`VCRS`, :func:`VECTORCROSSPRODUCT` :struct:`Vector` - :func:`VANG`, :func:`VECTORANGLE` scalar (deg) - :func:`VXCL`, :func:`VECTOREXCLUDE` :struct:`Vector` -============================================================= ============= - -.. index:: vector multiplication -.. _Vector *: -.. object:: * - - `Scalar multiplication `_ or `dot product `_ of two ``Vectors``. See also :func:`VECTORDOTPRODUCT`:: - - SET a TO 2. - SET vec1 TO V(1,2,3). - SET vec2 TO V(2,3,4). - PRINT a * vec1. // prints: V(2,4,6) - PRINT vec1 * vec2. // prints: 20 - -.. index:: vector addition -.. index:: vector subtraction -.. _Vector +-: -.. object:: +, - - - :struct:`Vector` `addition and subtraction `_ by a scalar or another :struct:`Vector`:: - - SET a TO 2. - SET vec1 TO V(1,2,3). - SET vec2 TO V(2,3,4). - PRINT vec1 + vec2. // prints: V(3,5,7) - PRINT vec2 - vec1. // prints: V(1,1,1) - -.. function:: VDOT(v1,v2) - - Same as :func:`VECTORDOTPRODUCT(v1,v2)` and :ref:`v1 * v2 `. - -.. function:: VECTORDOTPRODUCT(v1,v2) - - :parameter v1: (:struct:`Vector`) - :parameter v2: (:struct:`Vector`) - :return: The `vector dot-product `_ - :rtype: scalar - - This is the `dot product `_ of two vectors returning a scalar number. This is the same as :ref:`v1 * v2 `:: - - SET vec1 TO V(1,2,3). - SET vec2 TO V(2,3,4). - - // These will all print the value: 20 - PRINT vec1 * vec2. - PRINT VDOT(vec1, vec2). - PRINT VECTORDOTPRODUCT(vec1, vec2). - -.. function:: VCRS(v1,v2) - - Same as :func:`VECTORCROSSPRODUCT(v1,v2)` - -.. function:: VECTORCROSSPRODUCT(v1,v2) - - :parameter v1: (:struct:`Vector`) - :parameter v2: (:struct:`Vector`) - :return: The `vector cross-product `_ - :rtype: :struct:`Vector` - - The vector `cross product `_ of two vectors in the order ``(v1,v2)`` returning a new `Vector`:: - - SET vec1 TO V(1,2,3). - SET vec2 TO V(2,3,4). - - // These will both print: V(-1,2,-1) - PRINT VCRS(vec1, vec2). - PRINT VECTORCROSSPRODUCT(vec1, vec2). - -.. function:: VANG(v1,v2):: - - Same as :func:`VECTORANGLE(v1,v2)`. - -.. function:: VECTORANGLE(v1,v2) - - :parameter v1: (:struct:`Vector`) - :parameter v2: (:struct:`Vector`) - :return: Angle between two vectors - :rtype: scalar - - This returns the angle between v1 and v2. It is the same result as: - - .. math:: - - \arccos\left( - \frac{ - \vec{v_1}\cdot\vec{v_2} - }{ - \left|\vec{v_1}\cdot\vec{v_2}\right| - } - \right) - - or in **KerboScript**:: - - arccos( (VDOT(v1,v2) / VDOT(v1,v2):MAG ) ) - -.. function:: VXCL(v1,v2) - - Same as :func:`VECTOREXCLUDE(v1,v2)` - -.. function:: VECTOREXCLUDE(v1,v2) - - This is a vector, ``v2`` with all of ``v1`` excluded from it. In other words, the projection of ``v2`` onto the plane that is normal to ``v1``. - -.. _vecsmul: http://en.wikipedia.org/wiki/Vector_addition#Scalar_multiplication -.. _vecadd: http://en.wikipedia.org/wiki/Vector_addition#Addition_and_subtraction -.. _vecdot: http://en.wikipedia.org/wiki/Dot_product -.. _veccross: http://en.wikipedia.org/wiki/Cross_product - -Some examples of using the :struct:`Vector` object:: - - // initializes a vector with x=100, y=5, z=0 - SET varname TO V(100,5,0). - - varname:X. // Returns 100. - V(100,5,0):Y. // Returns 5. - V(100,5,0):Z. // Returns 0. - - // Returns the magnitude of the vector - varname:MAG. - - // Changes x coordinate value to 111. - SET varname:X TO 111. - - // Lengthen or shorten vector to make its magnitude 10. - SET varname:MAG to 10. - - // get vector pointing opposite to surface velocity. - SET retroSurf to (-1)*velocity:surface. - - // use cross product to find normal to the orbit plane. - SET norm to VCRS(velocity:orbit, ship:body:position). - diff --git a/_sources/structures.txt b/_sources/structures.txt deleted file mode 100644 index b656b65aa..000000000 --- a/_sources/structures.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _structures: - -Structure Reference -=================== - -A general discussion of structures :ref:`can be found here `. - -* :ref:`Mathematics ` - * :ref:`Fundamental Constants ` - * :ref:`Mathematical Functions ` - * :ref:`Trigonometric Functions ` - * :struct:`Vector` - * :struct:`Direction` - * :struct:`GeoCoordinates` -* :ref:`Orbits ` - * :struct:`Orbit` - * :struct:`Orbitable` - * :struct:`OrbitableVelocity` -* :ref:`Celestial Bodies ` - * :struct:`Body` - * :struct:`Atmosphere` -* :ref:`Vessels ` - * :struct:`Vessel` - * :struct:`Control` - * :struct:`ManeuverNode` - * :struct:`Engine` - * :struct:`Resource` - * :struct:`DockingPort` - * :struct:`Part` - * :struct:`PartModule` - * :struct:`Sensor` - * :struct:`VesselSensors` -* :ref:`Configuration and Misc ` - * :struct:`Config` - * :struct:`FileInfo` - * :struct:`List` - * :struct:`Iterator` - * :ref:`Colors ` - * :ref:`Time `. - -.. note:: - - **SOI Body** - - Every where you see the term **SOI Body** in the descriptions below, it refers to the body at the center of the orbit of this object - the body in who's sphere of influence this object is located. It is important to make the distinction that if this object is itself a Body, the **SOI body** is the body being orbited, not the body doing the orbiting. I.e. When talking about the Mun, the **SOI body** means "Kerbin". When talking about Kerbin, the **SOI body** means "Sun". - -.. structure:: Orbitable - - **These terms are all read-only.** - - ======================= ============== - Suffix Type (units) - ======================= ============== - :attr:`NAME` string - :attr:`BODY` :struct:`Body` - :attr:`OBT` :struct:`Orbit` - :attr:`UP` :struct:`Direction` - :attr:`NORTH` :struct:`Direction` - :attr:`PROGRADE` :struct:`Direction` - :attr:`SRFPROGRADE` :struct:`Direction` - :attr:`RETROGRADE` :struct:`Direction` - :attr:`SRFRETROGRADE` :struct:`Direction` - :attr:`POSITION` :struct:`Vector` - :attr:`VELOCITY` :struct:`OrbitableVelocity` - :attr:`DISTANCE` scalar (m) - :attr:`DIRECTION` :struct:`Direction` - :attr:`LATITUDE` scalar (deg) - :attr:`LONGITUDE` scalar (deg) - :attr:`ALTITUDE` scalar (m) - :attr:`GEOPOSITION` :struct:`GeoCoordinates` - :attr:`PATCHES` :struct:`List` of :struct:`Orbits ` - ----------------------- -------------- - The Following are deprecated (use :attr:`OBT`) - -------------------------------------- - :attr:`APOAPSIS` scalar (m) - :attr:`PERIAPSIS` scalar (m) - ======================= ============== - - -.. attribute:: Orbitable:NAME - - :type: string - :access: Get only - - Name of this vessel or body. - -.. attribute:: Orbitable:BODY - - :type: :struct:`Body` - :access: Get only - - The :struct:`Body` that this object is orbiting. I.e. ``Mun:BODY`` returns ``Kerbin``. - -.. attribute:: Orbitable:OBT - - :type: :struct:`Orbit` - :access: Get only - - The current single orbit "patch" that this object is on (not the future orbits it might be expected to achieve after maneuver nodes or encounter transitions, but what the current orbit would be if nothing changed and no encounters perturbed the orbit. - -.. attribute:: Orbitable:UP - - :type: :struct:`Direction` - :access: Get only - - pointing straight up away from the SOI body. - -.. attribute:: Orbitable:NORTH - - :type: :struct:`Direction` - :access: Get only - - pointing straight north on the SOI body, parallel to the surface of the SOI body. - -.. attribute:: Orbitable:PROGRADE - - :type: :struct:`Direction` - :access: Get only - - pointing in the direction of this object's **orbitable-frame** velocity - -.. attribute:: Orbitable:SRFPROGRADE - - :type: :struct:`Direction` - :access: Get only - - pointing in the direction of this object's **surface-frame** velocity. Note that if this Orbitable is itself a body, remember that this is relative to the surface of the SOI body, not this body. - -.. attribute:: Orbitable:RETROGRADE - - :type: :struct:`Direction` - :access: Get only - - pointing in the opposite of the direction of this object's **orbitable-frame** velocity - -.. attribute:: Orbitable:SRFRETROGRADE - - :type: :struct:`Direction` - :access: Get only - - pointing in the opposite of the direction of this object's **surface-frame** velocity. Note that this is relative to the surface of the SOI body. - -.. attribute:: Orbitable:POSITION - - :type: :struct:`Vector` - :access: Get only - - The position of this object in the :ref:`SHIP-RAW reference frame ` - -.. attribute:: Orbitable:VELOCITY - - :type: :struct:`OrbitableVelocity` - :access: Get only - - The :struct:`orbitable velocity ` of this object in the :ref:`SHIP-RAW reference frame ` - -.. attribute:: Orbitable:DISTANCE - - :type: scalar (m) - :access: Get only - - The scalar distance between this object and the center of :struct:`SHIP`. - -.. attribute:: Orbitable:DIRECTION - - :type: :struct:`Direction` - :access: Get only - - pointing in the direction of this object from :struct:`SHIP`. - -.. attribute:: Orbitable:LATITUDE - - :type: scalar (deg) - :access: Get only - - The latitude in degrees of the spot on the surface of the SOI body directly under this object. - -.. attribute:: Orbitable:LONGITUDE - - :type: scalar (deg) - :access: Get only - - The longitude in degrees of the spot on the surface of the SOI body directly under this object. Longitude returned will always be normalized to be in the range [-180,180]. - -.. attribute:: Orbitable:ALTITUDE - - :type: scalar (m) - :access: Get only - - The altitude in meters above the *sea level* surface of the SOI body (not the center of the SOI body. To get the true radius of the orbit for proper math calculations remember to add altitude to the SOI body's radius.) - -.. attribute:: Orbitable:GEOPOSITION - - :type: :struct:`GeoCoordinates` - :access: Get only - - A combined structure of the latitude and longitude numbers. - -.. attribute:: Orbitable:PATCHES - - :type: :struct:`List` of :struct:`Orbit` "patches" - :access: Get only - - The list of all the orbit patches that this object will transition to, not taking into account maneuver nodes. The zero-th patch of the list is the current orbit. - -.. attribute:: Orbitable:APOAPSIS - - :type: scalar (deg) - :access: Get only - - .. deprecated:: 0.15 - - Use :attr:`OBT:APOAPSIS ` instead. - -.. attribute:: Orbitable:PERIAPSIS - - :type: scalar (deg) - :access: Get only - - .. deprecated:: 0.15 - - Use :attr:`OBT:PERIAPSIS ` instead. - diff --git a/_sources/structures/orbits/orbitablevelocity.txt b/_sources/structures/orbits/orbitablevelocity.txt deleted file mode 100644 index 640373346..000000000 --- a/_sources/structures/orbits/orbitablevelocity.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _orbitablevelocity: - -OrbitableVelocity -================= - -When any :struct:`Orbitable` object returns its :attr:`VELOCITY ` suffix, it returns it as a structure containing a pair of both its orbit-frame velocity and its surface-frame velocity at the same instant of time. To obtain its velocity as a vector you must pick whether you want the oribtal or surface velocities by giving a further suffix: - -.. structure:: OrbitableVelocity:: - - .. list-table:: Members - :header-rows: 1 - :widths: 1 1 - - * - Suffix - - Type - * - :attr:`ORBIT` - - :struct:`Vector` - * - :attr:`SURFACE` - - :struct:`Vector` - -.. attribute:: OrbitableVelocity:ORBIT - - :type: :struct:`Vector` - :access: Get only - - Returns the orbital velocity. - -.. attribute:: OrbitableVelocity:SURFACE - - :type: :struct:`Vector` - :access: Get only - - Returns the surface-frame velocity. Note that this is the surface velocity relative to the surface of the SOI body, not the orbiting object itself. (i.e. Mun:VELOCITY:SURFACE returns the Mun's velocity relative to the surface of its SOI body, Kerbin). - -Examples:: - - SET VORB TO SHIP:VELOCITY:ORBIT - SET VSRF TO SHIP:VELOCITY:SURFACE - SET MUNORB TO MUN:VELOCITY:ORBIT - SET MUNSRF TO MUN:VELOCITY:SURFACE - -.. note:: - - At first glance it may seem that ``Mun:VELOCITY:SURFACE`` is wrong because it creates a vector in the opposite direction from ``Mun:VELOCITY:ORBIT``, but this is actually correct. Kerbin's surface rotates once every 6 hours, and the Mun takes a lot longer than 6 hours to orbit Kerbin. Therefore, relative to Kerbin's surface, the Mun is going backward. diff --git a/_sources/structures/vessels.txt b/_sources/structures/vessels.txt deleted file mode 100644 index 7508c6e36..000000000 --- a/_sources/structures/vessels.txt +++ /dev/null @@ -1,10 +0,0 @@ -.. _vessels: - -Vessels and Parts -================= - -.. toctree:: - :glob: - :maxdepth: 1 - - vessels/* diff --git a/_sources/structures/vessels/dockingport.txt b/_sources/structures/vessels/dockingport.txt deleted file mode 100644 index 7115f07e1..000000000 --- a/_sources/structures/vessels/dockingport.txt +++ /dev/null @@ -1,131 +0,0 @@ -.. _dockingport: - -DockingPort -=========== - -Some of the Parts returned by :ref:`LIST PARTS ` will be of type :struct:`DockingPort`. - - -.. structure:: DockingPort - - .. list-table:: - :header-rows: 1 - :widths: 2 1 4 - - * - Suffix - - Type - - Description - - * - All suffixes of :struct:`Part` - - - - A :struct:`DockingPort` is a kind of :struct:`Part` - - * - :attr:`AQUIRERANGE` - - scalar - - active range of the port - * - :attr:`AQUIREFORCE` - - scalar - - force experienced when docking - * - :attr:`AQUIRETORQUE` - - scalar - - torque experienced when docking - * - :attr:`REENGAGEDDISTANCE` - - scalar - - distance at which the port is reset - * - :attr:`DOCKEDSHIPNAME` - - string - - name of vessel the port is docked to - * - :attr:`PORTFACING` - - :struct:`Direction` - - facing of the port - * - :attr:`STATE` - - string - - current state of the port - * - :meth:`UNDOCK` - - - - callable to release the dock - * - :attr:`TARGETABLE` - - boolean - - check if this port can be targeted - -.. note:: - - :struct:`DockingPort` is a type of :struct:`Part`, and therefore can use all the suffixes of :struct:`Part`. Shown below are only the suffixes that are unique to :struct:`DockingPort`. - - -.. attribute:: DockingPort:AQUIRERANGE - - :type: scalar - :access: Get only - - gets the range at which the port will "notice" another port and pull on it. - -.. attribute:: DockingPort:AQUIREFORCE - - :type: scalar - :access: Get only - - gets the force with which the port pulls on another port. - -.. attribute:: DockingPort:AQUIRETORQUE - - :type: scalar - :access: Get only - - gets the rotational force with which the port pulls on another port. - -.. attribute:: DockingPort:REENGAGEDDISTANCE - - :type: scalar - :access: Get only - - how far the port has to get away after undocking in order to re-enable docking. - -.. attribute:: DockingPort:DOCKEDSHIPNAME - - :type: string - :access: Get only - - name of vessel on the other side of the docking port. - -.. attribute:: DockingPort:PORTFACING - - :type: :struct:`Direction` - :access: Get only - - Gets the facing of this docking port which may differ from the facing of the part itself if the docking port is aimed out the side of the part, as in the case of the inline shielded docking port. - -.. attribute:: DockingPort:STATE - - :type: string - :access: Get only - - One of the following string values: - - ``Ready`` - Docking port is not yet attached and will attach if it touches another. - ``Docked (docker)`` - One port in the joined pair is called the docker, and has this state - ``Docked (dockee)`` - One port in the joined pair is called the dockee, and has this state - ``Docked (same vessel)`` - Sometimes KSP says this instead. It's unclear what it means. - ``Disabled`` - Docking port will refuse to dock if it bumps another docking port. - ``PreAttached`` - Temporary state during the "wobbling" while two ports are magnetically touching but not yet docked solidly. During this state the two vessels are still tracked as separate vessels and haven't become one yet. - - -.. method:: DockingPort:UNDOCK - - Call this to cause the docking port to detach. - -.. attribute:: DockingPort:TARGETABLE - - :type: boolean - :access: Get only - - True if this part can be picked with ``SET TARGET TO``. - - - diff --git a/_sources/structures/vessels/engine.txt b/_sources/structures/vessels/engine.txt deleted file mode 100644 index 4263eb92e..000000000 --- a/_sources/structures/vessels/engine.txt +++ /dev/null @@ -1,148 +0,0 @@ -.. _engine: - -Engine -====== - -Some of the Parts returned by :ref:`LIST PARTS ` will be of type Engine. It is also possible to get just the Engine parts by executing ``LIST ENGINES``, for example:: - - LIST ENGINES IN myVariable. - FOR eng IN myVariable { - print "An engine exists with ISP = " + eng:ISP. - }. - -.. structure:: Engine - - .. list-table:: Members - :header-rows: 1 - :widths: 1 1 2 - - * - Suffix - - Type (units) - - Description - - * - All suffixes of :struct:`Part` - - - - - * - :meth:`ACTIVATE` - - - - Turn engine on - * - :meth:`SHUTDOWN` - - - - Turn engine off - * - :attr:`THRUSTLIMIT` - - scalar (%) - - Tweaked thrust limit - * - :attr:`MAXTHRUST` - - scalar (kN) - - Untweaked thrust limit - * - :attr:`THRUST` - - scalar (kN) - - Current thrust - * - :attr:`FUELFLOW` - - scalar (l/s maybe) - - Rate of fuel burn - * - :attr:`ISP` - - scalar - - `Specific impulse `_ - * - :attr:`FLAMEOUT` - - boolean - - Check if no more fuel - * - :attr:`IGNITION` - - boolean - - Check if engine is active - * - :attr:`ALLOWRESTART` - - boolean - - Check if engine can be reactivated - * - :attr:`ALLOWSHUTDOWN` - - boolean - - Check if engine can be shutdown - * - :attr:`THROTTLELOCK` - - boolean - - Check if throttle can not be changed - - -.. note:: - - :struct:`Engine` is a type of :struct:`Part`, and therefore can use all the suffixes of :struct:`Part`. Shown below are only the suffixes that are unique to :struct:`Engine`. - - - -.. method:: Engine:ACTIVATE - - Call to make the engine turn on. - -.. method:: Engine:SHUTDOWN - - Call to make the engine turn off. - -.. attribute:: Engine:THRUSTLIMIT - - :access: Get only - :type: scalar (%) - - If this an engine with a thrust limiter (tweakable) enabled, what percentage is it limited to? - -.. attribute:: Engine:MAXTHRUST - - :access: Get only - :type: scalar (kN) - - How much thrust would this engine give if the throttle was max and conditions were ideal. - -.. attribute:: Engine:THRUST - - :access: Get only - :type: scalar (kN) - - How much thrust is this engine giving at this very moment. - -.. attribute:: Engine:FUELFLOW - - :access: Get only - :type: scalar (Liters/s? maybe) - - Rate at which fuel is being burned. Not sure what the units are. - -.. attribute:: Engine:ISP - - :access: Get only - :type: scalar - - `Specific impulse `_ - -.. attribute:: Engine:FLAMEOUT - - :access: Get only - :type: boolean - - Is this engine failed because it is starved of a resource (liquidfuel, oxidizer, oxygen)? - -.. attribute:: Engine:IGNITION - - :access: Get only - :type: boolean - - Has this engine been ignited? If both :attr:`Engine:IGNITION` and :attr:`Engine:FLAMEOUT` are true, that means the engine could start up again immediately if more resources were made available to it. - -.. attribute:: Engine:ALLOWRESTART - - :access: Get only - :type: boolean - - Is this an engine that can be started again? Usually True, but false for solid boosters. - -.. attribute:: Engine:ALLOWSHUTDOWN - - :access: Get only - :type: boolean - - Is this an engine that can be shut off once started? Usually True, but false for solid boosters. - -.. attribute:: Engine:THROTTLELOCK - - :access: Get only - :type: boolean - - Is this an engine that is stuck at a fixed throttle? (i.e. solid boosters) - -.. _isp: http://en.wikipedia.org/wiki/Specific_impulse diff --git a/_sources/structures/vessels/node.txt b/_sources/structures/vessels/node.txt deleted file mode 100644 index 22c88aeea..000000000 --- a/_sources/structures/vessels/node.txt +++ /dev/null @@ -1,188 +0,0 @@ -.. _maneuver node: - -Maneuver Node -============= - -*Contents* - - - :func:`NODE()` - - :global:`ADD` - - :global:`REMOVE` - - :global:`NEXTNODE` - - :struct:`ManeuverNode` - -A planned velocity change along an orbit. These are the nodes that you can set in the KSP user interface. Setting one through kOS will make it appear on the in-game map view, and creating one manually on the in-game map view will cause it to be visible to kOS. - -Creation --------- - -.. function:: NODE(utime, radial, normal, prograde) - - :parameter utime: (sec) Time of this maneuver - :parameter radial: (m/s) Delta-V in radial-out direction - :parameter normal: (m/s) Delta-V normal to orbital plane - :parameter prograde: (m/s) Delta-V in prograde direction - :returns: :struct:`ManeuverNode` - - You can make a maneuver node in a variable using the :func:`NODE` function:: - - SET myNode to NODE( TIME:SECONDS+200, 0, 50, 10 ). - - Once you have a maneuver node in a variable, you use the :global:`ADD` and :global:`REMOVE` commands to attach it to your vessel's flight plan. A kOS CPU can only manipulate the flight plan of its :ref:`CPU vessel `. - - .. warning:: - - When *constructing* a new node using the :func:`NODE` function call, you use the universal time (you must add the ETA time to the current time to arrive at the value to pass in), but when using the suffix :attr:`ManeuverNode:ETA`, you do NOT use universal time, instead just giving the number of seconds from now. - - Once you have created a node, it's just a hypothetical node that hasn't - been attached to anything yet. To attach a node to the flight path, you must use the command :global:`ADD` to attach it to the ship. - -.. global:: ADD - - To put a maneuver node into the flight plan of the current :ref:`CPU vessel ` (i.e. ``SHIP``), just :global:`ADD` it like so:: - - SET myNode to NODE( TIME:SECONDS+200, 0, 50, 10 ). - ADD myNode. - - You should immediately see it appear on the map view when you do this. The :global:`ADD` command can add nodes anywhere within the flight plan. To insert a node earlier in the flight than an existing node, simply give it a smaller :attr:`ETA ` time and then :global:`ADD` it. - -.. global:: REMOVE - - To remove a maneuver node from the flight path of the cur:rent :ref:`CPU vessel ` (i.e. ``SHIP``), just :global:`REMOVE` it like so:: - - REMOVE myNode. - -.. global:: NEXTNODE - - :global:`NEXTNODE` is a built-in variable that always refers to the next upcoming node that has been added to your flight plan:: - - SET MyNode to :global:`NEXTNODE`. - PRINT :global:`NEXTNODE`:PROGRADE. - REMOVE :global:`NEXTNODE`. - - Currently, if you attempt to query :global:`NEXTNODE` and there is no node on your flight plan, it produces a run-time error. (This needs to be fixed in a future release so it is possible to query whether or not you have a next node). - - If you need to query whether or not you have a :global:`NEXTNODE`, the following has been suggested as a workaround in the meantime: Set a node really far into the future, beyond any reasonable amount of time. Add it to your flight plan. Then check :global:`NEXTNODE` to see if it returns THAT node, or an earlier one. If it returns an earlier one, then that earlier one was there all along and is the real :global:`NEXTNODE`. If it returns the fake far-future node you made instead, then there were no nodes before that point. In either case, remove the far-future node after you perform the test. - - The special identifier :global:`NEXTNODE` is a euphemism for "whichever node is coming up soonest on my flight path". Therefore you can remove a node even if you no longer have the maneuver node variable around, by doing this:: - - REMOVE :global:`NEXTNODE`. - -Structure ---------- - -.. structure:: ManeuverNode - - - Here are some examples of accessing the suffixes of a :struct:`ManeuverNode`:: - - // creates a node 60 seconds from now with - // prograde = 100 m/s - SET X TO NODE(TIME:SECONDS+60, 0, 0, 100). - - ADD X. // adds maneuver to flight plan - - PRINT X:PROGRADE. // prints 100. - PRINT X:ETA. // prints seconds till maneuver - PRINT X:DELTAV // prints delta-v vector - - REMOVE X. // remove node from flight plan - - // Create a blank node - SET X TO NODE(0, 0, 0, 0). - - ADD X. // add Node to flight plan - SET X:PROGRADE to 500. // set prograde dV to 500 m/s - SET X:ETA to 30. // Set to 30 sec from now - - PRINT X:ORBIT:APOAPSIS. // apoapsis after maneuver - PRINT X:ORBIT:PERIAPSIS. // periapsis after maneuver - - - .. list-table:: Members - :header-rows: 1 - :widths: 1 1 1 2 - - * - Suffix - - Type (units) - - Access - - Description - - * - :attr:`DELTAV` - - :struct:`Vector` (m/s) - - Get only - - The burn vector with magnitude equal to delta-V - * - :attr:`BURNVECTOR` - - :struct:`Vector` (m/s) - - Get only - - Alias for :attr:`DELTAV` - * - :attr:`ETA` - - scalar (s) - - Get/Set - - Time until this maneuver - * - :attr:`PROGRADE` - - scalar (m/s) - - Get/Set - - Delta-V along prograde - * - :attr:`RADIALOUT` - - scalar (m/s) - - Get/Set - - Delta-V along radial to orbited :struct:`Body` - * - :attr:`NORMAL` - - scalar (m/s) - - Get/Set - - Delta-V along normal to the :struct:`Vessel`'s :struct:`Orbit` - * - :attr:`ORBIT` - - :struct:`Orbit` - - Get only - - Expected :struct:`Orbit` after this maneuver - - -.. attribute:: ManeuverNode:DELTAV - - :access: Get only - :type: :struct:`Vector` - - The vector giving the total burn of the node. The vector can be used to steer with, and its magnitude is the delta V of the burn. - -.. attribute:: ManeuverNode:BURNVECTOR - - Alias for :attr:`ManeuverNode:DELTAV`. - -.. attribute:: ManeuverNode:ETA - - :access: Get/Set - :type: scalar - - The number of seconds until the expected burn time. If you SET this, it will actually move the maneuver node along the path in the map view, identically to grabbing the maneuver node and dragging it. - -.. attribute:: ManeuverNode:PROGRADE - - :access: Get/Set - :type: scalar - - The delta V in (meters/s) along just the prograde direction (the yellow and green 'knobs' of the maneuver node). A positive value is a prograde burn and a negative value is a retrograde burn. - -.. attribute:: ManeuverNode:RADIALOUT - - :access: Get/Set - :type: scalar - - The delta V in (meters/s) along just the radial direction (the cyan knobs' of the maneuver node). A positive value is a radial out burn and a negative value is a radial in burn. - -.. attribute:: ManeuverNode:NORMAL - - :access: Get/Set - :type: scalar - - The delta V in (meters/s) along just the normal direction (the purple knobs' of the maneuver node). A positive value is a normal burn and a negative value is an anti-normal burn. - -.. attribute:: ManeuverNode:ORBIT - - :access: Get only - :type: :struct:`Orbit` - - The new orbit patch that will begin starting with the burn of this node, under the assumption that the burn will occur exactly as planned. - - - diff --git a/_sources/structures/vessels/part.txt b/_sources/structures/vessels/part.txt deleted file mode 100644 index ca11234b8..000000000 --- a/_sources/structures/vessels/part.txt +++ /dev/null @@ -1,220 +0,0 @@ -.. _part: - -Part -==== - -These are the generic properties every PART has. You can obtain a list of values of type Part using the :ref:`LIST PARTS command `. - -.. structure:: Part - - .. list-table:: Members - :header-rows: 1 - :widths: 1 1 2 - - * - Suffix - - Type - - Description - - * - :attr:`NAME` - - string - - Name of this part - * - :attr:`TITLE` - - string - - Title as it appears in KSP - * - :attr:`TAG` - - string - - Name-tag if assigned by the player - * - :attr:`CONTROLFROM` - - boolean - - Set control-from to this part - * - :attr:`STAGE` - - scalar - - The stage this is associated with - * - :attr:`UID` - - scalar - - Unique identifying number - * - :attr:`ROTATION` - - :struct:`Direction` - - The rotation of this part's :math:`x`-axis - * - :attr:`POSITION` - - :struct:`Vector` - - The location of this part in the universe - * - :attr:`FACING` - - :struct:`Direction` - - the direction that this part is facing - * - :attr:`RESOURCES` - - :struct:`List` - - list of the :struct:`Resource` in this part - * - :attr:`TARGETABLE` - - boolean - - true if this part can be selected as a target - * - :attr:`SHIP` - - :struct:`Vessel` - - the vessel that contains this part - * - :meth:`GETMODULE(name)` - - :struct:`PartModule` - - Get one of the :struct:`PartModules ` by name - * - :attr:`MODULES` - - :struct:`List` - - Names (string) of all :struct:`PartModules ` - * - :attr:`ALLMODULES` - - :struct:`List` - - Same as :attr:`MODULES` - * - :attr:`PARENT` - - :struct:`Part` - - Adjacent :struct:`Part` on this :struct:`Vessel`. - * - :attr:`HASPARENT` - - boolean - - Check if this part has a parent :struct:`Part` - * - :attr:`CHILDREN` - - :struct:`List` - - List of attached :struct:`Parts ` - - - - -.. attribute:: Part:NAME - - :access: Get only - :type: string - - Name of part as it is used behind the scenes in the game's API code. - - A part's *name* is the name it is given behind the scenes in KSP. It never appears in the normal GUI for the user to see, but it is used in places like Part.cfg files, the saved game persistence file, the ModuleManager mod, and so on. - -.. attribute:: Part:TITLE - - :access: Get only - :type: string - - The title of the part as it appears on-screen in the gui. - - A part's *title* is the name it has inside the GUI interface on the screen that you see as the user. - -.. attribute:: Part:TAG - - :access: Get only - :type: string - - The name tag value that may exist on this part if you have given the part a name via the :ref:`name-tag system `. - - A part's *tag* is whatever custom name you have given it using the :ref:`name-tag system described here `. This is probably the best naming convention to use because it lets you make up whatever name you like for the part and use it to pick the parts you want to deal with in your script. - - This example assumes you have a target vessel picked, and that the target vessel is loaded into full-physics range and not "on rails". vessels that are "on rails" do not have their full list of parts entirely populated at the moment:: - - LIST PARTS FROM TARGET IN tParts. - - PRINT "The target vessel has a". - PRINT "partcount of " + tParts:LENGTH. - - SET totTargetable to 0. - FOR part in tParts { - IF part:TARGETABLE { - SET totTargetable TO totTargetable + 1. - } - } - - PRINT "...and " + totTargetable. - PRINT " of them are targetable parts.". - -.. attribute:: Part:CONTROLFROM - - :access: Get only - :type: boolean - - Set to TRUE to cause the game to do the same thing as when you right-click a part on a vessel and select "control from here" on the menu. It rotates the control orientation so that fore/aft/left/right/up/down now match the orientation of this part. NOTE that this will not work for every type of part. It only works for those parts that KSP itself allows this for (control cores and docking ports). - -.. attribute:: Part:STAGE - - :access: Get only - :type: scalar - - the stage this part is part of. - -.. attribute:: Part:UID - - :access: Get only - :type: scalar - - All parts have a unique ID number. Test if two parts are the same part by seeing if this is the same between them. - -.. attribute:: Part:ROTATION - - :access: Get only - :type: :struct:`Direction` - - The rotation of this part's X-axis, which points out of its side and is probably not what you want. You probably want the :attr:`Part:FACING` suffix instead. - -.. attribute:: Part:POSITION - - :access: Get only - :type: :struct:`Vector` - - The location of this part in the universe. It is expressed in the same frame of reference as all the other positions in kOS, and thus can be used to help do things like navigate toward the position of a docking port. - -.. attribute:: Part:FACING - - :access: Get only - :type: :struct:`Direction` - - the direction that this part is facing. - -.. attribute:: Part:RESOURCES - - :access: Get only - :type: :struct:`List` - - list of the :struct:`Resource` in this part. - -.. attribute:: Part:TARGETABLE - - :access: Get only - :type: boolean - - true if this part can be selected by KSP as a target. - -.. attribute:: Part:SHIP - - :access: Get only - :type: :struct:`Vessel` - - the vessel that contains this part. - -.. method:: Part:GETMODULE(name) - - :parameter name: (string) Name of the part module - :returns: :struct:`PartModule` - - Get one of the :struct:`PartModules ` attached to this part, given the name of the module. (See :attr:`Part:MODULES` for a list of all the names available). - -.. attribute:: Part:MODULES - - :access: Get only - :type: :struct:`List` of strings - - list of the names of :struct:`PartModules ` enabled for this part. - -.. attribute:: Part:ALLMODULES - - Same as :attr:`Part:MODULES` - -.. attribute:: Part:PARENT - - :access: Get only - :type: :struct:`Part` - - When walking the :ref:`tree of parts `, this is the part that this part is attached to on the way "up" toward the root part. - -.. attribute:: Part:HASPARENT - - :access: Get only - :type: boolean - - When walking the :ref:`tree of parts `, this is true as long as there is a parent part to this part, and is false if this part has no parent (which can only happen on the root part). - -.. attribute:: Part:CHILDREN - - :access: Get only - :type: :struct:`List` of :struct:`Parts ` - - When walking the :ref:`tree of parts `, this is all the parts that are attached as children of this part. It returns a list of zero length when this part is a "leaf" of the parts tree. diff --git a/_sources/structures/vessels/partmodule.txt b/_sources/structures/vessels/partmodule.txt deleted file mode 100644 index d1010394d..000000000 --- a/_sources/structures/vessels/partmodule.txt +++ /dev/null @@ -1,199 +0,0 @@ -.. partmodule: - -PartModule -========== - -Almost everything done with at right-click menus and action group action can be accessed via the :struct:`PartModule` objects that are attached to :struct:`Parts ` of a :struct:`Vessel`. - -The exact arrangement of :struct:`PartModule` to :struct:`Parts ` to :struct:`Vessels `, and how to make use of a :struct:`PartModule` is a complex enough topic to warrant its own separate subject, described on the :ref:`Ship parts and Modules ` page. If you have not read that page, it is recommended that you do so before using :struct:`PartModules `. The page you are reading now is meant as just a reference summary, not a tutorial. - -Once you have a :struct:`PartModule`, you can use it to invoke the behaviors that are connected to its right-click menu and to its action groups. - - -.. structure:: PartModule - - .. list-table:: Members - :header-rows: 1 - :widths: 2 1 4 - - * - Suffix - - Type - - Description - - * - :attr:`NAME` - - string - - Name of this part module - * - :attr:`PART` - - :struct:`Part` - - :struct:`Part` attached to - * - :attr:`ALLFIELDS` - - :struct:`List` of strings - - Accessible fields - * - :attr:`ALLEVENTS` - - :struct:`List` of strings - - Triggerable events - * - :attr:`ALLACTIONS` - - :struct:`List` of strings - - Triggerable actions - * - :meth:`GETFIELD(name)` - - - - Get value of a field by name - * - :meth:`SETFIELD(name,value)` - - - - Set value of a field by name - * - :meth:`DOEVENT(name)` - - - - Trigger an event button - * - :meth:`DOACTION(name,bool)` - - - - Activate action by name with True or False - * - :meth:`HASFIELD(name)` - - boolean - - Check if field exists - * - :meth:`HASEVENT(name)` - - boolean - - Check if event exists - * - :meth:`HASACTION(name)` - - boolean - - Check if action exists - - - - -.. attribute:: PartModule:NAME - - :access: Get only - :test: string - - Get the name of the module. Note that it's the same as the name given in the MODULE section of the Part.cfg file for the part. - -.. attribute:: PartModule:PART - - :access: Get only - :test: :struct:`Part` - - Get the :struct:`Part` that this PartModule is attached to. - -.. attribute:: PartModule:ALLFIELDS - - :access: Get only - :test: :struct:`List` of strings - - Get a list of all the names of KSPFields on this PartModule that the kos script is CURRENTLY allowed to get or set with :GETFIELD or :SETFIELD. Note the Security access comments below. This list can become obsolete as the game continues running depending on what the PartModule chooses to do. - -.. attribute:: PartModule:ALLEVENTS - - :access: Get only - :test: :struct:`List` of strings - - Get a list of all the names of KSPEvents on this PartModule that the kos script is CURRENTLY allowed to trigger with :DOEVENT. Note the Security access comments below. This list can become obsolete as the game continues running depending on what the PartModule chooses to do. - -.. attribute:: PartModule:ALLACTIONS - - :access: Get only - :test: :struct:`List` of strings - - Get a list of all the names of KSPActions on this PartModule that the kos script is CURRENTLY allowed to trigger with :DOACTION. Note the Security access comments below. - -.. method:: PartModule:GETFIELD(name) - - :parameter name: (string) Name of the field - :return: varies - - Get the value of one of the fields that this PartModule has placed onto the rightclick menu for the part. Note the Security comments below. - -.. method:: PartModule:SETFIELD(name,value) - - :parameter name: (string) Name of the field - - Set the value of one of the fields that this PartModule has placed onto the rightclick menu for the part. Note the Security comments below. - -.. method:: PartModule:DOEVENT(name) - - :parameter name: (string) Name of the event - - Trigger an "event button" that is on the rightclick part menu at the moment. Note the Security comments below. - -.. method:: PartModule:DOACTION(name,bool) - - :parameter name: (string) Name of the action - :parameter bool: (boolean) Value to set: True or False - - Activate one of this PartModule's action-group-able actions, bypassing the action group system entirely by just activating it for this one part directly. The boolean value decides whether you are toggling the action ON or toggling it OFF. Note the Security comments below. - -.. method:: PartModule:HASFIELD(name) - - :parameter name: (string) Name of the field - :return: boolean - - Return true if the given field name is currently available for use with :GETFIELD or :SETFIELD on this PartModule, false otherwise. - -.. method:: PartModule:HASEVENT(name) - - :parameter name: (string) Name of the event - :return: boolean - - Return true if the given event name is currently available for use with :DOEVENT on this PartModule, false otherwise. - -.. method:: PartModule:HASACTION(name) - - :parameter name: (string) Name of the action - :return: boolean - - Return true if the given action name is currently available for use with :DOACTION on this PartModule, false otherwise. - - - -Notes ------ - -In all the above cases where there is a name being passed in to :GETFIELD, :SETFIELD, :DOEVENT, or :DOACTION, the name is meant to be the name that is seen by you, the user, in the GUI screen, and NOT necessarily the actual name of the variable that the programmer of that PartModule chose to call the value behind the scenes. This is so that you can view the GUI rightclick menu to see what to call things in your script. - -.. note:: - - **Security and Respecting other Mod Authors** - - There are often a lot more fields and events and actions that a partmodule can do than are usable via kOS. In designing kOS, the kOS developers have deliberately chosen NOT to expose any "hidden" fields of a partmodule that are not normally shown to the user, without the express permission of a mod's author to do so. - -The access rules that kOS uses are as follows: - -KSPFields -~~~~~~~~~ - -Is this a value that the user can normally see on the right-click context menu for a part? If so, then let kOS scripts GET the value. Is this a value that the user can normally manipulate via "tweakable" adjustments on the right-click context menu for a part, AND, is that tweakable a CURRENTLY enabled one? If so, then let KOS scripts SET the value, BUT they must set it to one of the values that the GUI would normally allow, according to the following rules. - -- If the KSPField is boolean: - - The value must be true, false, or 0 or 1. - -- If the KSPField is an integer: - - The value must be a whole number. - -- If the KSPField is a floating point sliding number: - - The GUI for this field will be defined as a slider with a min value, a max value, with a fixed increment interval where the detents are. When setting such a value, you will be constrained to the limits of this slider. For example: If a slider is defined to have a minimum value of 2.0, a maximum value of 5.0, and a minimum allowed delta increment of 0.1: - - - If you try to set it to 0, it will instead become 2, the minimum allowed value. If you try to set it to 9, it will instead become 5, the maximum allowed value. If you try to set it to 3.14159, it will instead become 3.1, because that's rounding to the nearest increment step the slider supports. - -- If the KSPField is a string: - - There is currently no way to set these because kOS uses the existence of a gui tweakable as "proof" that it's okay to modify the field, and in the stock game there are no gui tweakables for string fields. This may change in the future if mods that extend the tweakables system are taken into account. - -KSPEvents -~~~~~~~~~ - -Is this an event that has a GUI button associated with it that is currently visible on the right-click menu? If the answer is yes, then it will also be triggerable by kOSScripts, otherwise it won't. - -KSPActions -~~~~~~~~~~ - -Is this an action that the KSP user would have been allowed to set as part of an action group during building in the VAB or SPH? If so, then allow a kOS script to use it, EVEN IF it has never actually been added to an action group for this vessel. - -.. note:: - - **If a KSPField, KSPEvent, or KSPAction has been disallowed, often in kOS it won't even appear to be a field of the PartModule at all.** - - This is necessary because for some modules, the number of fields you can use are far outnumberd by the number of fields that exist but are normally hidden from view. It would become unworkable if all of the unusable ones were exposed to kOS scripts to see as fields. - -.. note:: - - **Which KSPFields, KSPEvents, and KSPActions exist on a PartModule can change during runtime!** - - A PartModule is allowed to change the look and feel of its rightclick menu fields on the fly as the game runs. Therefore a field that didn't exist the last time you looked might now exist, and might not exist again next time. The list of what fields exist is context dependant. For example, a docking port may have an event button on it called "Undock Node", that only exists when that port is connected to another port. If it's not connected, the button may be gone. Similarly, a PartModule might toggle something by using a pair of two events that swap in and out depending on the current state. For example, many of the stock lights in the game have a "Turn on" button that after it's been clicked, gets replaced with a "Turn off" button until it's clicked again. A boolean toggle with a KSPFIeld would be simpler, but until "tweakables" existed in the main game, that wasn't an option so a lot of older Partmodules still do things the old way with two KSPEvents that swap in and out. diff --git a/_sources/structures/vessels/resource.txt b/_sources/structures/vessels/resource.txt deleted file mode 100644 index fe5e2aecb..000000000 --- a/_sources/structures/vessels/resource.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _resource: - -Resource -======== - -A single resource value a thing holds (i.e. fuel, electric charge, etc). This is the type returned as the elements of the list in :ref:`LIST RESOURCES -IN MyList `:: - - PRINT "THESE ARE ALL THE RESOURCES ON THE SHIP:". - LIST RESOURCES IN RESLIST. - FOR RES IN RESLIST { - PRINT "Resource " + RES:NAME. - PRINT " value = " + AMOUNT. - PRINT " which is " - + ROUND(100*RES:AMOUNT/RES:CAPACITY) - + "% full.". - }. - - -.. structure:: Resource - - .. list-table:: - :header-rows: 1 - :widths: 2 1 4 - - * - Suffix - - Type - - Description - - * - :attr:`NAME` - - string - - Resource name - * - :attr:`AMOUNT` - - scalar - - Amount of this resource left - * - :attr:`CAPACITY` - - scalar - - Maximum amount of this resource - -.. attribute:: Resource:NAME - - :access: Get only - :type: string - - The name of the resource, i.e. "LIQUIDFUEL", "ELECTRICCHARGE", "MONOPROP". - -.. attribute:: Resource:AMOUNT - - :access: Get only - :type: scalar - - The value of how much resource is left. - -.. attribute:: Resource:CAPACITY - - :access: Get only - :type: scalar - - What AMOUNT would be if the resource was filled to the top. - diff --git a/_sources/structures/vessels/sensor.txt b/_sources/structures/vessels/sensor.txt deleted file mode 100644 index bbad06b8a..000000000 --- a/_sources/structures/vessels/sensor.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _sensor: - -Sensor -====== - -The type of structures returned by :ref:`LIST SENSORS IN SOMEVARIABLE `. This is not fully understood because the type of :struct:`PartModule` in the KSP API called ``ModuleEnviroSensor``, which all Sensors are a kind of, is not well documented. Here is an example of using :struct:`Sensor`:: - - PRINT "Full Sensor Dump:". - LIST SENSORS IN SENSELIST. - - // TURN EVERY SINGLE SENSOR ON - FOR S IN SENSELIST { - PRINT "SENSOR: " + S:TYPE. - PRINT "VALUE: " + S:READOUT. - IF S:ACTIVE { - PRINT " SENSOR IS ALREADY ON.". - } ELSE { - PRINT " SENSOR WAS OFF. TURNING IT ON.". - S:TOGGLE(). - } - } - -.. structure:: Sensor - - .. list-table:: - :header-rows: 1 - :widths: 2 1 4 - - * - Suffix - - Type - - Description - - * - All suffixes of :struct:`Part` - - - - :struct:`Sensor` objects are a type of :struct:`Part` - * - :attr:`ACTIVE` - - boolean - - Check if this sensor is active - * - :attr:`TYPE` - - - - - * - :attr:`READOUT` - - varies - - Value of the readout - * - :attr:`POWERCONSUMPTION` - - scalar - - Rate of required electric charge - * - :meth:`TOGGLE()` - - - - Call to activate/deactivate - -.. note:: - - A :struct:`Sensor` is a type of :struct:`Part`, and therefore can use all the suffixes of :struct:`Part`. - -.. attribute:: Sensor:ACTIVE - - :access: Get only - :type: boolean - - True of the sensor is enabled. Can SET to cause the sensor to activate or de-activate. - -.. attribute:: Sensor:TYPE - - :access: Get only - -.. attribute:: Sensor:READOUT - - :access: Get only - :type: varies (usually scalar) - - The value of the sensor's readout, usually a double. - -.. attribute:: Sensor:POWERCONSUMPTION - - :access: Get only - :type: scalar - - The rate at which this sensor drains ElectricCharge. - -.. method:: Sensor:TOGGLE() - - Call this method to cause the sensor to switch between active and deactivated or visa versa. - - diff --git a/_sources/structures/vessels/vessel.txt b/_sources/structures/vessels/vessel.txt deleted file mode 100644 index 604b18522..000000000 --- a/_sources/structures/vessels/vessel.txt +++ /dev/null @@ -1,242 +0,0 @@ -.. _vessel: - -Vessel -====== - -All vessels share a structure. To get a variable referring to any vessel you can do this:: - - // Get a vessel by it's name. - // The name is Case Sensitive. - SET MY_VESS TO VESSEL("Some Ship Name"). - - // Save the current vessel in a variable, - // in case the current vessel changes. - SET MY_VESS TO SHIP. - - // Save the target vessel in a variable, - // in case the target vessel changes. - SET MY_VESS TO TARGET. - -.. note:: - - .. versionadded:: 0.13 - - A vessel is now a type of :struct:`Orbitable`. Much of what a Vessel can do can now by done by any orbitable object. The documentation for those abilities has been moved to the :ref:`orbitable page `. - - -.. structure:: Vessel - - ===================================== ========================= ============= - Suffix Type Description - ===================================== ========================= ============= - Every suffix of :struct:`Orbitable` - ----------------------------------------------------------------------------- - :attr:`CONTROL` :struct:`Control` Raw flight controls - :attr:`BEARING` scalar (deg) relative heading to this vessel - :attr:`HEADING` scalar (deg) Absolute heading to this vessel - :attr:`MAXTHRUST` scalar Sum of active maximum thrusts - :attr:`FACING` :struct:`Direction` The way the vessel is pointed - :attr:`MASS` scalar (metric tons) Mass of the ship - :attr:`VERTICALSPEED` scalar (m/s) How fast the ship is moving "up" - :attr:`SURFACESPEED` scalar (m/s) How fast the ship is moving "horizontally" - :attr:`AIRSPEED` scalar (m/s) How fast the ship is moving relative to the air - :attr:`TERMVELOCITY` scalar (m/s) terminal velocity of the vessel - :attr:`VESSELNAME` string The name of the vessel - :attr:`ANGULARMOMENTUM` :struct:`Vector` In :ref:`SHIP_RAW ` - :attr:`ANGULARVEL` :struct:`Vector` In :ref:`SHIP_RAW ` - :attr:`SENSORS` :struct:`VesselSensors` Sensor data - :attr:`LOADED` Boolean loaded into KSP physics engine or "on rails" - :attr:`PATCHES` :struct:`List` :struct:`Orbit` patches - :attr:`ROOTPART` :struct:`Part` Root :struct:`Part` of this vessel - :attr:`PARTS` :struct:`List` all :struct:`Parts ` - :meth:`PARTSNAMED(name)` :struct:`List` :struct:`Parts ` by :attr:`NAME ` - :meth:`PARTSTITLED(title)` :struct:`List` :struct:`Parts ` by :attr:`TITLE ` - :meth:`PARTSTAGGED(tag)` :struct:`List` :struct:`Parts ` by :attr:`TAG ` - :meth:`PARTSDUBBED(name)` :struct:`List` :struct:`Parts ` by :attr:`NAME `, :attr:`TITLE ` or :attr:`TAG ` - :meth:`MODULESNAMED(name)` :struct:`List` :struct:`PartModules ` by :attr:`NAME ` - :meth:`PARTSINGROUP(group)` :struct:`List` :struct:`Parts ` by action group - :meth:`MODULESINGROUP(group)` :struct:`List` :struct:`PartModules ` by action group - :meth:`ALLPARTSTAGGED()` :struct:`List` :struct:`Parts ` that have non-blank nametags - ===================================== ========================= ============= - -.. attribute:: Vessel:CONTROL - - :type: :struct:`Control` - :access: Get only - - The structure representing the raw flight controls for the vessel. - -.. attribute:: Vessel:BEARING - - :type: scalar - :access: Get only - - *relative* compass heading (degrees) to this vessel from the `CPU Vessel <../../summary_topics/CPU_Vessel/index.html>`__, taking into account the CPU Vessel's own heading. - -.. attribute:: Vessel:HEADING - - :type: scalar - :access: Get only - - *absolute* compass heading (degrees) to this vessel from the `CPU Vessel <../../summary_topics/CPU_Vessel/index.html>`__ - -.. attribute:: Vessel:MAXTHRUST - - :type: scalar - :access: Get only - - Sum of all the Max thrust of all the currently active engines In Kilonewtons. - -.. attribute:: Vessel:FACING - - :type: :struct:`Direction` - :access: Get only - - The way the vessel is pointed. - -.. attribute:: Vessel:MASS - - :type: scalar (metric tons) - :access: Get only - - The mass of the ship - -.. attribute:: Vessel:VERTICALSPEED - - :type: scalar (m/s) - :access: Get only - - How fast the ship is moving. in the "up" direction relative to the SOI Body's sea level surface. - -.. attribute:: Vessel:SURFACESPEED - - :type: scalar (m/s) - :access: Get only - - How fast the ship is moving in the plane horizontal to the SOI body's sea level surface. - -.. attribute:: Vessel:AIRSPEED - - :type: scalar (m/s) - :access: Get only - - How fast the ship is moving relative to the air. KSP models atmosphere as simply a solid block of air "glued" to the planet surface (the weather on Kerbin is boring and there's no wind). Therefore airspeed is generally the same thing as as the magnitude of the surface velocity. - -.. attribute:: Vessel:TERMVELOCITY - - :type: scalar (m/s) - :access: Get only - - terminal velocity of the vessel in freefall through atmosphere, based on the vessel's current altitude above sea level, and its drag properties. Warning, can cause values of Infinity if used in a vacuum, and kOS sometimes does not let you store Infinity in a variable. - -.. attribute:: Vessel:VESSELNAME - - :type: string - :access: Get only - - The name of the vessel as it appears in the tracking station. - -.. attribute:: Vessel:ANGULARMOMENTUM - - :type: :struct:`Direction` - :access: Get only - - Given in :ref:`SHIP_RAW ` reference frame. *As of* ``kOS 0.15.4`` *this has been changed to a vector, as it should have been all along.* The vector represents the axis of the rotation, and its magnitude is the angular momentum of the rotation, which varies not only with the speed of the rotation, but also with the angular inertia of the vessel. - -.. attribute:: Vessel:ANGULARVEL - - :type: :struct:`Direction` - :access: Get only - - Given in :ref:`SHIP_RAW ` reference frame. *As of* ``kOS 0.15.4`` *this has been changed to a vector, as it should have been all along.* The vector represents the axis of the rotation, and its magnitude is the speed of that rotation (Presumably in degrees per second? This is not documented in the KSP API and may take some experimentation to discover if it's radians or degrees). - -.. attribute:: Vessel:SENSORS - - :type: :struct:`VesselSensors` - :access: Get only - - Structure holding summary information of sensor data for the vessel - -.. attribute:: Vessel:LOADED - - :type: Boolean - :access: Get only - - true if the vessel is fully loaded into the complete KSP physics engine (false if it's "on rails"). - -.. attribute:: Vessel:PATCHES - - :type: :struct:`List` - :access: Get only - - The list of `orbit patches <../orbit/index.html>`__ that describe this vessel's current travel path based on momentum alone with no thrusting changes. If the current path has no transitions to other bodies, then this will be a list of only one orbit. If the current path intersects other bodies, then this will be a list describing the transitions into and out of the intersecting body's sphere of influence. SHIP:PATCHES[0] is always exactly the same as SHIP:OBT, SHIP:PATCHES[1] is the same as SHIP:OBT:NEXTPATCH, SHIP:PATCHES[2] is the same as SHIP:OBT:NEXTPATCH:NEXTPATCH, and so on. Note that you will only see as far into the future as your KSP settings allow. (See the setting CONIC\_PATCH\_LIMIT in your settings.cfg file) - -.. attribute:: Vessel:ROOTPART - - :type: :struct:`Part` - :access: Get only - - The first `part <../part/index.html>`__ that was used to begin the ship design - the command core. Vessels in KSP are built in a tree-structure, and the first part that was placed is the root of that tree. - -.. attribute:: Vessel:PARTS - - :type: :struct:`List` of :struct:`Part` objects - :access: Get only - - A List of all the `parts <../part/index.html>`__ on the vessel. SET FOO TO SHIP:PARTS has exactly the same effect as LIST PARTS IN FOO. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - - -.. method:: Vessel:PARTSNAMED(name) - - :parameter name: (string) Name of the parts - :return: :struct:`List` of :struct:`Part` objects - - Part:NAME. The matching is done case-insensitively. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:PARTSTITLED(title) - - :parameter title: (string) Title of the parts - :return: :struct:`List` of :struct:`Part` objects - - Part:TITLE. The matching is done case-insensitively. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:PARTSTAGGED(tag) - - :parameter tag: (string) Tag of the parts - :return: :struct:`List` of :struct:`Part` objects - - Part:TAG value. The matching is done case-insensitively. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:PARTSDUBBED(name) - - :parameter name: (string) name, title or tag of the parts - :return: :struct:`List` of :struct:`Part` objects - - name regardless of whether that name is the Part:Name, the Part:Tag, or the Part:Title. It is effectively the distinct union of :PARTSNAMED(val), :PARTSTITLED(val), :PARTSTAGGED(val). The matching is done case-insensitively. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:MODULESNAMED(name) - - :parameter name: (string) Name of the part modules - :return: :struct:`List` of :struct:`PartModule` objects - - match the given name. The matching is done case-insensitively. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:PARTSINGROUP(group) - - :parameter group: (integer) the action group number - :return: :struct:`List` of :struct:`Part` objects - - one action triggered by the given action group. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:MODULESINGROUP(group) - - :parameter group: (integer) the action group number - :return: :struct:`List` of :struct:`PartModule` objects - - have at least one action triggered by the given action group. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ - -.. method:: Vessel:ALLPARTSTAGGED() - - :return: :struct:`List` of :struct:`Part` objects - - nametag on them of any sort that is nonblank. For more information, see `ship parts and modules <../../summary_topics/ship_parts_and_modules/index.html>`__ diff --git a/_sources/structures/vessels/vesselsensors.txt b/_sources/structures/vessels/vesselsensors.txt deleted file mode 100644 index 2218d3253..000000000 --- a/_sources/structures/vessels/vesselsensors.txt +++ /dev/null @@ -1,78 +0,0 @@ -VesselSensors -============= - -When you ask a Vessel to tell you its :attr:`Vessel:SENSORS` suffix, it returns an object of this type. It is a snapshot of sensor data taken at the moment the sensor reading was requested. - -.. note:: - - These values are only enabled if you have the proper type of sensor on board the vessel. If you don't have a thermometer, for example, then the :attr:`:TEMP ` suffix will always read zero. - -If you store this in a variable and wait, the numbers are frozen in time and won't change as the vessel's condition changes. - -.. structure:: VesselSensors - - .. warning:: - - **BUG** - - This information is currenlty being read from the Active Vessel even when the Active Vessel is not the :ref:`CPU Vessel `. This comment will be removed when that bug is fixed. - - .. list-table:: Members - :header-rows: 1 - :widths: 1 1 3 - - * - Suffix - - Type - - Description - * - :attr:`ACC` - - :struct:`Vector` - - Acceleration experienced by the :struct:`Vessel` - * - :attr:`PRES` - - scalar - - Atmospheric Pressure outside this :struct:`Vessel` - * - :attr:`TEMP` - - scalar - - Temperature outside this :struct:`Vessel` - * - :attr:`GRAV` - - :struct:`Vector` (g's) - - Gravitational acceleration - * - :attr:`LIGHT` - - scalar - - Sun exposure on the solar panels of this :struct:`Vessel` - - -.. attribute:: VesselSensors:ACC - - :access: Get only - :type: :struct:`Vector` - - Accelleration the vessel is undergoing. A combination of both the gravitational pull and the engine thrust. - -.. attribute:: VesselSensors:PRES - - :access: Get only - :type: scalar - - The current pressure of this ship. - -.. attribute:: VesselSensors:TEMP - - :access: Get only - :type: scalar - - The current temperature. - -.. attribute:: VesselSensors:GRAV - - :access: Get only - :type: :struct:`Vector` - - Magnitude and direction of gravity acceleration where the vessel currently is. Magnitude is expressed in "G"'s (multiples of 9.802 m/s^2). - -.. attribute:: VesselSensors:LIGHT - - :access: Get only - :type: scalar - - The total amount of sun exposure that exists here - only readable if there are solar panels on the vessel. - diff --git a/_sources/tutorials.txt b/_sources/tutorials.txt deleted file mode 100644 index eb8fa269e..000000000 --- a/_sources/tutorials.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _tutorials: - -Tutorials -========= - -If you prefer the tutorial style of explanation, please see the following examples that walk you through examples: - -.. toctree:: - :hidden: - - Quick Start - Design Patterns - PID Loops - -Introductory ------------- - -:doc:`Quick Start Tutorial ` - Walks you through the beginnings of making a beginner's ship launcher script. - -Intermediate ------------- - -:doc:`Design Patterns Tutorial ` - Discusses some general aspects of kOS flow control and optimizations. - -:doc:`PID Loop Tutorial ` - Starts with a basic proportional feedback loop and develops, in stages, a complete PID-loop to control the throttle of a simple rocket design. diff --git a/_sources/tutorials/designpatterns.txt b/_sources/tutorials/designpatterns.txt deleted file mode 100644 index c4da06dca..000000000 --- a/_sources/tutorials/designpatterns.txt +++ /dev/null @@ -1,255 +0,0 @@ -.. _designpatterns: - -Design Patterns and Considerations with kOS -=========================================== - -There are many ways one can write a control program for a given scenario. The goal of this section is to help a novice kOS programmer, after having finished the :ref:`Quick Start Tutorial `, to develop a sense of elegance and capability when writing his or her own kOS scripts. All of the examples in this tutorial may be tested by the reader using a rocket design similar to the following. Notice it carries an `accelerometer`_ and the `negative gravioli detector`_ which are used in the second section. Don't forget the kOS module as well! - -.. _accelerometer: http://wiki.kerbalspaceprogram.com/wiki/Double-C_Seismic_Accelerometer -.. _negative gravioli detector: http://wiki.kerbalspaceprogram.com/wiki/GRAVMAX_Negative_Gravioli_Detector - -.. figure:: /_images/tutorials/designpatterns/designpatterns_rocket.png - -.. contents:: Contents - :local: - :depth: 2 - -The Major Design Patterns of kOS Control Programs -------------------------------------------------- - -The design of a program is usually determined by the flow-control statements used. I.e., the WHEN/THEN, ON, WAIT, UNTIL, IF and FOR constructs. Here is a list of the major styles of control programs that can be written in kOS: - -1. Sequential -2. Loops with Condition Checking -3. Loops with Triggers - -Of course, one style does not fit all scenarios and the programmer will typically want to use a combination of these all at once. Also, there may be other design patterns not listed here which can be perfectly valid, but this is a start. - -1. Sequential Programs -^^^^^^^^^^^^^^^^^^^^^^ - -These are programs that rely almost exclusively on WAIT UNTIL statements to go from one phase to the next. - -:: - - LOCK STEERING TO HEADING(0,90). - LOCK THROTTLE TO 1. - STAGE. - WAIT UNTIL SHIP:ALTITUDE > 10000. - LOCK STEERING TO HEADING(0,90) + R(0,-45,0). - WAIT UNTIL STAGE:LIQUIDFUEL < 0.1. - STAGE. - WAIT UNTIL SHIP:ALTITUDE > 20000. - LOCK THROTTLE TO 0. - WAIT UNTIL FALSE. // CTRL+C to break out - -This example will take a two stage rocket up to 20km. The immediate thing to notice is that the programmer must have known that the first stage would cutoff between 10km and 20km. This is fine for a specific rocket but not too general and could end in disaster if the first stage cutoff occurs at say 5km. Certainly, one can write a program using this technique to take a specific rocket, put it into orbit and even perform a lot of fancy maneuvers, but adapting the code to different rockets may get complicated quickly. - -2. Loops with Condition Checking -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Here, we introduce IF/ELSE logic into UNTIL loops: - -:: - - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - LOCK THROTTLE TO 1. - STAGE. - UNTIL SHIP:ALTITUDE > 20000 { - IF SHIP:ALTITUDE > 10000 { - LOCK STEERING TO R(0,0,-90) + HEADING(90,45). - } - IF STAGE:LIQUIDFUEL < 0.1 { - STAGE. - } - } - LOCK THROTTLE TO 0. - WAIT UNTIL FALSE. - -This does the same thing as the previous example, but now it's checking for a staging condition from the launch pad all the way to 20km. More than that, it will stage as many times as needed. - -One can imagine that these types of UNTIL loops can become very complex with many layers of IF/ELSE blocks. Once this happens it is usually good to reduce the frequency of the loop by adding a WAIT statement at the end of the loop. This wait could be anywhere from 0.001 (every physics tick), to 60 (every minute) or even longer for inter-planetary transfers if desired. - -3. Loops with Triggers -^^^^^^^^^^^^^^^^^^^^^^ - -In the above example, once the rocket reaches 10km, the steering is constantly being re-locked to HEADING(90,45). This works, but it only needs to be locked once. A possible improvement is to set up a trigger using a WHEN/THEN statement: - -:: - - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - LOCK THROTTLE TO 1. - STAGE. - WHEN SHIP:ALTITUDE > 10000 THEN { - LOCK STEERING TO R(0,0,-90) + HEADING(90,45). - } - UNTIL SHIP:ALTITUDE > 20000 { - IF STAGE:LIQUIDFUEL < 0.1 { - STAGE. - } - } - LOCK THROTTLE TO 0. - WAIT UNTIL FALSE. - -Now, when the rocket reaches 10km, the steering is set once and the trigger is removed from the active list of triggers. The staging condition can also be promoted to a trigger, keeping the trigger active after every stage using the PRESERVE keyword: - -:: - - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - LOCK THROTTLE TO 1. - STAGE. - WHEN SHIP:ALTITUDE > 10000 THEN { - LOCK STEERING TO R(0,0,-90) + HEADING(90,45). - } - WAIT UNTIL SHIP:ALTITUDE > 20000. - LOCK THROTTLE TO 0. - WAIT UNTIL FALSE. - -Notice that the UNTIL loop was changed to a WAIT UNTIL statement since the program is small and all the logic of the triggers can be handled in a reasonable amount of time - there will be more on this topic later. - -Bringing It All Together -^^^^^^^^^^^^^^^^^^^^^^^^ - -Typically, the programmer will find all of these constructs are useful at the same time and kOS scripts will naturally contain some sequential parts in combination with long-term and short-term triggers which can modify states in complex loops of varying frequency. If you didn't follow that bit of gobbledygook, don't worry. The next section will discuss a few recommendations for beginning kOS programmers to follow when setting up any program. - -General Guidelines for kOS Scripts ----------------------------------- - -This section discusses two general guidelines to follow when starting out with more complicated kOS scripts. These are not meant to be absolute and there will certainly be cases when they can be stretched, though one should never totally ignore them. - -1. Minimize Time Spent in WHEN/THEN Blocks -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Remember that WAIT statements are ignored when inside WHEN/THEN blocks. It is OK to loop over small lists (engines for example), but don't let it get out of hand. The WHEN/THEN construct was designed to accommodate quick bits of code. Consider this bit of (non-working) code which tries to adjust the throttle based on the g-force as measured by a combination of the accelerometer and the negative gravioli detector: - -:: - - SET thrott TO 1. - LOCK THROTTLE TO thrott. - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - STAGE. - WHEN SHIP:ALTITUDE > 1000 THEN { - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - LOCK dthrott TO 0.05 * (1.2 - gforce). - - UNTIL SHIP:ALTITUDE > 40000 { - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - SET thrott to thrott + dthrott. - WAIT 0.1. - } - } - -This looks reasonable. The throttle is set to maximum until 1km is reached at which point the throttle is adjusted every 0.1 seconds. If the gforce is off from the value of 1.2, then the throttle is either increased or decreased by a small amount. Running this on a test rocket merely produce the message "Program ended." - -Understanding why this does not work is important. Everything in a WHEN/THEN block is expected to complete in the current physics tick, but here we have a loop that is supposed to last until the ship reaches 40km. This example can be reworked by separating the triggers from the loop. The staging trigger was separated from the UNTIL loop as well - not strictly necessary, but recommended form: - -:: - - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - SET thrott TO 1. - SET dthrott TO 0. - LOCK THROTTLE TO thrott. - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - STAGE. - WHEN SHIP:ALTITUDE > 1000 THEN { - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - LOCK dthrott TO 0.05 * (1.2 - gforce). - } - UNTIL SHIP:ALTITUDE > 40000 { - SET thrott to thrott + dthrott. - WAIT 0.1. - } - -Now this program should work. The variable dthrott had to be set to 0 in the beginning so that the throttle is kept at maximum until 1km, the UNTIL loop operates every 0.1 seconds, and the WHEN/THEN triggers are run only once when the condition is met. The take-away from this example is to keep WHEN/THEN blocks separate from UNTIL loops. Specifically, never put an UNTIL loop inside a WHEN/THEN block and it should be extremely rare to put a WHEN/THEN statement inside an UNTIL loop. - -Finally, as a bit of foreshadowing, this bit of code is actually a "`proportional feedback loop `__." From an altitude of 1km up to 40km, the total g-force exerted on the ship is kept near 1.2 by constantly adjusting the throttle. The value of 1.2 is called the "setpoint," the measured g-force is called the "process variable," and the mystical 0.05 is called the "proportional gain." Please take a look at the `PID Loop Tutorial <../pidloop_tutorial/index.html>`__ which takes this script as a starting point and develops a full PID-loop in kOS. - -2. Minimize Trigger Conditions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -There is a lot of power in developing multi-level LOCK variables in combination with WHEN/THEN triggers. However, it can be easy to hit kOS's hard limit in the number of operations allowed for trigger checking. This will happen when several WHEN/THEN triggers are dependent on the same complex LOCK variable. This results in the LOCK variable being calculated multiple times every update. If the LOCK is deep enough, the calculations become too expensive to do and kOS stops executing and complains. - -With this in mind, consider an extension of the example script in the previous section. This time, the g-force setpoint changes as the rocket climbs through 10km, 20km and 30km: - -:: - - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - SET thrott TO 1. - SET dthrott TO 0. - LOCK THROTTLE TO thrott. - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - STAGE. - WHEN SHIP:ALTITUDE > 1000 THEN { - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - LOCK dthrott TO 0.05 * (1.2 - gforce). - } - WHEN SHIP:ALTITUDE > 10000 THEN { - LOCK dthrott TO 0.05 * (2.0 - gforce). - } - WHEN SHIP:ALTITUDE > 20000 THEN { - LOCK dthrott TO 0.05 * (4.0 - gforce). - } - WHEN SHIP:ALTITUDE > 30000 THEN { - LOCK dthrott TO 0.05 * (5.0 - gforce). - } - UNTIL SHIP:ALTITUDE > 40000 { - SET thrott to thrott + dthrott. - WAIT 0.1. - } - -This example does what is expected of it without problems. But the ship's altitude is being checked at least five times for every update, including the UNTIL loop check. Certaintly, the kOS CPU can keep up with this, however, one can imagine a whole series of WHEN/THEN statements which make use of complicated calculations based on atmospheric data or orbital mechanics. One way to minimize the trigger condition checking is to take strictly-sequential triggers and nest them: - -:: - - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - SET thrott TO 1. - SET dthrott TO 0. - LOCK THROTTLE TO thrott. - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - STAGE. - WHEN SHIP:ALTITUDE > 1000 THEN { - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - LOCK dthrott TO 0.05 * (1.2 - gforce). - - WHEN SHIP:ALTITUDE > 10000 THEN { - LOCK dthrott TO 0.05 * (2.0 - gforce). - - WHEN SHIP:ALTITUDE > 20000 THEN { - LOCK dthrott TO 0.05 * (4.0 - gforce). - - WHEN SHIP:ALTITUDE > 30000 THEN { - LOCK dthrott TO 0.05 * (5.0 - gforce). - } - } - } - } - UNTIL SHIP:ALTITUDE > 40000 { - SET thrott to thrott + dthrott. - WAIT 0.1. - } - -Now this is quite elegant! The number of triggers have been reduced to two per update for the entire running of this script. The trigger at 1km sets up the next trigger which will happen at 10km which sets up then next at 20km and so on. This can save a lot of processing time for triggers that will happen sequentially. As a general rule, one should try to nest WHEN/THEN statements whenever possible. Again, both examples above will work, but when scripts start to have deep and complicated triggers, this nested construct can save it from the dreaded kOS trigger limit. diff --git a/_sources/tutorials/pidloops.txt b/_sources/tutorials/pidloops.txt deleted file mode 100644 index 39d9f5cd4..000000000 --- a/_sources/tutorials/pidloops.txt +++ /dev/null @@ -1,329 +0,0 @@ -.. _pidloops: - -PID Loops in kOS -================ - -This tutorial covers how one can implement a `PID loop`_ using kOS. A P-loop, or "proportional feedback loop" was already introduced in the second section of the :ref:`Design Patterns Tutorial `, and that will serve as our starting point. After some code rearrangement, the integral and derivative terms will be added and discussed in turn. Next, a couple extra features will be added to the full PID-loop. Lastly, we'll show a case-study in tuning a full PID loop using the Ziegler-Nichols method. We'll use the LOG method to dump telemetry from KSP into a file and our favorite graphing software to visualize the data. - -.. _PID loop: http://en.wikipedia.org/wiki/PID_controller - -The code examples in this tutorial can be tested with a similar rocket design as shown. Do not forget the accelerometer, gravioli detector or the kOS CPU module. The engine is purposefully overpowered to demonstrate the feedback in action. - -.. figure:: /_images/tutorials/pidloops/pidtune_rocket_design_maxtwr8.png - -Those fuel-tank adapters are from the `Modular Rocket Systems (MRS) addon`_, but stock tanks will work just fine. The design goal of this rocket is to have a TWR of 8 on the launchpad and enough fuel to make it past 30km when throttled for optimal atmospheric efficiency. - -.. _Modular Rocket Systems (MRS) addon: https://kerbalstuff.com/mod/148/Modular%20Rocket%20Systems%20-%20Parts%20Pack - -.. contents:: Contents - :local: - :depth: 2 - -Proportional Feedback Loop (P-loop) ------------------------------------ - -The example code from the :ref:`Design Patterns Tutorial `, with some slight modifications looks like the following: - -:: - - // staging, throttle, steering, go - WHEN STAGE:LIQUIDFUEL < 0.1 THEN { - STAGE. - PRESERVE. - } - LOCK THROTTLE TO 1. - LOCK STEERING TO R(0,0,-90) + HEADING(90,90). - STAGE. - WAIT UNTIL SHIP:ALTITUDE > 1000. - - // P-loop setup - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - LOCK dthrott TO 0.05 * (1.2 - gforce). - - SET thrott TO 1. - LOCK THROTTLE to thrott. - - UNTIL SHIP:ALTITUDE > 40000 { - SET thrott to thrott + dthrott. - WAIT 0.1. - } - -The first several lines sets up a simple staging condition, puts the throttle to maximum, steers the rocket straight up and launches. The rocket is assumed to use only liquid fuel engines. After the rocket hits 1km, the script sets up the LOCK used in the P-loop which is updated every 0.1 seconds in the UNTIL loop. The use of LOCK variables makes this code fairly clean. When the script comes up to the first line in the UNTIL loop, i.e. "SET thrott TO thrott + dthrott.", the variable dthrott is evaluated which causes the LOCK on gforce to be evaluated which in-turn causes accvec to be evaluated. - -The input to this feedback loop is the acceleration experienced by the ship (gforce) in terms of Kerbin's gravitational acceleration at sea level (g). The variable accvec is the total acceleration vector and is obtained by the accelerometer and gravioli detectors, both of which must be on the ship for this to work. The variable dthrott is the change in throttle that should be applied in a single iteration of the feedback loop. - -In terms of a PID loop, the factor 1.2 is called the setpoint, gforce is the process variable and 0.05 is called the proportional gain. The setpoint and gain factors can be promoted to their own variables with names. Also, the code up to and including the "WAIT UNTIL SHIP:ALTITUDE > 1000." will be implied for the next few examples of code: - -:: - - // P-loop - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - - SET gforce_setpoint TO 1.2. - SET Kp TO 0.05. - LOCK dthrott TO Kp * (gforce_setpoint - gforce). - - SET thrott TO 1. - LOCK THROTTLE to thrott. - - UNTIL SHIP:ALTITUDE > 40000 { - SET thrott to thrott + dthrott. - WAIT 0.1. - } - -This is not a big change, but it will set us up to include the integral and derivative terms in the next section. - -Proportional-Integral Feedback Loop (PI-loop) ---------------------------------------------- - -Adding the integral term requires us to keep track of time. This is done by introducing a variable (t0) to store the time of the last iteration. Now, the throttle is changed only on iterations where some time has elapsed so the WAIT time in the UNTIL can be brought to 0.001. The offset of the gforce has been set to the variable P, and the integral gain to Ki. - -:: - - // PI-loop - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - - SET gforce_setpoint TO 1.2. - - LOCK P TO gforce_setpoint - gforce. - SET I TO 0. - - SET Kp TO 0.01. - SET Ki TO 0.006. - - LOCK dthrott TO Kp * P + Ki * I. - - SET thrott TO 1. - LOCK THROTTLE to thrott. - - SET t0 TO TIME:SECONDS. - UNTIL SHIP:ALTITUDE > 40000 { - SET dt TO TIME:SECONDS - t0. - IF dt > 0 { - SET I TO I + P * dt. - SET thrott to thrott + dthrott. - SET t0 TO TIME:SECONDS. - } - WAIT 0.001. - } - -Adding the integral term has the general effect of stabilizing the feedback loop, making it less prone to oscillating due to rapid changes in the process variable (gforce, in this case). This is usually at the expense of a longer settling time. - -Proportional-Integral-Derivative Feedback Loop (PID-loop) ---------------------------------------------------------- - -Incorporating the derivative term (D) and derivative gain (Kd) requires an additional variable (P0) to keep track of the previous value of the proportional term (P). - -:: - - // PID-loop - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - - SET gforce_setpoint TO 1.2. - - LOCK P TO gforce_setpoint - gforce. - SET I TO 0. - SET D TO 0. - SET P0 TO P. - - SET Kp TO 0.01. - SET Ki TO 0.006. - SET Kd TO 0.006. - - LOCK dthrott TO Kp * P + Ki * I + Kd * D. - - SET thrott TO 1. - LOCK THROTTLE to thrott. - - SET t0 TO TIME:SECONDS. - UNTIL SHIP:ALTITUDE > 40000 { - SET dt TO TIME:SECONDS - t0. - IF dt > 0 { - SET I TO I + P * dt. - SET D TO (P - P0) / dt. - SET thrott to thrott + dthrott. - SET P0 TO P. - SET t0 TO TIME:SECONDS. - } - WAIT 0.001. - } - -When tuned properly, the derivative term will cause the PID-loop to act quickly without causing problematic oscillations. Later in this tutorial, we will cover a way to tune a PID-loop using only the proportional term called the Zieger-Nichols method. - -Final Touches -------------- - -There are a few modifications that can make PID loops very robust. The following code example adds three range limits: - -#. bounds on the Integral term which addresses possible `integral windup`_ -#. bounds on the throttle since it must stay in the range 0 to 1 -#. a `deadband`_ to avoid changing the throttle due to small fluctuations - -.. _integral windup: http://en.wikipedia.org/wiki/Integral_windup -.. _deadband: http://en.wikipedia.org/wiki/Deadband - -Of course, KSP is a simulator and small fluctuations are not observed in this particular loop. Indeed, the P-loop is sufficient in this example, but all these features are included here for illustration purposes and they could become useful for unstable aircraft or untested scenarios. - -:: - - // PID-loop - SET g TO KERBIN:MU / KERBIN:RADIUS^2. - LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV. - LOCK gforce TO accvec:MAG / g. - - SET gforce_setpoint TO 1.2. - - LOCK P TO gforce_setpoint - gforce. - SET I TO 0. - SET D TO 0. - SET P0 TO P. - - LOCK in_deadband TO ABS(P) < 0.01. - - SET Kp TO 0.01. - SET Ki TO 0.006. - SET Kd TO 0.006. - - LOCK dthrott TO Kp * P + Ki * I + Kd * D. - - SET thrott TO 1. - LOCK THROTTLE to thrott. - - SET t0 TO TIME:SECONDS. - UNTIL SHIP:ALTITUDE > 40000 { - SET dt TO TIME:SECONDS - t0. - IF dt > 0 { - IF NOT in_deadband { - SET I TO I + P * dt. - SET D TO (P - P0) / dt. - - // If Ki is non-zero, then limit Ki*I to [-1,1] - IF Ki > 0 { - SET I TO MIN(1.0/Ki, MAX(-1.0/Ki, I)). - } - - // set throttle but keep in range [0,1] - SET thrott to MIN(1, MAX(0, thrott + dthrott)). - - SET P0 TO P. - SET t0 TO TIME:SECONDS. - } - } - WAIT 0.001. - } - -Tuning a PID-loop ------------------ - -We are going to start with the same rocket design we have been using so far and actually tune the PID-loop using the Ziegler-Nichols method. This is where we turn off the integral and derivative terms in the loop and bring the proportional gain (Kp) up from zero to the point where the loop causes a steady oscillation with a measured period (Tu). At this point, the proportional gain is called the "ultimate gain" (Ku) and the actual gains (Kp, Ki and Kd) are set according to this table `taken from wikipedia`_: - -.. _taken from wikipedia: http://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method - -+------------------------+-----------+---------------+--------------+ -| Control Type | Kp | Ki | Kd | -+========================+===========+===============+==============+ -| P | 0.5 Ku | | | -+------------------------+-----------+---------------+--------------+ -| PI | 0.45 Ku | 1.2 Kp / Tu | | -+------------------------+-----------+---------------+--------------+ -| PD | 0.8 Ku | | Kp Tu / 8 | -+------------------------+-----------+---------------+--------------+ -| classic PID | 0.6 Ku | 2 Kp / Tu | Kp Tu / 8 | -+------------------------+-----------+---------------+--------------+ -| Pessen Integral Rule | 0.7 Ku | 0.4 Kp / Tu | 0.15 Kp Tu | -+------------------------+-----------+---------------+--------------+ -| some overshoot | 0.33 Ku | 2 Kp / Tu | Kp Tu / 3 | -+------------------------+-----------+---------------+--------------+ -| no overshoot | 0.2 Ku | 2 Kp / Tu | Kp Tu / 3 | -+------------------------+-----------+---------------+--------------+ - -An immediate problem to overcome with this method is that it assumes a steady state can be achieved. With rockets, there is never a steady state: fuel is being consumed, altitude and therefore gravity and atmosphere is changing, staging can cause major upsets in the feedback loop. So, this tuning method will be some approximation which should come as no surprise since it will come from experimental observation. All we need is enough of a steady state that we can measure the oscillations - both the change in amplitude and the period. - -The script we'll use to tune the highly overpowered rocket shown will launch the rocket straight up (using SAS) and will log data to an output file until it reaches 30km at which point the log file will be copied to the archive and the program will terminate. Also, this time the feedback loop will be based on the more realistic "atmospheric efficiency." The log file will contain three columns: time since launch, offset of atmospheric efficiency from the ideal (in this case, 1.0) and the ship's maximum thrust. The maximum thrust will increase monotonically with time (this rocket has only one stage) and we'll use both as the x-axis when plotting the offset on the y-axis. - -:: - - DECLARE PARAMETER Kp. - - LOCK g TO SHIP:BODY:MU / (SHIP:BODY:RADIUS + SHIP:ALTITUDE)^2. - LOCK maxtwr TO SHIP:MAXTHRUST / (g * SHIP:MASS). - - // feedback based on atmospheric efficiency - LOCK surfspeed TO SHIP:VELOCITY:SURFACE:MAG. - LOCK atmoeff TO surfspeed / SHIP:TERMVELOCITY. - LOCK P TO 1.0 - atmoeff. - - SET t0 TO TIME:SECONDS. - LOCK dthrott TO Kp*P. - SET start_time TO t0. - - LOG "# Throttle PID Tuning" TO throttle_log. - LOG "# Kp: " + Kp TO throttle_log. - LOG "# t P maxtwr" TO throttle_log. - - LOCK logline TO (TIME:SECONDS - start_time) - + " " + P - + " " + maxtwr. - - SET thrott TO 1. - LOCK THROTTLE TO thrott. - SAS ON. - STAGE. - WAIT 3. - - UNTIL SHIP:ALTITUDE > 30000 { - SET dt TO TIME:SECONDS - t0. - IF dt > 0 { - SET thrott TO MIN(1,MAX(0,thrott + dthrott)). - SET t0 TO TIME:SECONDS. - LOG logline TO throttle_log. - } - WAIT 0.001. - } - COPY throttle_log TO 0. - -Give this script a short name, something like "tune.txt" so that running is simple: - -:: - - copy tune from 0. - run tune(0.5). - -After every launch completes, you'll have to go into the archive directory and rename the output logfile. Something like "throttle\_log.txt" --> "throttle.01.log" will help if you increment the index number each time. To analyze the data, plot the offset (P) as a function of time (t). Here, we show the results for three values of Kp: 0.002, 0.016 and 0.160, including the maximum TWR when Kp = 0.002 as the top x-axis. The maximum TWR dependence on time is different for the three values of Kp, but not by a lot. - -.. figure:: /_images/tutorials/pidloops/pidtune1.png - -The value of 0.002 is obviously too low. The settling time is well over 20 seconds and the loop can't keep up with the increase in terminal velocity at the higher altitudes reached after one minute. When Kp = 0.016, the behavior is far more well behaved, and though some oscillation exists, it's damped and slow with a period of about 10 seconds. At Kp = 0.160, the oscillations are prominent and we can start to measure the change in amplitude along with the period of the oscillations. This plot shows the data for Kp = 0.160 from 20 to 40 seconds after ignition. The peaks are found and are fit to a line. - -.. figure:: /_images/tutorials/pidloops/pidtune2.png - -This is done for each value of Kp and the slopes of the fitted lines are plotted as a function of Kp in the following plot: - -.. figure:: /_images/tutorials/pidloops/pidtune3.png - -The period of oscillation was averaged over the interval and plotted on top of the amplitude change over time. Notice the turn over that occurs when Kp reaches approximately 0.26. This will mark the "ultimate gain" and 3.1 seconds will be used as the associated period of oscillation. It is left as an exercise for the reader to implement a full PID-loop using the classic PID values (see table above): Kp = 0.156, Ki = 0.101, Kd = 0.060, producing this behavior: - -.. figure:: /_images/tutorials/pidloops/pidtune4.png - -As soon as the PID-loop was activated at 3 seconds after ignition, the throttle was cut. At approximately 7 seconds, the atmospheric efficiency dropped below 100% and the integral term started to climb back to zero. At 11 seconds, the engine was reignited and the feedback loop settled after about 20 seconds. The inset plot has the same axes as the parent and shows the long-term stability of the final PID-loop. - -Final Thoughts --------------- - -The classic PID values used above are fairly aggressive and there is some overshoot at the beginning. This can be dealt with in many ways and is discussed on the `wikipedia page about PID controllers`_. For example, one might consider trying to implement a switch to a PD-loop when the integral term hits some limit, switching back once P crosses zero. The PID behavior should look like the following: - -.. _wikipedia page about PID controllers: `PID loop`_ - -.. figure:: /_images/tutorials/pidloops/pidtune5.png - -Finally, Controlling the throttle of a rocket is perhaps the easiest thing to implement as a PID loop in KSP using kOS. The steering was largely ignored and the orientation was always up. When writing an autopilot for horizontal atmospheric flight, one will have to deal with the direction the ship is traveling using SHIP:HEADING as well as it's orientation with SHIP:FACING. Additionally, there are the SHIP:ROTATION and SHIP:TRANSLATION vectors which can tell you the rate of change of the ship's facing and heading respectively. The controls in this case are six-dimensional using SHIP:CONTROL with YAW, PITCH, ROLL, FORE, STARBOARD, TOP and MAINTHROTTLE. - -The PID gain parameters are dependent on the characteristics of the ship being controlled. The size, shape, turning capability and maximum TWR should be considered when tuning a PID loop. Turning RCS on can also have an effect and you might consider changing the PID loop's gain parameters every time to switch them on or off. diff --git a/_sources/tutorials/quickstart.txt b/_sources/tutorials/quickstart.txt deleted file mode 100644 index d73c8d90c..000000000 --- a/_sources/tutorials/quickstart.txt +++ /dev/null @@ -1,449 +0,0 @@ -.. _quickstart: - -Quick Start Tutorial -==================== - -This is a quick start guide for the **Kerbal Operating System** (**kOS**). It is intended for those who are just starting with using **kOS**. It does presume you have played **Kerbal Space Program** before and know the basics of how to fly a rocket under manual control. It does *NOT* assume you know a lot about computer programming, and it will walk you through some basic first steps. - -.. contents:: Contents - :local: - :depth: 2 - -First example: Hello World --------------------------- - -In the grand tradition of programming tutorials, the first example will be how to make a script that does nothing more than print the words "Hello World" on the screen. The purpose of this example is to show where you should put the files, how to move them about, and how to get one to run on the vessel. - -Step 1: Start a new sandbox-mode game -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -(You can use **kOS** in a career mode game, but it requires a part that you have to research which isn't available at the start of the tech tree, so this example will just use sandbox mode to keep it simple.) - -Step 2: Make a vessel in the Vehicle Assembly Bay -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Make the vessel contain any unmanned command core, a few hundred units of battery power, a means of recharging the battery such as a solar panel array, and the "Comptronix CX-4181 Scriptable Control System". (From this point onward the CX-4181 Scriptable Control System part will be referred to by the acronym "SCS".) The SCS part is located in the parts bin under the "Control" tab (the same place where RCS thrusters and Torque Wheels are found.) - -.. figure:: /_images/tutorials/quickstart/SCS_parts_bin.png - -Step 3: Put the vessel on the launchpad -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Put the vessel on the launchpad. For this first example it doesn't matter if the vessel can actually liftoff or even has engines at all. - -Step 4: Invoke the terminal -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Rightclick for the SCS part on the vessel and then click the button that says "Open Terminal". - -Note that if the terminal is semi-transparent, this means it's not currently selected. If you click on the terminal, then your keyboard input is directed to the terminal INSTEAD of to piloting. In other words if you type ``W`` ``A`` ``S`` ``D``, you'll actually get the word "wasd" to appear on the terminal, rather than the ``W`` ``A`` ``S`` ``D`` keys steering the ship. To switch back to manual control of the game instead of typing into the terminal, click outside the terminal window anywhere on the background of the screen. - -Step 5: See what an interactive command is like -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -You should now see an old-school looking text terminal like the one shown below. Type the line:: - - CLEARSCREEN. PRINT "==HELLO WORLD==". - -into the terminal (make sure to actually type the periods (".") as shown) and hit ``ENTER``. Note that you can type it in uppercase or lowercase. **kOS** doesn't care. - -.. figure:: /_images/tutorials/quickstart/terminal_open_1.png - :width: 80 % - -The terminal will respond by showing you this: - -.. figure:: /_images/tutorials/quickstart/terminal_open_2.png - -Step 6: Okay that's great, but how can you make that happen in a program script instead? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Like so: Enter this command:: - - EDIT HELLO. - -(Don't forget the period ("."). All commands in **kOS** are ended with a period. Again, you can type it in uppercase or lowercase. **kOS** doesn't care.) - -You should see an editor window appear, looking something like this (without the text inside because you're starting a blank new file): - -.. figure:: /_images/tutorials/quickstart/editor.png - -Type this text into the window:: - - PRINT "=========================================". - PRINT " HELLO WORLD". - PRINT "THIS IS THE FIRST SCRIPT I WROTE IN kOS.". - PRINT "=========================================". - -Click "Save" then "Exit" in the editor popup window. - -- *Side Note: The editor font* - Experienced programmers may have noticed that the editor's font is proportional width rather than monospaced and that this is not ideal for programming work. You are right, but there is little that can be done about it for a variety of technical reasons that are too complex to go into right now. - -Then on the main text terminal Enter:: - - RUN HELLO. - -And you will see the program run, showing the text on the screen like so. - -.. figure:: /_images/tutorials/quickstart/hello_world1.png - -Step 7: Okay, but where is this program? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -To see where the "HELLO" program has been saved, Issue the command ``LIST FILES`` like this:: - - LIST FILES. - -(Note, that the default for the ``LIST`` command is to list ``FILES``, so you can leave the word "FILES" off if you like.) - -It should look like this, showing you the HELLO program you just wrote: - -.. figure:: /_images/tutorials/quickstart/hello_list.png - -This is a list of all the files on the currently selected VOLUME. By default, when you launch a new vessel, the currently selected VOLUME is called "1" and it's the volume that's stored on THAT SCS part that you are running all these commands in. - -This is the local volume of that SCS part. Local volumes such at this tend to have very small limited storage, as you can see when you look at the space remaining in the list printout. - -If you're wondering where the file is stored *physically* on your computer, it's represented by a section inside the persistence file for your saved game, as a piece of data associated with the SCS part. This is important because it means you can't access the program from another vessel, and if this vessel ever crashes and the SCS part explodes, then you've lost the program. - -Step 8: I don't like the idea that the program is stored only on this vessel. Can't I save it somewhere better? More permanent? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Yes. Yes you can. - -There is another VOLUME that always exists called the *Archive*, which is also referred to as volume 0. (either name can be used in commands). The archive is conceptually stored somewhere back at Kerbin home base in the Space Center rather than on your vessel. It has infinite storage space, and does not disappear when your vessel is gone. ALSO, it actually exists across saved games - if you launch one saved game, put a new file in the Archive, and then later launch a different saved game, that file will be there in that game too. - -To use the Archive, first we'll have to introduce you to a new command, called ``SWITCH TO``. The ``SWITCH TO`` command changes which VOLUME is the one that you are doing your work with. - -To work with the archive, and create a second "hello world" file there, you issue these commands and see what they do:: - - SWITCH TO 0. - EDIT HELLO2. // Make a new file here that just says: PRINT "hi again". - LIST FILES. - RUN HELLO2. - SWITCH TO 1. - LIST FILES. - RUN HELLO. - -*But where is it stored behind the scenes?* The archive is currently slightly violating the design of **KSP** mods that puts everything in the GameData folder. The kSP Archive is actually stored in the ``Ships/Script`` folder of your MAIN **KSP** home, not inside GameData. - -If a file is stored inside the archive, it can actually be edited *by an external text editor of your choice* instead of using **kOS**'s in-game editor. This is usually a much better practice once you start doing more complex things with **kOS**. You can also make new files in the archive folder. Just make sure that all the files end with a ``.ks`` file name suffix or **kOS** won't use them. - -Further reading about files and volumes: - -- :ref:`Volumes` -- :ref:`File Control` - -Second Example: Doing something real ------------------------------------- - -Okay that's all basic setup stuff but you're probably clamoring for a real example that actually does something nifty. - -This example will show the crudest, most basic use of **kOS** just to get started. In this example we'll make a program that will launch a vessel using progressively more and more complex checks. **kOS** can be used at any stage of a vessel's flight - launching, circularizing, docking, landing,... and in fact launching is one of the simpler piloting tasks that you can do without much need of automation. Where **kOS** really shines is for writing scripts to do touchy sensitive tasks like landing or docking or hovering. These are the areas that can benefit from the faster reaction speed that a computer script can handle. - -But in order to give you an example that you can start with from scratch, that's easy to reload and retry from an initial point, we'll use an example of launching. - -Step 1: Make a vessel -^^^^^^^^^^^^^^^^^^^^^ - -Make any sort of rocket that can lift you to orbit that fills the following pattern: - -- It uses ONLY liquid fuel rockets. The example code here will assume this is the case. **kOS** can deal with solid fuel boosters as well, but to keep the example simple we'll use liquid fuel only here. -- Make the vessel's staging list set up in the right order for a launch. (Make sure it has no need to manually rightclick parts to stage things weirdly, and no need to use action groups to activate stages weirdly). -- Make sure the vessel has plenty of torque power to stay steady without a lot of wobble. -- Make the vessel have at least these parts on it: -- battery power of at least 400 charge -- ability to recharge equal to at least 6 solar panel sections or 1 RTG unit -- the **kOS** SCS part somewhere in the stack, near the top bit where it won't fall off due to staging. - -Step 2: Make the start of the script -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Okay, so type the lines below in an external *text editor of your choice* (i.e. Notepad on Windows, or TextEdit on Mac, or whatever you fancy):: - - // My First Launcher. - - SET countdown TO 10. - PRINT "Counting down:". - UNTIL countdown = 0 { - PRINT "..." + countdown. - SET countdown TO countdown - 1. - WAIT 1. // pauses the script here for 1 second. - } - -See those things with the two slashes ("//")? Those are comments in the kerboscript language and they're just ways to write things in the program that don't do anything - they're there for humans like you to read so you understand what's going on. In these examples you never actually have to type in the things you see after the slashes. They're there for your benefit when reading this document but you can leave them out if you wish. - -Save the file in your ``Ships/Script`` folder of your **KSP** installation under the filename "hellolaunch.ks". DO NOT save it anywhere under ``GameData/kOS/``. Do NOT. According to the **KSP** standard, normally **KSP** mods should put their files in ``GameData/[mod name]``, but **kOS** puts the archive outside the ``GameData`` folder because it represents content owned by you, the player, not content owned by the **kOS** mod. - -By saving the file in ``Ships/Script``, you have actually put it in your archive volume of **kOS**. **kOS** will see it there immediately without delay. You do not need to restart the game. If you do:: - - SWITCH TO 0. - LIST FILES. - -after saving the file from your external text editor program, you will see a listing of your file "hellolaunch" right away. Okay, now copy it to your local drive and give it a try running it from there:: - - SWITCH TO 1. - COPY HELLOLANCH FROM 0. - RUN HELLOLAUNCH. - -.. figure:: /_images/tutorials/quickstart/example_2_1.png - :width: 80 % - -Okay so the program doesn't actaully DO anything yet other than just countdown from 10 to 0. A bit of a dissapointment, but we haven't written the rest of the program yet. - -You'll note that what you've done is switch to the local volume (1) and then copy the program from the archive (0) to the local volume (1) and then run it from the local volume. Technically you didn't need to do this. You could have just run it directly from the archive. For those looking at the **KSP** game as a bit of a role-play experience, it makes sense to never run programs directly from the archive, and instead live with the limitation that software should be copied to the craft for it to be able to run it. - -Step 3: Make the script actually do something -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Okay now go back into your *text editor of choice* and append a few more lines to the hellolaunch.ks file so it now looks like this:: - - // My First Launcher. - - SET countdown TO 10. - PRINT "Counting down:". - UNTIL countdown = 0 { - PRINT "..." + countdown. - SET countdown TO countdown - 1. - WAIT 1. // pauses the script here for 1 second. - } - - PRINT "Main throttle up. 2 seconds to stabalize it.". - LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. - WAIT 2. // give throttle time to adjust. - UNTIL SHIP:MAXTHRUST > 0 { - WAIT 0.5. // pause half a second between stage attempts. - PRINT "Stage activated.". - STAGE. // same as hitting the spacebar. - } - WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up. - - // NOTE that it is vital to not just let the script end right away - // here. Once a kOS script just ends, it releases all the controls - // back to manual piloting so that you can fly the ship by hand again. - // If the pogram just ended here, then that would cause the throttle - // to turn back off again right away and nothing would happen. - -Save this file to hellolaunch.ks again, and re-copy it to your vessel that should still be sitting on the launchpad, then run it, like so:: - - COPY HELLOLAUNCH FROM 0. - RUN HELLOLAUNCH. - -.. figure:: /_images/tutorials/quickstart/example_2_2.png - :width: 80 % - -Hey! It does something now! It fires the first stage engine and launches! - -But.. but wait... It doesn't control the steering and it just lets it go where ever it will. - -Most likely you had a crash with this script because it didn't do anything to affect the steering at all, so it probably allowed the rocket to tilt over. - -Step 4: Make the script actually control steering -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -So to fix that problem, let's add steering control to the script. - -The easy way to control steering is to use the ``LOCK STEERING`` command. - -Once you have mastered the basics of **kOS**, you should go and read `the documentation on ship steering techniques <../ship_control/index.html>`__, but that's a more advanced topic for later. - -The way to use the ``LOCK STEERING`` command is to set it to a thing called a :struct:`Vector` or a :struct:`Direction`. There are several Directions built-in to **kOS**, one of which is called "UP". "UP" is a Direction that always aims directly toward the sky (the center of the blue part of the navball). - -So to steer always UP, just do this:: - - LOCK STEERING TO UP. - -So if you just add this one line to your script, you'll get something that should keep the craft aimed straight up and not let it tip over. Add the line just after the line that sets the THROTTLE, like so:: - - // My First Launcher. - - SET countdown TO 10. - PRINT "Counting down:". - UNTIL countdown = 0 { - PRINT "..." + countdown. - SET countdown TO countdown - 1. - WAIT 1. // pauses the script here for 1 second. - } - PRINT "Main throttle up. 2 seconds to stabalize it.". - LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. - - - LOCK STEERING TO UP. // This is the new line to add - - - WAIT 2. // give throttle time to adjust. - UNTIL SHIP:MAXTHRUST > 0 { - WAIT 0.5. // pause half a second between stage attempts. - PRINT "Stage activated.". - STAGE. // same as hitting the spacebar. - } - WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up. - - // NOTE that it is vital to not just let the script end right away - // here. Once a kOS script just ends, it releases all the controls - // back to manual piloting so that you can fly the ship by hand again. - // If the pogram just ended here, then that would cause the throttle - // to turn back off again right away and nothing would happen. - -Again, copy this and run it, like before. If your craft crashed in the previous step, which it probably did, then revert to the VAB and re-launch it. *NOTE: Due to a bug sometimes reverting just to the launchpad does not work well and you need to revert all the way back to the VAB.*:: - - SWITCH TO 1. // should be the default already, but just in case. - COPY HELLOLAUNCH FROM 0. - RUN HELLOLAUNCH. - -.. figure:: /_images/tutorials/quickstart/example_2_3.png - :width: 80 % - -Now you should see the same thing as before, but now your craft will stay pointed up. - -*But wait - it only does the first stage and then it stops without -doing the next stage? how do I fix that?* - -Step 5: Add staging logic -^^^^^^^^^^^^^^^^^^^^^^^^^ - -The logic for how and when to stage can be an interesting and fun thing to write yourself. This example will keep it very simple, and this is the part where it's important that you are using a vessel that only contains liquidfuel engines. If your vessel has some booster engines, then it would require a more sophisticated script to launch it correctly than this tutorial gives you. - -To add the logic to check when to stage, we introduce a new concept called the WHEN trigger. To see full documentation on it when you finish the tutorial, look for it on the `Flow Control page <../../command/flowControl/index.html>`__ - -The quick and dirty explanation is that a WHEN section is a short section of code that you set up to run LATER rather than right now. It creates a check in the background that will constantly look for some condition to occur, and when it happens, it interrupts whatever else the code is doing, and it will run the body of the WHEN code before continuing from where it left off in the main script. - -There are some complex dangers with writing WHEN triggers that can cause **KSP** itself to hang or stutter if you are not careful, but explaining them is beyond the scope of this tutorial. But when you want to start using WHEN triggers yourself, you really should read the section on WHEN in the `Flow Control page <../../command/flowControl/index.html>`__ before you do so. - -The WHEN trigger we are going to add to the launch script looks like this:: - - WHEN STAGE:LIQUIDFUEL < 0.001 THEN { - PRINT "No liquidfuel. Attempting to stage.". - STAGE. - PRESERVE. - } - -It says, "Whenever the amount of liquid fuel in the current stage is so small it may as well be zero (< 0.001), then activate the next stage." The PRESERVE keyword says, "don't stop checking this condition just because it's been triggered once. It should still keep checking for it again in the future." -The check for < 0.001 is because sometimes **KSP** won't quite burn the last drop of fuel in a stage. -If this block of code is inserted into the script, then it will set up a constant background check that will always hit the next stage as soon as the current stage has no liquidfuel in it. -UNLIKE with all the previous edits this tutorial has asked you to make to the script, this time you're going to be asked to delete something and replace it. The new WHEN section above should actually **REPLACE** the existing "UNTIL SHIP:MAXTHRUST > 0" loop that you had before. - -Now your script should look like this:: - - // My First Launcher. - - SET countdown TO 10. - PRINT "Counting down:". - UNTIL countdown = 0 { - PRINT "..." + countdown. - SET countdown TO countdown - 1. - WAIT 1. // pauses the script here for 1 second. - } - PRINT "Main throttle up. 2 seconds to stabalize it.". - LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. - LOCK STEERING TO UP. - WAIT 2. // give throttle time to adjust. - - // The section below replaces previous UNTIL loop: - - WHEN STAGE:LIQUIDFUEL < 0.001 THEN { - PRINT "No liquidfuel. Attempting to stage.". - STAGE. - PRESERVE. - } - WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up. - - // NOTE that it is vital to not just let the script end right away - // here. Once a kOS script just ends, it releases all the controls - // back to manual piloting so that you can fly the ship by hand again. - // If the pogram just ended here, then that would cause the throttle - // to turn back off again right away and nothing would happen. - -Again, relaunch the ship, copy the script as before, and run it again. This time you should see it activate your later upper stages correctly. (again, assuming you made the entire vessel with only liquidfuel engines.) - -.. figure:: /_images/tutorials/quickstart/example_2_4.png - :width: 80 % - -Step 6: Now to make it turn -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -*Okay that's fine but it still just goes straight up! What about a -gravity turn?* - -Well, a true and proper gravity turn is a very complex bit of math that is best left as an excercise for the reader, given that the goal of **kOS** is to let you write your OWN autopilot, not to write it for you. But to give some basic examples of commands, lets just make a crude gravity turn approximation that simply flies the ship like a lot of new **KSP** pilots learn to do it for the first time: - -- Fly straight up to 10000m. -- Aim at 45 degrees down toward the east until 40000m. -- Thrust horizontally east after that. - -To make this work, we introduce a new way to make a Direction, called the HEADING function. Whenever you call the function HEADING(a,b), it makes a Direction oriented as follows on the navball: - -- Point at the compass heading A. -- Pitch up a number of degrees from the horizon = to B. - -So for example, HEADING(45,10) would aim northeast, 10 degrees above the horizon. Combining this with the WHEN command from before, we get this section:: - - WHEN SHIP:ALTITUDE > 10000 THEN { - PRINT "Starting turn. Aiming to 45 degree pitch.". - LOCK STEERING TO HEADING(90,45). // east, 45 degrees pitch. - } - WHEN SHIP:ALTITUDE > 40000 THEN { - PRINT "Starting flat part. Aiming to horizon.". - LOCK STEERING TO HEADING(90,0). // east, horizontal. - } - -Note that these lack the command PRESERVE like the previous WHEN example had. This is because we want these to trigger just once and then never again. There's no point in constantly telling **kOS** to reset the steering to the same thing over and over as the script runs. - -Now, if you insert this new section to the script, we have a nice nifty example of a start of a launching script. Note that it works even if you insert it at the top of the script, because it sets up the triggers to occur LATER when the condition becomes true. They don't execute right away:: - - // My First Launcher. - - WHEN SHIP:ALTITUDE > 10000 THEN { - PRINT "Starting turn. Aiming to 45 degree pitch.". - LOCK STEERING TO HEADING(90,45). // east, 45 degrees pitch. - } - WHEN SHIP:ALTITUDE > 40000 THEN { - PRINT "Starting flat part. Aiming to horizon.". - LOCK STEERING TO HEADING(90,0). // east, horizontal. - } - SET countdown TO 10. - PRINT "Counting down:". - UNTIL countdown = 0 { - PRINT "..." + countdown. - SET countdown TO countdown - 1. - WAIT 1. // pauses the script here for 1 second. - } - PRINT "Main throttle up. 2 seconds to stabalize it.". - LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. - LOCK STEERING TO UP. - WAIT 2. // give throttle time to adjust. - - // The section below replaces previous UNTIL loop: - - WHEN STAGE:LIQUIDFUEL < 0.001 THEN { - PRINT "No liquidfuel. Attempting to stage.". - STAGE. - PRESERVE. - } - WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up. - - // NOTE that it is vital to not just let the script end right away - // here. Once a kOS script just ends, it releases all the controls - // back to manual piloting so that you can fly the ship by hand again. - // If the program just ended here, then that would cause the throttle - // to turn back off again right away and nothing would happen. - -And here is it in action: - -.. figure:: /_images/tutorials/quickstart/example_2_5.png - :width: 80 % - -And toward the end: - -.. figure:: /_images/tutorials/quickstart/example_2_6.png - :width: 80 % - -If we assume you made a vessel that has enough fuel and power to get up to orbit, this script should in principle work to get you to the point of leaving the atmosphere. It will probably still fall back down, because this script makes no attempt to ensure that the craft is going fast enough to maintain the orbit. - -As you can probably see, it would still have a long way to go before it would become a really GOOD launching autopilot. Think about the following features you could add yourself as you become more familiar with **kOS**: - -- You could change the steering logic to make a more smooth gravity turn by constantly adjusting the pitch in the HEADING according to some math formula. The example shown here tends to create a "too high" launch that's a bit inefficient. -- You could complete the launching script by making sure once the vessel breaks the atmosphere it actually makes a circular orbit rather than just stopping after 70000m and coasting. -- This script just stupidly leaves the throttle at max the whole way. You could make it more sophisticated by adjusting the throttle as necessary to avoid too much wasted energy fighting air friction. (The way **KSP**'s stock areodynamic model works, the optimal speed is terminal velocity, by the way). This is partly addressed in the :ref:`PID Loop Tutorial `. -- With more sophisticated staging checks, the script could be made to work with solid fuel engines as well. -- With even more sophisticated checks, the script could be made to work with fancy staging methods like asaparagus. -- Using the PRINT AT command, you can make fancier status readouts in the termainl window as the script runs. diff --git a/_static/ajax-loader.gif b/_static/ajax-loader.gif deleted file mode 100644 index 61faf8cab..000000000 Binary files a/_static/ajax-loader.gif and /dev/null differ diff --git a/_static/applauncher_panel_no_annotation.png b/_static/applauncher_panel_no_annotation.png deleted file mode 100644 index e2dc93206..000000000 Binary files a/_static/applauncher_panel_no_annotation.png and /dev/null differ diff --git a/_static/basic.css b/_static/basic.css deleted file mode 100644 index 967e36ce0..000000000 --- a/_static/basic.css +++ /dev/null @@ -1,537 +0,0 @@ -/* - * basic.css - * ~~~~~~~~~ - * - * Sphinx stylesheet -- basic theme. - * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -/* -- main layout ----------------------------------------------------------- */ - -div.clearer { - clear: both; -} - -/* -- relbar ---------------------------------------------------------------- */ - -div.related { - width: 100%; - font-size: 90%; -} - -div.related h3 { - display: none; -} - -div.related ul { - margin: 0; - padding: 0 0 0 10px; - list-style: none; -} - -div.related li { - display: inline; -} - -div.related li.right { - float: right; - margin-right: 5px; -} - -/* -- sidebar --------------------------------------------------------------- */ - -div.sphinxsidebarwrapper { - padding: 10px 5px 0 10px; -} - -div.sphinxsidebar { - float: left; - width: 230px; - margin-left: -100%; - font-size: 90%; -} - -div.sphinxsidebar ul { - list-style: none; -} - -div.sphinxsidebar ul ul, -div.sphinxsidebar ul.want-points { - margin-left: 20px; - list-style: square; -} - -div.sphinxsidebar ul ul { - margin-top: 0; - margin-bottom: 0; -} - -div.sphinxsidebar form { - margin-top: 10px; -} - -div.sphinxsidebar input { - border: 1px solid #98dbcc; - font-family: sans-serif; - font-size: 1em; -} - -div.sphinxsidebar #searchbox input[type="text"] { - width: 170px; -} - -div.sphinxsidebar #searchbox input[type="submit"] { - width: 30px; -} - -img { - border: 0; - max-width: 100%; -} - -/* -- search page ----------------------------------------------------------- */ - -ul.search { - margin: 10px 0 0 20px; - padding: 0; -} - -ul.search li { - padding: 5px 0 5px 20px; - background-image: url(file.png); - background-repeat: no-repeat; - background-position: 0 7px; -} - -ul.search li a { - font-weight: bold; -} - -ul.search li div.context { - color: #888; - margin: 2px 0 0 30px; - text-align: left; -} - -ul.keywordmatches li.goodmatch a { - font-weight: bold; -} - -/* -- index page ------------------------------------------------------------ */ - -table.contentstable { - width: 90%; -} - -table.contentstable p.biglink { - line-height: 150%; -} - -a.biglink { - font-size: 1.3em; -} - -span.linkdescr { - font-style: italic; - padding-top: 5px; - font-size: 90%; -} - -/* -- general index --------------------------------------------------------- */ - -table.indextable { - width: 100%; -} - -table.indextable td { - text-align: left; - vertical-align: top; -} - -table.indextable dl, table.indextable dd { - margin-top: 0; - margin-bottom: 0; -} - -table.indextable tr.pcap { - height: 10px; -} - -table.indextable tr.cap { - margin-top: 10px; - background-color: #f2f2f2; -} - -img.toggler { - margin-right: 3px; - margin-top: 3px; - cursor: pointer; -} - -div.modindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - -div.genindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - -/* -- general body styles --------------------------------------------------- */ - -a.headerlink { - visibility: hidden; -} - -h1:hover > a.headerlink, -h2:hover > a.headerlink, -h3:hover > a.headerlink, -h4:hover > a.headerlink, -h5:hover > a.headerlink, -h6:hover > a.headerlink, -dt:hover > a.headerlink { - visibility: visible; -} - -div.body p.caption { - text-align: inherit; -} - -div.body td { - text-align: left; -} - -.field-list ul { - padding-left: 1em; -} - -.first { - margin-top: 0 !important; -} - -p.rubric { - margin-top: 30px; - font-weight: bold; -} - -img.align-left, .figure.align-left, object.align-left { - clear: left; - float: left; - margin-right: 1em; -} - -img.align-right, .figure.align-right, object.align-right { - clear: right; - float: right; - margin-left: 1em; -} - -img.align-center, .figure.align-center, object.align-center { - display: block; - margin-left: auto; - margin-right: auto; -} - -.align-left { - text-align: left; -} - -.align-center { - text-align: center; -} - -.align-right { - text-align: right; -} - -/* -- sidebars -------------------------------------------------------------- */ - -div.sidebar { - margin: 0 0 0.5em 1em; - border: 1px solid #ddb; - padding: 7px 7px 0 7px; - background-color: #ffe; - width: 40%; - float: right; -} - -p.sidebar-title { - font-weight: bold; -} - -/* -- topics ---------------------------------------------------------------- */ - -div.topic { - border: 1px solid #ccc; - padding: 7px 7px 0 7px; - margin: 10px 0 10px 0; -} - -p.topic-title { - font-size: 1.1em; - font-weight: bold; - margin-top: 10px; -} - -/* -- admonitions ----------------------------------------------------------- */ - -div.admonition { - margin-top: 10px; - margin-bottom: 10px; - padding: 7px; -} - -div.admonition dt { - font-weight: bold; -} - -div.admonition dl { - margin-bottom: 0; -} - -p.admonition-title { - margin: 0px 10px 5px 0px; - font-weight: bold; -} - -div.body p.centered { - text-align: center; - margin-top: 25px; -} - -/* -- tables ---------------------------------------------------------------- */ - -table.docutils { - border: 0; - border-collapse: collapse; -} - -table.docutils td, table.docutils th { - padding: 1px 8px 1px 5px; - border-top: 0; - border-left: 0; - border-right: 0; - border-bottom: 1px solid #aaa; -} - -table.field-list td, table.field-list th { - border: 0 !important; -} - -table.footnote td, table.footnote th { - border: 0 !important; -} - -th { - text-align: left; - padding-right: 5px; -} - -table.citation { - border-left: solid 1px gray; - margin-left: 1px; -} - -table.citation td { - border-bottom: none; -} - -/* -- other body styles ----------------------------------------------------- */ - -ol.arabic { - list-style: decimal; -} - -ol.loweralpha { - list-style: lower-alpha; -} - -ol.upperalpha { - list-style: upper-alpha; -} - -ol.lowerroman { - list-style: lower-roman; -} - -ol.upperroman { - list-style: upper-roman; -} - -dl { - margin-bottom: 15px; -} - -dd p { - margin-top: 0px; -} - -dd ul, dd table { - margin-bottom: 10px; -} - -dd { - margin-top: 3px; - margin-bottom: 10px; - margin-left: 30px; -} - -dt:target, .highlighted { - background-color: #fbe54e; -} - -dl.glossary dt { - font-weight: bold; - font-size: 1.1em; -} - -.field-list ul { - margin: 0; - padding-left: 1em; -} - -.field-list p { - margin: 0; -} - -.optional { - font-size: 1.3em; -} - -.versionmodified { - font-style: italic; -} - -.system-message { - background-color: #fda; - padding: 5px; - border: 3px solid red; -} - -.footnote:target { - background-color: #ffa; -} - -.line-block { - display: block; - margin-top: 1em; - margin-bottom: 1em; -} - -.line-block .line-block { - margin-top: 0; - margin-bottom: 0; - margin-left: 1.5em; -} - -.guilabel, .menuselection { - font-family: sans-serif; -} - -.accelerator { - text-decoration: underline; -} - -.classifier { - font-style: oblique; -} - -abbr, acronym { - border-bottom: dotted 1px; - cursor: help; -} - -/* -- code displays --------------------------------------------------------- */ - -pre { - overflow: auto; - overflow-y: hidden; /* fixes display issues on Chrome browsers */ -} - -td.linenos pre { - padding: 5px 0px; - border: 0; - background-color: transparent; - color: #aaa; -} - -table.highlighttable { - margin-left: 0.5em; -} - -table.highlighttable td { - padding: 0 0.5em 0 0.5em; -} - -tt.descname { - background-color: transparent; - font-weight: bold; - font-size: 1.2em; -} - -tt.descclassname { - background-color: transparent; -} - -tt.xref, a tt { - background-color: transparent; - font-weight: bold; -} - -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { - background-color: transparent; -} - -.viewcode-link { - float: right; -} - -.viewcode-back { - float: right; - font-family: sans-serif; -} - -div.viewcode-block:target { - margin: -1px -10px; - padding: 0 10px; -} - -/* -- math display ---------------------------------------------------------- */ - -img.math { - vertical-align: middle; -} - -div.body div.math p { - text-align: center; -} - -span.eqno { - float: right; -} - -/* -- printout stylesheet --------------------------------------------------- */ - -@media print { - div.document, - div.documentwrapper, - div.bodywrapper { - margin: 0 !important; - width: 100%; - } - - div.sphinxsidebar, - div.related, - div.footer, - #top-link { - display: none; - } -} \ No newline at end of file diff --git a/_static/code.png b/_static/code.png deleted file mode 100644 index eb91cbf24..000000000 Binary files a/_static/code.png and /dev/null differ diff --git a/_static/commands/maneuver_nodes.png b/_static/commands/maneuver_nodes.png deleted file mode 100644 index 8b1f7bc96..000000000 Binary files a/_static/commands/maneuver_nodes.png and /dev/null differ diff --git a/_static/comment-bright.png b/_static/comment-bright.png deleted file mode 100644 index 551517b8c..000000000 Binary files a/_static/comment-bright.png and /dev/null differ diff --git a/_static/comment-close.png b/_static/comment-close.png deleted file mode 100644 index 09b54be46..000000000 Binary files a/_static/comment-close.png and /dev/null differ diff --git a/_static/comment.png b/_static/comment.png deleted file mode 100644 index 92feb52b8..000000000 Binary files a/_static/comment.png and /dev/null differ diff --git a/_static/config-panel.png b/_static/config-panel.png deleted file mode 100644 index 29b1b815f..000000000 Binary files a/_static/config-panel.png and /dev/null differ diff --git a/_static/default.css b/_static/default.css deleted file mode 100644 index 5f1399abd..000000000 --- a/_static/default.css +++ /dev/null @@ -1,256 +0,0 @@ -/* - * default.css_t - * ~~~~~~~~~~~~~ - * - * Sphinx stylesheet -- default theme. - * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: sans-serif; - font-size: 100%; - background-color: #11303d; - color: #000; - margin: 0; - padding: 0; -} - -div.document { - background-color: #1c4e63; -} - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 0 0 0 230px; -} - -div.body { - background-color: #ffffff; - color: #000000; - padding: 0 20px 30px 20px; -} - -div.footer { - color: #ffffff; - width: 100%; - padding: 9px 0 9px 0; - text-align: center; - font-size: 75%; -} - -div.footer a { - color: #ffffff; - text-decoration: underline; -} - -div.related { - background-color: #133f52; - line-height: 30px; - color: #ffffff; -} - -div.related a { - color: #ffffff; -} - -div.sphinxsidebar { -} - -div.sphinxsidebar h3 { - font-family: 'Trebuchet MS', sans-serif; - color: #ffffff; - font-size: 1.4em; - font-weight: normal; - margin: 0; - padding: 0; -} - -div.sphinxsidebar h3 a { - color: #ffffff; -} - -div.sphinxsidebar h4 { - font-family: 'Trebuchet MS', sans-serif; - color: #ffffff; - font-size: 1.3em; - font-weight: normal; - margin: 5px 0 0 0; - padding: 0; -} - -div.sphinxsidebar p { - color: #ffffff; -} - -div.sphinxsidebar p.topless { - margin: 5px 10px 10px 10px; -} - -div.sphinxsidebar ul { - margin: 10px; - padding: 0; - color: #ffffff; -} - -div.sphinxsidebar a { - color: #98dbcc; -} - -div.sphinxsidebar input { - border: 1px solid #98dbcc; - font-family: sans-serif; - font-size: 1em; -} - - - -/* -- hyperlink styles ------------------------------------------------------ */ - -a { - color: #355f7c; - text-decoration: none; -} - -a:visited { - color: #355f7c; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - - - -/* -- body styles ----------------------------------------------------------- */ - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: 'Trebuchet MS', sans-serif; - background-color: #f2f2f2; - font-weight: normal; - color: #20435c; - border-bottom: 1px solid #ccc; - margin: 20px -20px 10px -20px; - padding: 3px 0 3px 10px; -} - -div.body h1 { margin-top: 0; font-size: 200%; } -div.body h2 { font-size: 160%; } -div.body h3 { font-size: 140%; } -div.body h4 { font-size: 120%; } -div.body h5 { font-size: 110%; } -div.body h6 { font-size: 100%; } - -a.headerlink { - color: #c60f0f; - font-size: 0.8em; - padding: 0 4px 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - background-color: #c60f0f; - color: white; -} - -div.body p, div.body dd, div.body li { - text-align: justify; - line-height: 130%; -} - -div.admonition p.admonition-title + p { - display: inline; -} - -div.admonition p { - margin-bottom: 5px; -} - -div.admonition pre { - margin-bottom: 5px; -} - -div.admonition ul, div.admonition ol { - margin-bottom: 5px; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -div.warning { - background-color: #ffe4e4; - border: 1px solid #f66; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -pre { - padding: 5px; - background-color: #eeffcc; - color: #333333; - line-height: 120%; - border: 1px solid #ac9; - border-left: none; - border-right: none; -} - -tt { - background-color: #ecf0f3; - padding: 0 1px 0 1px; - font-size: 0.95em; -} - -th { - background-color: #ede; -} - -.warning tt { - background: #efc2c2; -} - -.note tt { - background: #d6d6d6; -} - -.viewcode-back { - font-family: sans-serif; -} - -div.viewcode-block:target { - background-color: #f4debf; - border-top: 1px solid #ac9; - border-bottom: 1px solid #ac9; -} \ No newline at end of file diff --git a/_static/doctools.js b/_static/doctools.js deleted file mode 100644 index c5455c905..000000000 --- a/_static/doctools.js +++ /dev/null @@ -1,238 +0,0 @@ -/* - * doctools.js - * ~~~~~~~~~~~ - * - * Sphinx JavaScript utilities for all documentation. - * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -/** - * select a different prefix for underscore - */ -$u = _.noConflict(); - -/** - * make the code below compatible with browsers without - * an installed firebug like debugger -if (!window.console || !console.firebug) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", - "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", - "profile", "profileEnd"]; - window.console = {}; - for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {}; -} - */ - -/** - * small helper function to urldecode strings - */ -jQuery.urldecode = function(x) { - return decodeURIComponent(x).replace(/\+/g, ' '); -}; - -/** - * small helper function to urlencode strings - */ -jQuery.urlencode = encodeURIComponent; - -/** - * This function returns the parsed url parameters of the - * current request. Multiple values per key are supported, - * it will always return arrays of strings for the value parts. - */ -jQuery.getQueryParameters = function(s) { - if (typeof s == 'undefined') - s = document.location.search; - var parts = s.substr(s.indexOf('?') + 1).split('&'); - var result = {}; - for (var i = 0; i < parts.length; i++) { - var tmp = parts[i].split('=', 2); - var key = jQuery.urldecode(tmp[0]); - var value = jQuery.urldecode(tmp[1]); - if (key in result) - result[key].push(value); - else - result[key] = [value]; - } - return result; -}; - -/** - * highlight a given string on a jquery object by wrapping it in - * span elements with the given class name. - */ -jQuery.fn.highlightText = function(text, className) { - function highlight(node) { - if (node.nodeType == 3) { - var val = node.nodeValue; - var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { - var span = document.createElement("span"); - span.className = className; - span.appendChild(document.createTextNode(val.substr(pos, text.length))); - node.parentNode.insertBefore(span, node.parentNode.insertBefore( - document.createTextNode(val.substr(pos + text.length)), - node.nextSibling)); - node.nodeValue = val.substr(0, pos); - } - } - else if (!jQuery(node).is("button, select, textarea")) { - jQuery.each(node.childNodes, function() { - highlight(this); - }); - } - } - return this.each(function() { - highlight(this); - }); -}; - -/** - * Small JavaScript module for the documentation. - */ -var Documentation = { - - init : function() { - this.fixFirefoxAnchorBug(); - this.highlightSearchWords(); - this.initIndexTable(); - }, - - /** - * i18n support - */ - TRANSLATIONS : {}, - PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, - LOCALE : 'unknown', - - // gettext and ngettext don't access this so that the functions - // can safely bound to a different name (_ = Documentation.gettext) - gettext : function(string) { - var translated = Documentation.TRANSLATIONS[string]; - if (typeof translated == 'undefined') - return string; - return (typeof translated == 'string') ? translated : translated[0]; - }, - - ngettext : function(singular, plural, n) { - var translated = Documentation.TRANSLATIONS[singular]; - if (typeof translated == 'undefined') - return (n == 1) ? singular : plural; - return translated[Documentation.PLURALEXPR(n)]; - }, - - addTranslations : function(catalog) { - for (var key in catalog.messages) - this.TRANSLATIONS[key] = catalog.messages[key]; - this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); - this.LOCALE = catalog.locale; - }, - - /** - * add context elements like header anchor links - */ - addContextElements : function() { - $('div[id] > :header:first').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this headline')). - appendTo(this); - }); - $('dt[id]').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this definition')). - appendTo(this); - }); - }, - - /** - * workaround a firefox stupidity - */ - fixFirefoxAnchorBug : function() { - if (document.location.hash && $.browser.mozilla) - window.setTimeout(function() { - document.location.href += ''; - }, 10); - }, - - /** - * highlight the search words provided in the url in the text - */ - highlightSearchWords : function() { - var params = $.getQueryParameters(); - var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; - if (terms.length) { - var body = $('div.body'); - if (!body.length) { - body = $('body'); - } - window.setTimeout(function() { - $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlighted'); - }); - }, 10); - $('') - .appendTo($('#searchbox')); - } - }, - - /** - * init the domain index toggle buttons - */ - initIndexTable : function() { - var togglers = $('img.toggler').click(function() { - var src = $(this).attr('src'); - var idnum = $(this).attr('id').substr(7); - $('tr.cg-' + idnum).toggle(); - if (src.substr(-9) == 'minus.png') - $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); - else - $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); - }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { - togglers.click(); - } - }, - - /** - * helper function to hide the search marks again - */ - hideSearchWords : function() { - $('#searchbox .highlight-link').fadeOut(300); - $('span.highlighted').removeClass('highlighted'); - }, - - /** - * make the url absolute - */ - makeURL : function(relativeURL) { - return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; - }, - - /** - * get the current relative url - */ - getCurrentURL : function() { - var path = document.location.pathname; - var parts = path.split(/\//); - $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { - if (this == '..') - parts.pop(); - }); - var url = parts.join('/'); - return path.substring(url.lastIndexOf('/') + 1, path.length - 1); - } -}; - -// quick alias for translations -_ = Documentation.gettext; - -$(document).ready(function() { - Documentation.init(); -}); diff --git a/_static/down-pressed.png b/_static/down-pressed.png deleted file mode 100644 index 6f7ad7827..000000000 Binary files a/_static/down-pressed.png and /dev/null differ diff --git a/_static/down.png b/_static/down.png deleted file mode 100644 index 3003a8877..000000000 Binary files a/_static/down.png and /dev/null differ diff --git a/_static/favicon.ico b/_static/favicon.ico deleted file mode 100644 index 7852b9470..000000000 Binary files a/_static/favicon.ico and /dev/null differ diff --git a/_static/file.png b/_static/file.png deleted file mode 100644 index d18082e39..000000000 Binary files a/_static/file.png and /dev/null differ diff --git a/_static/forum.png b/_static/forum.png deleted file mode 100644 index bc4156a4e..000000000 Binary files a/_static/forum.png and /dev/null differ diff --git a/_static/general/applauncher_panel.png b/_static/general/applauncher_panel.png deleted file mode 100644 index 339195728..000000000 Binary files a/_static/general/applauncher_panel.png and /dev/null differ diff --git a/_static/general/applauncher_panel.xcf b/_static/general/applauncher_panel.xcf deleted file mode 100644 index a244714fa..000000000 Binary files a/_static/general/applauncher_panel.xcf and /dev/null differ diff --git a/_static/general/ship_parts_tree.xcf b/_static/general/ship_parts_tree.xcf deleted file mode 100644 index 81c057bc8..000000000 Binary files a/_static/general/ship_parts_tree.xcf and /dev/null differ diff --git a/_static/hr.png b/_static/hr.png deleted file mode 100644 index 3e0e9c90b..000000000 Binary files a/_static/hr.png and /dev/null differ diff --git a/_static/jquery.js b/_static/jquery.js deleted file mode 100644 index 83589daa7..000000000 --- a/_static/jquery.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */ -(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); \ No newline at end of file diff --git a/_static/minus.png b/_static/minus.png deleted file mode 100644 index da1c5620d..000000000 Binary files a/_static/minus.png and /dev/null differ diff --git a/_static/nametag.png b/_static/nametag.png deleted file mode 100644 index 432ea8406..000000000 Binary files a/_static/nametag.png and /dev/null differ diff --git a/_static/nametag.xcf b/_static/nametag.xcf deleted file mode 100644 index 3b53726a7..000000000 Binary files a/_static/nametag.xcf and /dev/null differ diff --git a/_static/pattern.png b/_static/pattern.png deleted file mode 100644 index 5cb76aaf9..000000000 Binary files a/_static/pattern.png and /dev/null differ diff --git a/_static/plus.png b/_static/plus.png deleted file mode 100644 index b3cb37425..000000000 Binary files a/_static/plus.png and /dev/null differ diff --git a/_static/pygments.css b/_static/pygments.css deleted file mode 100644 index d79caa151..000000000 --- a/_static/pygments.css +++ /dev/null @@ -1,62 +0,0 @@ -.highlight .hll { background-color: #ffffcc } -.highlight { background: #eeffcc; } -.highlight .c { color: #408090; font-style: italic } /* Comment */ -.highlight .err { border: 1px solid #FF0000 } /* Error */ -.highlight .k { color: #007020; font-weight: bold } /* Keyword */ -.highlight .o { color: #666666 } /* Operator */ -.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ -.highlight .cp { color: #007020 } /* Comment.Preproc */ -.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ -.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ -.highlight .gd { color: #A00000 } /* Generic.Deleted */ -.highlight .ge { font-style: italic } /* Generic.Emph */ -.highlight .gr { color: #FF0000 } /* Generic.Error */ -.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -.highlight .gi { color: #00A000 } /* Generic.Inserted */ -.highlight .go { color: #333333 } /* Generic.Output */ -.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ -.highlight .gs { font-weight: bold } /* Generic.Strong */ -.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -.highlight .gt { color: #0044DD } /* Generic.Traceback */ -.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ -.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ -.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ -.highlight .kp { color: #007020 } /* Keyword.Pseudo */ -.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ -.highlight .kt { color: #902000 } /* Keyword.Type */ -.highlight .m { color: #208050 } /* Literal.Number */ -.highlight .s { color: #4070a0 } /* Literal.String */ -.highlight .na { color: #4070a0 } /* Name.Attribute */ -.highlight .nb { color: #007020 } /* Name.Builtin */ -.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ -.highlight .no { color: #60add5 } /* Name.Constant */ -.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ -.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ -.highlight .ne { color: #007020 } /* Name.Exception */ -.highlight .nf { color: #06287e } /* Name.Function */ -.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ -.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ -.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ -.highlight .nv { color: #bb60d5 } /* Name.Variable */ -.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ -.highlight .w { color: #bbbbbb } /* Text.Whitespace */ -.highlight .mf { color: #208050 } /* Literal.Number.Float */ -.highlight .mh { color: #208050 } /* Literal.Number.Hex */ -.highlight .mi { color: #208050 } /* Literal.Number.Integer */ -.highlight .mo { color: #208050 } /* Literal.Number.Oct */ -.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ -.highlight .sc { color: #4070a0 } /* Literal.String.Char */ -.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ -.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ -.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ -.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ -.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ -.highlight .sx { color: #c65d09 } /* Literal.String.Other */ -.highlight .sr { color: #235388 } /* Literal.String.Regex */ -.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ -.highlight .ss { color: #517918 } /* Literal.String.Symbol */ -.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ -.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ -.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ -.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ -.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/_static/reddit.png b/_static/reddit.png deleted file mode 100644 index d3fc68891..000000000 Binary files a/_static/reddit.png and /dev/null differ diff --git a/_static/reference/bindings/resources.png b/_static/reference/bindings/resources.png deleted file mode 100644 index 224447aeb..000000000 Binary files a/_static/reference/bindings/resources.png and /dev/null differ diff --git a/_static/reference/math/KSP_body_coords.png b/_static/reference/math/KSP_body_coords.png deleted file mode 100644 index 65c2fb841..000000000 Binary files a/_static/reference/math/KSP_body_coords.png and /dev/null differ diff --git a/_static/reference/math/KSP_body_latlong.png b/_static/reference/math/KSP_body_latlong.png deleted file mode 100644 index 0df993d6b..000000000 Binary files a/_static/reference/math/KSP_body_latlong.png and /dev/null differ diff --git a/_static/sauce.png b/_static/sauce.png deleted file mode 100644 index d09fed708..000000000 Binary files a/_static/sauce.png and /dev/null differ diff --git a/_static/searchtools.js b/_static/searchtools.js deleted file mode 100644 index 6e1f06bd1..000000000 --- a/_static/searchtools.js +++ /dev/null @@ -1,622 +0,0 @@ -/* - * searchtools.js_t - * ~~~~~~~~~~~~~~~~ - * - * Sphinx JavaScript utilties for the full-text search. - * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - - -/** - * Porter Stemmer - */ -var Stemmer = function() { - - var step2list = { - ational: 'ate', - tional: 'tion', - enci: 'ence', - anci: 'ance', - izer: 'ize', - bli: 'ble', - alli: 'al', - entli: 'ent', - eli: 'e', - ousli: 'ous', - ization: 'ize', - ation: 'ate', - ator: 'ate', - alism: 'al', - iveness: 'ive', - fulness: 'ful', - ousness: 'ous', - aliti: 'al', - iviti: 'ive', - biliti: 'ble', - logi: 'log' - }; - - var step3list = { - icate: 'ic', - ative: '', - alize: 'al', - iciti: 'ic', - ical: 'ic', - ful: '', - ness: '' - }; - - var c = "[^aeiou]"; // consonant - var v = "[aeiouy]"; // vowel - var C = c + "[^aeiouy]*"; // consonant sequence - var V = v + "[aeiou]*"; // vowel sequence - - var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 - var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 - var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 - var s_v = "^(" + C + ")?" + v; // vowel in stem - - this.stemWord = function (w) { - var stem; - var suffix; - var firstch; - var origword = w; - - if (w.length < 3) - return w; - - var re; - var re2; - var re3; - var re4; - - firstch = w.substr(0,1); - if (firstch == "y") - w = firstch.toUpperCase() + w.substr(1); - - // Step 1a - re = /^(.+?)(ss|i)es$/; - re2 = /^(.+?)([^s])s$/; - - if (re.test(w)) - w = w.replace(re,"$1$2"); - else if (re2.test(w)) - w = w.replace(re2,"$1$2"); - - // Step 1b - re = /^(.+?)eed$/; - re2 = /^(.+?)(ed|ing)$/; - if (re.test(w)) { - var fp = re.exec(w); - re = new RegExp(mgr0); - if (re.test(fp[1])) { - re = /.$/; - w = w.replace(re,""); - } - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1]; - re2 = new RegExp(s_v); - if (re2.test(stem)) { - w = stem; - re2 = /(at|bl|iz)$/; - re3 = new RegExp("([^aeiouylsz])\\1$"); - re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re2.test(w)) - w = w + "e"; - else if (re3.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - else if (re4.test(w)) - w = w + "e"; - } - } - - // Step 1c - re = /^(.+?)y$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(s_v); - if (re.test(stem)) - w = stem + "i"; - } - - // Step 2 - re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step2list[suffix]; - } - - // Step 3 - re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step3list[suffix]; - } - - // Step 4 - re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; - re2 = /^(.+?)(s|t)(ion)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - if (re.test(stem)) - w = stem; - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1] + fp[2]; - re2 = new RegExp(mgr1); - if (re2.test(stem)) - w = stem; - } - - // Step 5 - re = /^(.+?)e$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - re2 = new RegExp(meq1); - re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) - w = stem; - } - re = /ll$/; - re2 = new RegExp(mgr1); - if (re.test(w) && re2.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - - // and turn initial Y back to y - if (firstch == "y") - w = firstch.toLowerCase() + w.substr(1); - return w; - } -} - - - -/** - * Simple result scoring code. - */ -var Scorer = { - // Implement the following function to further tweak the score for each result - // The function takes a result array [filename, title, anchor, descr, score] - // and returns the new score. - /* - score: function(result) { - return result[4]; - }, - */ - - // query matches the full name of an object - objNameMatch: 11, - // or matches in the last dotted part of the object name - objPartialMatch: 6, - // Additive scores depending on the priority of the object - objPrio: {0: 15, // used to be importantResults - 1: 5, // used to be objectResults - 2: -5}, // used to be unimportantResults - // Used when the priority is not in the mapping. - objPrioDefault: 0, - - // query found in title - title: 15, - // query found in terms - term: 5 -}; - - -/** - * Search Module - */ -var Search = { - - _index : null, - _queued_query : null, - _pulse_status : -1, - - init : function() { - var params = $.getQueryParameters(); - if (params.q) { - var query = params.q[0]; - $('input[name="q"]')[0].value = query; - this.performSearch(query); - } - }, - - loadIndex : function(url) { - $.ajax({type: "GET", url: url, data: null, - dataType: "script", cache: true, - complete: function(jqxhr, textstatus) { - if (textstatus != "success") { - document.getElementById("searchindexloader").src = url; - } - }}); - }, - - setIndex : function(index) { - var q; - this._index = index; - if ((q = this._queued_query) !== null) { - this._queued_query = null; - Search.query(q); - } - }, - - hasIndex : function() { - return this._index !== null; - }, - - deferQuery : function(query) { - this._queued_query = query; - }, - - stopPulse : function() { - this._pulse_status = 0; - }, - - startPulse : function() { - if (this._pulse_status >= 0) - return; - function pulse() { - var i; - Search._pulse_status = (Search._pulse_status + 1) % 4; - var dotString = ''; - for (i = 0; i < Search._pulse_status; i++) - dotString += '.'; - Search.dots.text(dotString); - if (Search._pulse_status > -1) - window.setTimeout(pulse, 500); - } - pulse(); - }, - - /** - * perform a search for something (or wait until index is loaded) - */ - performSearch : function(query) { - // create the required interface elements - this.out = $('#search-results'); - this.title = $('

' + _('Searching') + '

').appendTo(this.out); - this.dots = $('').appendTo(this.title); - this.status = $('

').appendTo(this.out); - this.output = $('
'); - } - // Prettify the comment rating. - comment.pretty_rating = comment.rating + ' point' + - (comment.rating == 1 ? '' : 's'); - // Make a class (for displaying not yet moderated comments differently) - comment.css_class = comment.displayed ? '' : ' moderate'; - // Create a div for this comment. - var context = $.extend({}, opts, comment); - var div = $(renderTemplate(commentTemplate, context)); - - // If the user has voted on this comment, highlight the correct arrow. - if (comment.vote) { - var direction = (comment.vote == 1) ? 'u' : 'd'; - div.find('#' + direction + 'v' + comment.id).hide(); - div.find('#' + direction + 'u' + comment.id).show(); - } - - if (opts.moderator || comment.text != '[deleted]') { - div.find('a.reply').show(); - if (comment.proposal_diff) - div.find('#sp' + comment.id).show(); - if (opts.moderator && !comment.displayed) - div.find('#cm' + comment.id).show(); - if (opts.moderator || (opts.username == comment.username)) - div.find('#dc' + comment.id).show(); - } - return div; - } - - /** - * A simple template renderer. Placeholders such as <%id%> are replaced - * by context['id'] with items being escaped. Placeholders such as <#id#> - * are not escaped. - */ - function renderTemplate(template, context) { - var esc = $(document.createElement('div')); - - function handle(ph, escape) { - var cur = context; - $.each(ph.split('.'), function() { - cur = cur[this]; - }); - return escape ? esc.text(cur || "").html() : cur; - } - - return template.replace(/<([%#])([\w\.]*)\1>/g, function() { - return handle(arguments[2], arguments[1] == '%' ? true : false); - }); - } - - /** Flash an error message briefly. */ - function showError(message) { - $(document.createElement('div')).attr({'class': 'popup-error'}) - .append($(document.createElement('div')) - .attr({'class': 'error-message'}).text(message)) - .appendTo('body') - .fadeIn("slow") - .delay(2000) - .fadeOut("slow"); - } - - /** Add a link the user uses to open the comments popup. */ - $.fn.comment = function() { - return this.each(function() { - var id = $(this).attr('id').substring(1); - var count = COMMENT_METADATA[id]; - var title = count + ' comment' + (count == 1 ? '' : 's'); - var image = count > 0 ? opts.commentBrightImage : opts.commentImage; - var addcls = count == 0 ? ' nocomment' : ''; - $(this) - .append( - $(document.createElement('a')).attr({ - href: '#', - 'class': 'sphinx-comment-open' + addcls, - id: 'ao' + id - }) - .append($(document.createElement('img')).attr({ - src: image, - alt: 'comment', - title: title - })) - .click(function(event) { - event.preventDefault(); - show($(this).attr('id').substring(2)); - }) - ) - .append( - $(document.createElement('a')).attr({ - href: '#', - 'class': 'sphinx-comment-close hidden', - id: 'ah' + id - }) - .append($(document.createElement('img')).attr({ - src: opts.closeCommentImage, - alt: 'close', - title: 'close' - })) - .click(function(event) { - event.preventDefault(); - hide($(this).attr('id').substring(2)); - }) - ); - }); - }; - - var opts = { - processVoteURL: '/_process_vote', - addCommentURL: '/_add_comment', - getCommentsURL: '/_get_comments', - acceptCommentURL: '/_accept_comment', - deleteCommentURL: '/_delete_comment', - commentImage: '/static/_static/comment.png', - closeCommentImage: '/static/_static/comment-close.png', - loadingImage: '/static/_static/ajax-loader.gif', - commentBrightImage: '/static/_static/comment-bright.png', - upArrow: '/static/_static/up.png', - downArrow: '/static/_static/down.png', - upArrowPressed: '/static/_static/up-pressed.png', - downArrowPressed: '/static/_static/down-pressed.png', - voting: false, - moderator: false - }; - - if (typeof COMMENT_OPTIONS != "undefined") { - opts = jQuery.extend(opts, COMMENT_OPTIONS); - } - - var popupTemplate = '\ -
\ -

\ - Sort by:\ - best rated\ - newest\ - oldest\ -

\ -
Comments
\ -
\ - loading comments...
\ -
    \ -
    \ -

    Add a comment\ - (markup):

    \ -
    \ - reStructured text markup: *emph*, **strong**, \ - ``code``, \ - code blocks: :: and an indented block after blank line
    \ -
    \ - \ -

    \ - \ - Propose a change ▹\ - \ - \ - Propose a change ▿\ - \ -

    \ - \ - \ - \ - \ - \ -
    \ -
    '; - - var commentTemplate = '\ -
    \ -
    \ -
    \ - \ - \ - \ - \ - \ - \ -
    \ -
    \ - \ - \ - \ - \ - \ - \ -
    \ -
    \ -
    \ -

    \ - <%username%>\ - <%pretty_rating%>\ - <%time.delta%>\ -

    \ -
    <#text#>
    \ -

    \ - \ - reply ▿\ - proposal ▹\ - proposal ▿\ - \ - \ -

    \ -
    \
    -<#proposal_diff#>\
    -        
    \ -
      \ -
      \ -
      \ -
      \ - '; - - var replyTemplate = '\ -
    • \ -
      \ -
      \ - \ - \ - \ - \ - \ - \ -
      \ -
    • '; - - $(document).ready(function() { - init(); - }); -})(jQuery); - -$(document).ready(function() { - // add comment anchors for all paragraphs that are commentable - $('.sphinx-has-comment').comment(); - - // highlight search words in search results - $("div.context").each(function() { - var params = $.getQueryParameters(); - var terms = (params.q) ? params.q[0].split(/\s+/) : []; - var result = $(this); - $.each(terms, function() { - result.highlightText(this.toLowerCase(), 'highlighted'); - }); - }); - - // directly open comment window if requested - var anchor = document.location.hash; - if (anchor.substring(0, 9) == '#comment-') { - $('#ao' + anchor.substring(9)).click(); - document.location.hash = '#s' + anchor.substring(9); - } -}); diff --git a/_static/zip.png b/_static/zip.png deleted file mode 100644 index 08637bb18..000000000 Binary files a/_static/zip.png and /dev/null differ diff --git a/about.html b/about.html deleted file mode 100644 index 826238768..000000000 --- a/about.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - About kOS and KerboScript — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      About kOS and KerboScript

      -

      kOS was originally created by Nivekk. It is under active development by Chris Woerz and Steven Mading.

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Contribute

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/bindings.html b/bindings.html deleted file mode 100644 index 47baa95b2..000000000 --- a/bindings.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - Catalog of Bound Variable Names — kOS 0.15.3 documentation - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Catalog of Bound Variable Names

      -

      This is the list of special reserved keyword variable names that kOS -will interpret -to mean something special. If they are used as normal variable names by -your kOS script -program they may not work. Understanding them and their meaning is -crucial to creating -effective kOS scripts.

      -
      -

      NAMED VESSELS AND BODIES

      -

      Variable Name | Can Read | Can Set | Type | Description -==============|==========|=========|======|============ -SHIP | yes | no | Vessel | -Whichever vessel happens to be the one containing the CPU part that is -running this Kerboscript code at the moment. This is the CPU -Vessel. -TARGET | yes | yes | Vessel or -Body | Whichever -Orbitable object happens to be -the one selected as the current KSP target. If set to a string, it will -assume the string is the name of a vessel being targetted and set it to -a vessel by that name. For best results set it to Body(“some name”) or -Vessel(“some name”) explicitly.

      -
      -
      -

      Alias shortcuts for SHIP fields

      -

      The following are all alias shortcuts for accessing the fields of the -SHIP vessel. -To see their definition, please consult the -Vessel -page, as they are all just instances of the standard vessel suffixes.

      -

      Variable | Same as -=========|=========== -HEADING | Same as SHIP:HEADING -PROGRADE | Same as SHIP:PROGRADE -RETROGRADE | Same as SHIP:RETROGRADE -FACING | Same as SHIP:FACING -MAXTHRUST | Same as SHIP:MAXTHRUST -VELOCITY | Same as SHIP:VELOCITY -GEOPOSITION | Same as SHIP:GEOPOSITION -LATITUDE | Same as SHIP:LATITUDE -LONGITUDE | Same as SHIP:LONGITUDE -UP | Same as SHIP:UP -NORTH | Same as SHIP:NORTH -BODY | Same as SHIP:BODY -ANGULARMOMENTUM | Same as SHIP:ANGULARMOMENTUM -ANGULARVEL | Same as SHIP:ANGULARVEL -ANGULARVELOCITY | Same as SHIP:ANGULARVEL -COMMRANGE | Same as SHIP:COMMRANGE -MASS | Same as SHIP:MASS -VERTICALSPEED | Same as SHIP:VERTICALSPEED -SURFACESPEED | Same as SHIP:SURFACESPEED -AIRSPEED | Same as SHIP:AIRSPEED -VESSELNAME | Same as SHIP:VESSELNAME -ALTITUDE | Same as SHIP:ALTITUDE -APOAPSIS | Same as SHIP:APOAPSIS -PERIAPSIS | Same as SHIP:PERIAPSIS -SENSOR | Same as SHIP:SENSOR -SRFPROGRADE | Same as SHIP:SRFPROGRADE -SRFREROGRADE | Same as SHIP:SRFREROGRADE -OBT | Same as SHIP:OBT -STATUS | Same as SHIP:STATUS -VESSELNAME | Same as SHIP:NAME -Any resource | Same as SHIP:resource name, eg. LIQUIDFUEL is the -same as SHIP:LIQUIDFUEL

      -
      -
      -

      Resource Types

      -

      Any time there is a resource on the ship it can be queried. The -resources are the values that appear when you click on the upper-right -corner of the screen in the KSP window. Resources

      -
      LIQUIDFUEL
      -OXIDIZER
      -ELECTRICCHARGE
      -MONOPROPELLANT
      -INTAKEAIR
      -SOLIDFUEL
      -
      -
      -

      All of the above resources can be queried using either the prefix SHIP -or STAGE, depending on whether you are trying to query how much is left -in the curent stage or the entire ship:

      -

      How much liquid fuel is left in the entire ship:

      -
      PRINT "There is " + SHIP:LIQUIDFUEL + " liquid fuel on the ship.".
      -
      -
      -

      How much liquid fuel is left in just the current stage:

      -
      PRINT "There is " + STAGE:LIQUIDFUEL + " liquid fuel in this stage.".
      -
      -
      -

      How much liquid fuel is left in the target vessel:

      -
      PRINT "There is " + TARGET:LIQUIDFUEL + " liquid fuel in the target ship.".
      -
      -
      -

      Any other resources that you have added using other mods should be -query-able this way, provided that you spell -the term exactly as it appears in the resources window.

      -
      -
      -

      ALT ALIAS

      -

      The special variable ALT is a unique exception. It behaves like a -structure with suffixes but it’s acually a bit “fake” in that it’s not -really a structure. The following terms are just exceptions that don’t -fit anywhere else:

      -

      Variable | Type | Meaning -==============|========|========== -ALT:APOAPSIS | number | The altitude of the apoapsis of the current -ship. Identical to SHIP:APOAPSIS. -ALT:PERIAPSIS | number | The altitude of the periapsis of the current -ship. Identical to SHIP:PERIAPSIS. -ALT:RADAR | number | The altitude of the current ship above the -terrain, rather than above the sea level. Does not have an alias -anywhere.

      -
      -
      -

      ETA ALIAS

      -

      The special variable ETA is a unique exception. It behaves like a -structure with suffixes but it’s acually a bit “fake” in that it’s not -really a structure. The following terms are just exceptions that don’t -fit anywhere else:

      -

      Variable | Type | Meaning -===============|========|========== -ETA:APOAPSIS | number | The number of seconds until the current ship -will reach its apoapsis. -ETA:PERIAPSIS | number | The number of seconds until the current ship -will reach its periapsis. -ETA:TRANSITION | number | The number of seconds until the current ship -will leave the current sphere of influence and enter the sphere of -influence of another celestial body.

      -
      -
      -

      ENCOUNTER

      -

      The body being encountered next by the current vessel. Returns the -special string “None” if there is no expected encounter, or an object of -type Body if an encounter is -expected.

      -
      -
      -

      BOOLEAN TOGGLE FIELDS:

      -

      These are variables that behave like boolean flags. They can be True or -False, and can be set or toggled -using the “ON” and “OFF” and “TOGGLE” commands. -Many of these are for action group flags. -NOTE ABOUT ACTION GROUP FLAGS: If the boolean flag is for an action -group, be aware that each time the -user presses the action group keypress, it toggles the action group, -so you might need to check for both -the change in state from false to true AND the change in state from true -to false to see if the key was hit.

      -

      Variable Name | Can Read | Can Set | Description -==============|==========|=========|=============== -SAS | yes | yes | Is the SAS stabalizer control enabled right now? -(Same as “SAS” indicator on the navball.) -RCS | yes | yes | Is the RCS thrust flag enbabled right now? (Same as -“RCS” indicator on the navball.) -GEAR | yes | yes | Is the GEAR enabled right now? (Note, KSP does -some strange things with this flag, like needing to hit it twice the -first time). -LEGS | yes | yes | Are the landing LEGS extended? (as opposed to GEAR -which is for the wheels of a plane.) -CHUTES | yes | yes | Are the parachutes extended? (Treats all -parachutes as one single unit. Does not activate them individually.) -LIGHTS | yes | yes | Are the lights on? (like the “U” key in manual -flight.) -PANELS | yes | yes | Are the solar panels extended? (Treats all solar -panels as one single unit. Does not activate them individually.) -BRAKES | yes | yes | Are the brakes on? -ABORT | yes | yes | Abort Action Group. -AG1 | yes | yes | Action Group 1. -AG2 | yes | yes | Action Group 2. -AG3 | yes | yes | Action Group 3. -AG4 | yes | yes | Action Group 4. -AG5 | yes | yes | Action Group 5. -AG6 | yes | yes | Action Group 6. -AG7 | yes | yes | Action Group 7. -AG8 | yes | yes | Action Group 8. -AG9 | yes | yes | Action Group 9. -AG10 | yes | yes | Action Group 10.

      -
      -
      -

      Flight Control

      -

      A summary page describing the basics of controlling the flight of a ship -can be found here

      -
      -

      Controls that must be used with LOCK

      -
      THROTTLE            // Lock to a decimal value between 0 and 1.
      -STEERING            // Lock to a direction, either a Vector or a Direction.
      -WHEELTHROTTLE       // Seperate throttle for wheels
      -WHEELSTEERING       // Seperate steering system for wheels
      -
      -
      -
      -
      -
      -

      System Variables

      -

      Returns values about kOS and hardware

      -
      PRINT VERSION.            // Returns operating system version number. i.e. 0.8.6
      -PRINT VERSION:MAJOR.      // Returns major version number. e.g. 0
      -PRINT VERSION:MINOR.      // Returns minor version number. e.g. 8
      -PRINT SESSIONTIME.        // Returns amount of time, in seconds, from vessel load.
      -
      -
      -

      NOTE the following important difference:

      -

      SESSIONTIME is the time since the last time this vessel was loaded from -on-rails into full physics.

      -

      TIME is the time since the entire saved game campaign started, in the -kerbal universe’s time. i.e. TIME = 0 means a brand new campaign was -just started.

      -
      -
      -

      Config

      -

      CONFIG is a special variable name that refers to the configuration -settings for -the kOS mod, and can be used to set or get various options.

      -

      CONFIG has its own page for further -details.

      -
      -
      -

      Game State

      -

      Variables that have something to do with the state of the universe.

      -

      Variable | Type | Meaning -=========|======|========= -TIME | Time | Simulated amount of -time that passed since the beginning of the game’s universe epoch. (A -brand new campaign that just started begins at TIME zero.) -MAPVIEW | boolean | Both settable and gettable. If you query MAPVIEW, -it’s true if on the map screen, and false if on the flight view screen. -If you SET MAPVIEW, you can cause the game to switch between mapview and -flight view or visa versa.

      -

      TIME is a useful system variable for calculating the passage of time -between taking -physical measurements (i.e. to calulate how fast a phenomenon is -changing in a loop). -It returns the KSP simulated time, rather than the actual realtime -sitting in the -chair playing the game. If everything is running smoothly on a fast -computer, one -second of simulated time will match one second of real time, but if -anything is -causing the game to stutter or lag a bit, then the simulated time will -be a bit -slower than the real time. For any script program trying to calculate -physical -properties of the KSP universe, the time that matters is the simulated -time, which -is what TIME returns.

      -

      It’s important to be aware of the frozen update -nature of the kOS -computer when reading TIME.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands.html b/commands.html deleted file mode 100644 index b805738b8..000000000 --- a/commands.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - Command Reference — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/commands/files.html b/commands/files.html deleted file mode 100644 index f2318a4b8..000000000 --- a/commands/files.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - File I/O — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      File I/O

      -

      For information about where files are kept and how to deal with volumes see the Volumes page in the general topics section of this documentation.

      -
      -

      Note

      -

      All file names (program names) must be valid Identifiers. They can not contain spaces or special characters. For example, you can’t have a file name called “this is my-file”.

      -
      -
      -

      Warning

      -
      -

      Changed in version 0.15: Archive location and file extension change

      -

      The Archive where KerboScript files are kept has been changed from Plugins/PluginData/Archive to Ships/Script, but still under the top-level KSP installation directory. The file name extensions have also changes from .txt to .ks.

      -
      -
      -
      -

      Volume and Filename arguments

      -

      Any of the commands below which use filename arguments, **with the -exception -of the RUN command**, follow these rules:

      -
        -
      • (expression filenames) A filename may be an expression which -evaluates to a string.
      • -
      • (bareword filenames) A filename may also be an undefined identifier -which does not match a variable name, in which case the bare word -name of the identifier will be used as the filename. If the -identifier does match a variable name, then it will be evaluated as -an expression and the variable’s contents will be used as the -filename.
      • -
      • A bareword filename may contain file extensions with dots, provided -it does not end in a dot.
      • -
      • If the filename does not contain a file extension, kOS will pad it -with a ”.ks” extension and use that.
      • -
      -

      Putting the above rules together, you can refer to filenames in any of -the following ways:

      -
        -
      • copy myfilename to 1. // This is an example of a bareword filename.
      • -
      • copy “myfilename” to 1. // This is an example of an EXPRESSION -filename.
      • -
      • copy myfilename.ks to 1. // This is an example of a bareword -filename.
      • -
      • copy myfilename.txt to 1. // This is an example of a bareword -filename.
      • -
      • copy “myfilename.ks” to 1. // This is an example of an EXPRESSION -filename
      • -
      • set str to “myfile” + “name” + ”.ks”. copy str to 1. // This is an -example of an EXPRESSION filename
      • -
      -

      Limits:

      -

      The following rules apply as limitations to the bareword filenames:

      -
        -
      • The RUN command only works with bareword filenames, not -expression filenames. Every other command works with either type of -filename.
      • -
      • Filenames containing any characters other than A-Z, 0-9, underscore, -and the period extension separator (‘.’), can only be referred to -using a string expression (with quotes), and cannot be used as a -bareword expression (without quotes).
      • -
      • If your filesystem is case-senstive (Linux and sometimes Mac OSX, or -even Windows if using some kinds of remote network drives), then -bareword filenames will only work properly on filenames that are all -lowercase. If you try to use a file with capital letters in the name -on these systems, you will only be able to do so by quoting it.
      • -
      -

      Volumes too:

      -

      The rules for filenames also apply to volumes. You may do this for -example:

      -
        -
      • set volNum to 1. copy “myfile” to volNum.
      • -
      -
      -
      -

      COMPILE program (TO compiledProgram).

      -

      (experimental)

      -

      Arguments:

      -
      -
      -
      argument 1
      -
      Name of source file.
      -
      argument 2
      -
      Name of destination file. If the optional argument 2 is missing, it will assume it’s the same as argument 1, but with a file extension changed to *.ksm.
      -
      -
      -

      Pre-compiles a script into an Kerboscript ML Exceutable -image that can be used -instead of executing the program discript directly.

      -

      The RUN command (elsewhere on this page) can work with either *.ks -script files or *.ksm compiled files.

      -

      The full details of this process are long and complex enough to be -placed on a separate page.

      -

      Please see the details of the Kerboscript ML -Executable.

      -
      -
      -

      COPY programFile FROM/TO voumeNumber.

      -
      -

      Arguments

      -
        -
      • argument 1: Name of target file.
      • -
      • argument 2: Target volume.
      • -
      -

      Copies a file to or from another volume. Volumes can be referenced by -their ID numbers or their names if they’ve been given one. See LIST, -SWITCH and RENAME.

      -

      Understanding how volumes -work is important to -understanding this command.

      -

      Example:

      -
      SWITCH TO 1.             // Makes volume 1 the active volume
      -COPY file1 FROM 0.       // Copies a file called file1.ks from volume 0 to volume 1
      -COPY file2 TO 0.         // Copies a file called file1.ks from volume 1 to volume 0
      -COPY file1.ks FROM 0.    // Copies a file called file1.ks from volume 0 to volume 1
      -COPY file2.ksm TO 0.     // Copies a file called file1.ksm from volume 1 to volume 0
      -COPY "file1.ksm" FROM 0. // Copies a file called file1.ksm from volume 0 to volume 1
      -COPY "file1" + "." + "ks" FROM 0. // Copies a file called file1.ks from volume 0 to volume 1
      -
      -
      -
      -
      -
      -

      DELETE filename FROM volumeNumber.

      -

      Deletes a file. You can delete a file from the current volume, or from a named volume.

      -
      -

      Arguments

      -
        -
      • argument 1: Name of target file.
      • -
      • argument 2: (optional) Target volume.
      • -
      -

      Example:

      -
      DELETE file1.         // Deletes file1.ks from the active volume.
      -DELETE "file1".       // Deletes file1.ks from the active volume.
      -DELETE file1.txt.     // Deletes file1.txt from the active volume.
      -DELETE "file1.txt".   // Deletes file1.txt from the active volume.
      -DELETE file1 FROM 1.  // Deletes file1.ks from volume 1
      -
      -
      -
      -
      -
      -

      EDIT program.

      -

      Edits a program on the currently selected volume.

      -
      -

      Arguments

      -
        -
      • argument 1: Name of file for editing.
      • -
      -
      -

      Note

      -

      The Edit feature was lost in version 0.11 but is back again after version 0.12.2 under a new guise. The new editor is unable to show a monospace font for a series of complex reasons involving how Unity works and how squad bundled the KSP game. The editor works, but will be in a proporional width font, which isn’t ideal for editing code. The best way to edit code remains to use a text editor external to KSP, however for a fast peek at the code during play, this editor is useful.

      -
      -

      Example:

      -
      EDIT filename.       // edits filename.ks
      -EDIT filename.ks.    // edits filename.ks
      -EDIT "filename.ks".  // edits filename.ks
      -EDIT "filename".     // edits filename.ks
      -EDIT "filename.txt". // edits filename.txt
      -
      -
      -
      -
      -
      -

      LOG text TO filename.

      -

      Logs the selected text to a file on the local volume. Can print strings, or the result of an expression.

      -
      -

      Arguments

      -
        -
      • argument 1: Value you would like to log.
      • -
      • argument 2: Name of file to log into.
      • -
      -

      Example:

      -
      LOG “Hello” to mylog.txt.    // logs to "mylog.txt".
      -LOG 4+1 to "mylog" .         // logs to "mylog.ks" because .ks is the default extension.
      -LOG “4 times 8 is: “ + (4*8) to mylog.   // logs to mylog.ks because .ks is the default extension.
      -
      -
      -
      -
      -
      -

      RENAME name1 TO name2.

      -

      Renames a file or volume.

      -
      -

      Arguments

      -
        -
      • argument 1: Volume/File Name you would like to change.
      • -
      • argument 2: New name for $1.
      • -
      -

      Example:

      -
      RENAME VOLUME 1 TO AwesomeDisk
      -RENAME FILE MyFile TO AutoLaunch.
      -
      -
      -
      -
      -
      -

      RUN <program>.

      -

      Runs the specified file as a program, optionally passing information to the program in the form of a comma-separated list of arguments in parentheses.

      -
      -

      Arguments

      -
        -
      • <program>: File to run.
      • -
      • comma-separagted-args: a list of values to pass into the program.
      • -
      -

      Example:

      -
      RUN AutoLaunch.ks.
      -RUN AutoLaunch.ksm.
      -RUN AutoLaunch.      // runs AutoLaunch.ksm if available, else runs AutoLaunch.ks.
      -RUN AutoLaunch( 75000, true, "hello" ).
      -RUN AutoLaunch.ks( 75000, true, "hello" ).
      -RUN AutoLaunch.ksm( 75000, true, "hello" ).
      -
      -
      -

      The program that is reading the arguments sees them in the variables it -mentions in DECLARE PARAMETER.

      -
      -
      -

      Important exceptions to the usual filename rules for RUN

      -

      The RUN command does not allow the same sorts of generic open-ended -filenames that the other -file commands allow. This is very important.

      -

      RUN only works when the filename is a bareword filename. It cannot use expression filenames:

      -
      RUN "ProgName"   // THIS WILL FAIL.  Run needs a bare word filename.
      -SET ProgName to "MyProgram".
      -RUN ProgName     // THIS WILL FAIL also.  It will attempt to run a file
      -                 // called "ProgName.ksm" or "ProgName.ks", when it sees this,
      -                 // rather than "MyProgram".
      -
      -The reasons for the exception to how filenames work for the RUN
      -command are too complex to go into in large detail here. Here's the
      -short version: While the kOS system does defer the majority of the
      -work
      -of actually compiling subprogram scripts until run-time, it still
      -has to
      -generate some header info about them at compile time, and the
      -filename
      -has to be set in stone at that time. Changing this would require a
      -large re-write of some of the archetecture of the virtual machine.
      -
      -
      -
      -
      -
      -

      SWITCH TO <volumeNumber>.

      -

      Switches to the specified volume. Volumes can be specified by number, or -it’s name (if it has one). See LIST and RENAME. Understanding how -volumes work is important -to understanding this command.

      -

      Example:

      -
      SWITCH TO 0.                        // Switch to volume 0.
      -RENAME VOLUME 1 TO AwesomeDisk.     // Name volume 1 as AwesomeDisk.
      -SWITCH TO AwesomeDisk.              // Switch to volume 1.
      -PRINT VOLUME:NAME.                  // Prints "AwesomeDisk".
      -
      -
      -
      -
      - - -
      -
      -
      - -
      -
      - - - - \ No newline at end of file diff --git a/commands/flight.html b/commands/flight.html deleted file mode 100644 index 761ed2e03..000000000 --- a/commands/flight.html +++ /dev/null @@ -1,791 +0,0 @@ - - - - - - - - Flight Control — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Flight Control

      -
      -
      - -

      Unless otherwise stated, all controls that a kOS CPU attempts will be done on the CPU Vessel. There are three styles of control:

      -
      -
      Cooked
      -
      Give a goal direction to seek, and let kOS find the way to maneuver toward it.
      -
      Raw
      -
      Control the craft just like a manual pilot would do from a keyboard or joystick.
      -
      Pilot
      -
      This is the stock way of controlling craft, the state of which can be read in KerboScript.
      -
      -
      -

      Warning

      -

      SAS OVERRIDES kOS

      -

      With the current implementation of flight control, if you leave SAS turned on, it will override kOS‘s attempts to steer the ship. In order for kOS to be able to turn the ship, you need to set SAS OFF. In manual control, you can pilot with SAS ON, because the pilot’s manual controls override the SAS and “fight” against it. In KOS no such ability exists. If SAS is on, kOS won’t be able to turn the ship. It is common for people writing kOS scripts to explicitly start them with a use of the SAS OFF command just in case you forgot to turn it off before running the script.

      -
      -
      -

      Cooked Control

      -

      In this style of controlling the craft, you do not steer the craft directly, but instead select a goal direction and let kOS pick the way to steer toward that goal. This method of controlling the craft consists primarily of the following two commands:

      -
      -
      -LOCK THROTTLE TO value.
      -

      This sets the main throttle of the ship to value. Where value is a floating point number between 0.0 and 1.0. A value of 0.0 means the throttle is idle, and a value of 1.0 means the throttle is at maximum. A value of 0.5 means the throttle is at the halfway point, and so on.

      -
      - -
      -
      -LOCK STEERING TO value.
      -

      This sets the direction kOS should point the ship where value is a Vector or a Direction created from a Rotation or Heading:

      -
      -

      Rotation

      -
      -

      A Rotation expressed as R(pitch,yaw,roll). Note that pitch, yaw and roll are not based on the horizon, but based on an internal coordinate system used by KSP that is hard to use. Thankfully, you can force the rotation into a sensible frame of reference by adding a rotation to a known direction first.

      -

      To select a direction that is 20 degrees off from straight up:

      -
      LOCK STEERING TO Up + R(20,0,0).
      -
      -
      -

      To select a direction that is due east, aimed at the horizon:

      -
      LOCK STEERING TO North + R(0,90,0).
      -
      -
      -

      UP and NORTH are the only two predefined rotations.

      -
      -

      Heading

      -
      -

      A heading expressed as HEADING(compass, pitch). This will aim 30 degrees above the horizon, due south:

      -
      LOCK STEERING TO HEADING(180, 30).
      -
      -
      -
      -

      Vector

      -
      -

      Any vector can also be used to lock steering:

      -
      LOCK STEERING TO V(100,50,10).
      -
      -
      -

      Note that the internal coordinate system for (X,Y,Z) is quite complex to explain. To aim in the opposite of the surface velocity direction:

      -
      LOCK STEERING TO (-1) * SHIP:VELOCITY:SURFACE.
      -
      -
      -

      The following aims at a vector which is the cross product of velocity and direction down to the SOI planet - in other words, it aims at the “normal” direction to the orbit:

      -
      LOCK STEERING TO VCRS(SHIP:VELOCITY:ORBIT, BODY:POSITION).
      -
      -
      -
      -
      -
      - -

      Like all LOCK expressions, the steering and throttle continually update on their own when using this style of control. If you lock your steering to velocity, then as your velocity changes, your steering will change to match it. Unlike with other LOCK expressions, the steering and throttle are special in that the lock expression gets executed automatically all the time in the background, while other LOCK expressions only get executed when you try to read the value of the variable. The reason is that the kOS computer is constantly querying the lock expression multiple times per second as it adjusts the steering and throttle in the background.

      -
      -

      Unlocking controls

      -

      If you LOCK the THROTTLE or STEERING, be aware that this prevents the user from manually controlling them. Until they unlock, the manual controls are prevented from working. You can free up the controls by issuing these two commands:

      -
      UNLOCK STEERING.
      -UNLOCK THROTTLE.
      -
      -
      -

      When the program ends, these automatically unlock as well, which means that to control a craft you must make sure the program doesn’t end. The moment it ends it lets go of the controls.

      -
      -
      -

      Advantages/Disadvantages

      -

      The advantge of “Cooked” control is that it is simpler to write scripts for, but the disadvantage is that you have no control over the details of the motion. You can’t dictate how fast or slow the craft rotates, or which axis it tries to rotate around first, and if your craft is wobbly, you can’t dampen the wobbliness.

      -
      -
      -
      -

      Raw Control

      -

      If you wish to have your kOS script manipulate a vessel’s flight controls directly in a raw way, rather than relying on kOS to handle the flying for you, then this is the type of structure you will need to use to do it. This is offered as an alternative to using the combination of LOCK STEERING and LOCK THROTTLE commands. To obtain the CONTROL variable for a vessel, use its :CONTROL suffix:

      -
      SET controlStick to SHIP:CONTROL.
      -SET controlStick:PITCH to 0.2.
      -
      -
      -

      Unlike with so-called “Cooked” steering, “raw” steering uses the SET command, not the LOCK command. Using LOCK with these controls won’t work. When controlling the ship in a raw way, you must decide how to move the controls in detail. Here is another example:

      -
      SET SHIP:CONTROL:YAW to 0.2.
      -
      -
      -

      This will start pushing the ship to rotate a bit faster to the right, like pushing the D key gently. All the following values are set between \(-1\) and \(+1\). Zero means the control is neutral. You can set to values smaller in magnitude than \(-1\) and \(+1\) for gentler control:

      -
      print "Gently pushing forward for 3 seconds.".
      -SET SHIP:CONTROL:FORE TO 0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 3.
      -SET SHIP:CONTROL:FORE to 0.0.
      -
      -print "Gently Pushing leftward for 3 seconds.".
      -SET SHIP:CONTROL:STARBOARD TO -0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 3.
      -SET SHIP:CONTROL:STARBOARD to 0.0.
      -
      -print "Starting an upward rotation.".
      -SET SHIP:CONTROL:PITCH TO 0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 0.5.
      -SET SHIP:CONTROL:PITCH to 0.0.
      -
      -print "Giving control back to the player now.".
      -SET SHIP:CONTROL:NEUTRALIZE to True.
      -
      -
      -

      One can use SHIP:CONTROL:ROTATION and SHIP:CONTROL:TRANSLATION to see the ship’s current situation.

      -
      -

      Raw Flight Controls Reference

      -

      These “Raw” controls allow you the direct control of flight parameters while the current program is running.

      -
      -

      Note

      -

      The MAINTHROTTLE requires active engines and, of course, sufficient and appropriate fuel. The rotational controls YAW, PITCH and ROW require active reaction wheels with sufficient energy or RCS to be ON with properly placed thrusters and appropriate fuel. The translational controls FORE, STARBOARD and TOP require RCS to be ON with properly placed thrusters and appropriate fuel.

      -
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType, RangeEquivalent Key
      MAINTHROTTLEscalar [0,1]LEFT-CTRL, LEFT-SHIFT
      YAWscalar [-1,1]D, A
      PITCHscalar [-1,1]W, S
      ROLLscalar [-1,1]Q, E
      ROTATIONVector(YAW,PITCH,ROLL)
      YAWTRIMscalar [-1,1]ALT+D, ALT+A
      PITCHTRIMscalar [-1,1]ALT+W, ALT+S
      ROLLTRIMscalar [-1,1]ALT+Q, ALT+E
      FOREscalar [-1,1]N, H
      STARBOARDscalar [-1,1]L, J
      TOPscalar [-1,1]I, K
      TRANSLATIONVector(FORE,STARBOARD,TOP)
      WHEELSTEERscalar [-1,1]A, D
      WHEELTHROTTLEscalar [-1,1]W, S
      WHEELSTEERTRIMscalar [-1,1]ALT+A, ALT+D
      WHEELTHROTTLETRIMscalar [-1,1]ALT+W, ALT+S
      NEUTRALbooleanIs kOS Controlling?
      NEUTRALIZEbooleanReleases Control
      -
      -
      -SHIP:CONTROL:MAINTHROTTLE
      -

      Set between 0 and 1 much like the cooked flying LOCK THROTTLE command.

      -
      - -
      -
      -SHIP:CONTROL:YAW
      -

      This is the rotation about the “up” vector as the pilot faces forward. Essentially left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:PITCH
      -

      Rotation about the starboard vector up \((+1)\) or down \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROLL
      -

      Rotation about the logintudinal axis of the ship left-wing-down \((-1)\) or left-wing-up \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROTATION
      -

      This is a Vector object containing (YAW, PITCH, ROLL) in that order.

      -
      - -
      -
      -SHIP:CONTROL:YAWTRIM
      -

      Controls the YAW of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:PITCHTRIM
      -

      Controls the PITCH of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:ROLLTRIM
      -

      Controls the ROLL of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:FORE
      -

      Controls the translation of the ship forward \((+1)\) or backward \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:STARBOARD
      -

      Controls the translation of the ship to the right \((+1)\) or left \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TOP
      -

      Controls the translation of the ship up \((+1)\) or down \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TRANSLATION
      -

      Controls the translation as a Vector (FORE, STARBOARD, TOP).

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEER
      -

      Turns the wheels left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLE
      -

      Controls the wheels to move the ship forward \((+1)\) or backward \((-1)\) while on the ground.

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEERTRIM
      -

      Controls the trim of the wheel steering.

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLETRIM
      -

      Controls the trim of the wheel throttle.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRAL
      -

      Returns true or false depending if kOS has any set controls. This is not settable.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRALIZE
      -

      This causes manual control to let go. When set to true, kOS lets go of the controls and allows the player to manually control them again. This is not gettable.

      -
      - - -
      -

      Unlocking controls

      -

      Once any of the SET SHIP:CONTROL commands have been used to control the ship, then the manual control by the player is locked out. To give control back to the player you must execute:

      -
      SET SHIP:CONTROL:NEUTRALIZE to TRUE.
      -
      -
      -
      -
      -

      Advantages/Disadvantages

      -

      The control over RCS translation requires the use of Raw control. Also, with raw control you can choose how gentle to be with the controls and it can be possible to control wobbly craft better with raw control than with cooked control.

      -
      - -
      -

      Pilot Input

      -

      This is not, strictly speaking, a method of controlling the craft. “Pilot” controls are a way to read the input from the pilot. Most of these controls share the same name as their flight control, prefixed with PILOT (eg YAW and PILOTYAW) the one exception to this is the PILOTMAINTHROTTLE. This suffix has a setter and allows you to change the behavior of the throttle that persists even after the current program ends:

      -
      SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.
      -
      -
      -

      Will ensure that the throttle will be 0 when execution stops. These suffixes allow you to read the input given to the system by the user.

      -
      -
      -structure Control
      -
      - - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType, RangeEquivalent Key
      PILOTMAINTHROTTLEscalar [0,1]LEFT-CTRL, LEFT-SHIFT
      PILOTYAWscalar [-1,1]D, A
      PILOTPITCHscalar [-1,1]W, S
      PILOTROLLscalar [-1,1]Q, E
      PILOTROTATIONVector(YAW,PITCH,ROLL)
      PILOTYAWTRIMscalar [-1,1]ALT+D, ALT+A
      PILOTPITCHTRIMscalar [-1,1]ALT+W, ALT+S
      PILOTROLLTRIMscalar [-1,1]ALT+Q, ALT+E
      PILOTFOREscalar [-1,1]N, H
      PILOTSTARBOARDscalar [-1,1]L, J
      PILOTTOPscalar [-1,1]I, K
      PILOTTRANSLATIONVector(FORE,STARBOARD,TOP)
      PILOTWHEELSTEERscalar [-1,1]A, D
      PILOTWHEELTHROTTLEscalar [-1,1]W, S
      PILOTWHEELSTEERTRIMscalar [-1,1]ALT+A, ALT+D
      PILOTWHEELTHROTTLETRIMscalar [-1,1]ALT+W, ALT+S
      PILOTNEUTRALbooleanIs kOS Controlling?
      -
      -
      -SHIP:CONTROL:MAINTHROTTLE
      -

      Returns the pilot’s input for the throttle. This is the only PILOT variable that is settable and is used to set the throttle upon termination of the current kOS program.

      -
      - -
      -
      -SHIP:CONTROL:YAW
      -

      Returns the pilot’s rotation input about the “up” vector as the pilot faces forward. Essentially left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:PITCH
      -

      Returns the pilot’s rotation input about the starboard vector up \((+1)\) or down \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROLL
      -

      Returns the pilot’s rotation input about the logintudinal axis of the ship left-wing-down \((-1)\) or left-wing-up \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROTATION
      -

      Returns the pilot’s rotation input as a Vector object containing (YAW, PITCH, ROLL) in that order.

      -
      - -
      -
      -SHIP:CONTROL:YAWTRIM
      -

      Returns the pilot’s input for the YAW of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:PITCHTRIM
      -

      Returns the pilot’s input for the PITCH of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:ROLLTRIM
      -

      Returns the pilot’s input for the ROLL of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:FORE
      -

      Returns the the pilot’s input for the translation of the ship forward \((+1)\) or backward \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:STARBOARD
      -

      Returns the the pilot’s input for the translation of the ship to the right \((+1)\) or left \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TOP
      -

      Returns the the pilot’s input for the translation of the ship up \((+1)\) or down \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TRANSLATION
      -

      Returns the the pilot’s input for translation as a Vector (FORE, STARBOARD, TOP).

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEER
      -

      Returns the the pilot’s input for wheel steering left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLE
      -

      Returns the the pilot’s input for the wheels to move the ship forward \((+1)\) or backward \((-1)\) while on the ground.

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEERTRIM
      -

      Returns the the pilot’s input for the trim of the wheel steering.

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLETRIM
      -

      Returns the the pilot’s input for the trim of the wheel throttle.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRAL
      -

      Returns true or false if the pilot is active or not.

      -
      - -

      Be aware that kOS can’t control a control at the same time that a player controls it. If kOS is taking control of the yoke, then the player can’t manually control it. Remember to run:

      -
      SET SHIP:CONTROL:NEUTRALIZE TO TRUE.
      -
      -
      -

      after the script is done using the controls, or the player will be locked out of control.

      -
      -
      -

      Ship Systems

      -
      -
      -SET somepart:CONTROLFROM TO (true|false).
      -

      If you have a handle on a part, from LIST PARTS, you can select that part to set the orientation of the craft, just like using the “control from here” in the right-click menu in the game. For more information see Part:CONTROLFROM.

      -
      - -
      -
      -RCS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the RCS on or off, like using R at the keyboard:

      -
      RCS ON.
      -
      -
      -
      - -
      -
      -SAS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the SAS on or off, like using T at the keybaord:

      -
      SAS ON.
      -
      -
      -
      - -
      -
      -LIGHTS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the lights on or off, like using the U key at the keyboard:

      -
      LIGHTS ON.
      -
      -
      -
      - -
      -
      -BRAKES
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the brakes on or off, like clicking the brakes button, though not like using the B key, because they stay on:

      -
      BRAKES ON.
      -
      -
      -
      - -
      -
      -TARGET
      -
      --- - - - - - -
      Access:Get/Set
      Type:string
      -

      Where name is the name of a target vessel or planet, this will set the current target:

      -
      SET TARGET TO name.
      -
      -
      -
      - -

      Note that the above options also can refer to a different vessel besides the current ship, for example, TARGET:THROTTLE to read the target’s throttle. But not all “set” or “lock” options will work with a different vessel other than the current one, because there’s no authority to control a craft the current program is not attached to.

      -
      -
      -

      Time Warping

      -
      -
      -WARP
      -
      -The :global:`WARP` global variable can be set to change the game warp to a value between 0 and 7::
      -
      -
      SET WARP TO 5. // Sets warp to 1000x -SET WARP TO 0. // Sets warp to 0x (real time)
      -
      - -
      - - - - - - -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Command Reference

      -

      Next topic

      -

      Cooked Control

      -

      This Page

      - - - -
      -
      -
      - - - - - \ No newline at end of file diff --git a/commands/flight/cooked.html b/commands/flight/cooked.html deleted file mode 100644 index 065bd5bd0..000000000 --- a/commands/flight/cooked.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - Cooked Control — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Cooked Control

      -

      In this style of controlling the craft, you do not steer the craft directly, but instead select a goal direction and let kOS pick the way to steer toward that goal. This method of controlling the craft consists primarily of the following two commands:

      -
      -
      -LOCK THROTTLE TO value.
      -

      This sets the main throttle of the ship to value. Where value is a floating point number between 0.0 and 1.0. A value of 0.0 means the throttle is idle, and a value of 1.0 means the throttle is at maximum. A value of 0.5 means the throttle is at the halfway point, and so on.

      -
      - -
      -
      -LOCK STEERING TO value.
      -

      This sets the direction kOS should point the ship where value is a Vector or a Direction created from a Rotation or Heading:

      -
      -

      Rotation

      -
      -

      A Rotation expressed as R(pitch,yaw,roll). Note that pitch, yaw and roll are not based on the horizon, but based on an internal coordinate system used by KSP that is hard to use. Thankfully, you can force the rotation into a sensible frame of reference by adding a rotation to a known direction first.

      -

      To select a direction that is 20 degrees off from straight up:

      -
      LOCK STEERING TO Up + R(20,0,0).
      -
      -
      -

      To select a direction that is due east, aimed at the horizon:

      -
      LOCK STEERING TO North + R(0,90,0).
      -
      -
      -

      UP and NORTH are the only two predefined rotations.

      -
      -

      Heading

      -
      -

      A heading expressed as HEADING(compass, pitch). This will aim 30 degrees above the horizon, due south:

      -
      LOCK STEERING TO HEADING(180, 30).
      -
      -
      -
      -

      Vector

      -
      -

      Any vector can also be used to lock steering:

      -
      LOCK STEERING TO V(100,50,10).
      -
      -
      -

      Note that the internal coordinate system for (X,Y,Z) is quite complex to explain. To aim in the opposite of the surface velocity direction:

      -
      LOCK STEERING TO (-1) * SHIP:VELOCITY:SURFACE.
      -
      -
      -

      The following aims at a vector which is the cross product of velocity and direction down to the SOI planet - in other words, it aims at the “normal” direction to the orbit:

      -
      LOCK STEERING TO VCRS(SHIP:VELOCITY:ORBIT, BODY:POSITION).
      -
      -
      -
      -
      -
      - -

      Like all LOCK expressions, the steering and throttle continually update on their own when using this style of control. If you lock your steering to velocity, then as your velocity changes, your steering will change to match it. Unlike with other LOCK expressions, the steering and throttle are special in that the lock expression gets executed automatically all the time in the background, while other LOCK expressions only get executed when you try to read the value of the variable. The reason is that the kOS computer is constantly querying the lock expression multiple times per second as it adjusts the steering and throttle in the background.

      -
      -

      Unlocking controls

      -

      If you LOCK the THROTTLE or STEERING, be aware that this prevents the user from manually controlling them. Until they unlock, the manual controls are prevented from working. You can free up the controls by issuing these two commands:

      -
      UNLOCK STEERING.
      -UNLOCK THROTTLE.
      -
      -
      -

      When the program ends, these automatically unlock as well, which means that to control a craft you must make sure the program doesn’t end. The moment it ends it lets go of the controls.

      -
      -
      -

      Advantages/Disadvantages

      -

      The advantge of “Cooked” control is that it is simpler to write scripts for, but the disadvantage is that you have no control over the details of the motion. You can’t dictate how fast or slow the craft rotates, or which axis it tries to rotate around first, and if your craft is wobbly, you can’t dampen the wobbliness.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Flight Control

      -

      Next topic

      -

      Raw Control

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/flight/pilot.html b/commands/flight/pilot.html deleted file mode 100644 index f88f8b201..000000000 --- a/commands/flight/pilot.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - - Pilot Input — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Pilot Input

      -

      This is not, strictly speaking, a method of controlling the craft. “Pilot” controls are a way to read the input from the pilot. Most of these controls share the same name as their flight control, prefixed with PILOT (eg YAW and PILOTYAW) the one exception to this is the PILOTMAINTHROTTLE. This suffix has a setter and allows you to change the behavior of the throttle that persists even after the current program ends:

      -
      SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.
      -
      -
      -

      Will ensure that the throttle will be 0 when execution stops. These suffixes allow you to read the input given to the system by the user.

      -
      -
      -structure Control
      -
      - - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType, RangeEquivalent Key
      PILOTMAINTHROTTLEscalar [0,1]LEFT-CTRL, LEFT-SHIFT
      PILOTYAWscalar [-1,1]D, A
      PILOTPITCHscalar [-1,1]W, S
      PILOTROLLscalar [-1,1]Q, E
      PILOTROTATIONVector(YAW,PITCH,ROLL)
      PILOTYAWTRIMscalar [-1,1]ALT+D, ALT+A
      PILOTPITCHTRIMscalar [-1,1]ALT+W, ALT+S
      PILOTROLLTRIMscalar [-1,1]ALT+Q, ALT+E
      PILOTFOREscalar [-1,1]N, H
      PILOTSTARBOARDscalar [-1,1]L, J
      PILOTTOPscalar [-1,1]I, K
      PILOTTRANSLATIONVector(FORE,STARBOARD,TOP)
      PILOTWHEELSTEERscalar [-1,1]A, D
      PILOTWHEELTHROTTLEscalar [-1,1]W, S
      PILOTWHEELSTEERTRIMscalar [-1,1]ALT+A, ALT+D
      PILOTWHEELTHROTTLETRIMscalar [-1,1]ALT+W, ALT+S
      PILOTNEUTRALbooleanIs kOS Controlling?
      -
      -
      -SHIP:CONTROL:MAINTHROTTLE
      -

      Returns the pilot’s input for the throttle. This is the only PILOT variable that is settable and is used to set the throttle upon termination of the current kOS program.

      -
      - -
      -
      -SHIP:CONTROL:YAW
      -

      Returns the pilot’s rotation input about the “up” vector as the pilot faces forward. Essentially left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:PITCH
      -

      Returns the pilot’s rotation input about the starboard vector up \((+1)\) or down \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROLL
      -

      Returns the pilot’s rotation input about the logintudinal axis of the ship left-wing-down \((-1)\) or left-wing-up \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROTATION
      -

      Returns the pilot’s rotation input as a Vector object containing (YAW, PITCH, ROLL) in that order.

      -
      - -
      -
      -SHIP:CONTROL:YAWTRIM
      -

      Returns the pilot’s input for the YAW of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:PITCHTRIM
      -

      Returns the pilot’s input for the PITCH of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:ROLLTRIM
      -

      Returns the pilot’s input for the ROLL of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:FORE
      -

      Returns the the pilot’s input for the translation of the ship forward \((+1)\) or backward \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:STARBOARD
      -

      Returns the the pilot’s input for the translation of the ship to the right \((+1)\) or left \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TOP
      -

      Returns the the pilot’s input for the translation of the ship up \((+1)\) or down \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TRANSLATION
      -

      Returns the the pilot’s input for translation as a Vector (FORE, STARBOARD, TOP).

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEER
      -

      Returns the the pilot’s input for wheel steering left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLE
      -

      Returns the the pilot’s input for the wheels to move the ship forward \((+1)\) or backward \((-1)\) while on the ground.

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEERTRIM
      -

      Returns the the pilot’s input for the trim of the wheel steering.

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLETRIM
      -

      Returns the the pilot’s input for the trim of the wheel throttle.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRAL
      -

      Returns true or false if the pilot is active or not.

      -
      - -

      Be aware that kOS can’t control a control at the same time that a player controls it. If kOS is taking control of the yoke, then the player can’t manually control it. Remember to run:

      -
      SET SHIP:CONTROL:NEUTRALIZE TO TRUE.
      -
      -
      -

      after the script is done using the controls, or the player will be locked out of control.

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Raw Control

      -

      Next topic

      -

      Ship Systems

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/flight/raw.html b/commands/flight/raw.html deleted file mode 100644 index 5d92cd781..000000000 --- a/commands/flight/raw.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - Raw Control — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Raw Control

      -

      If you wish to have your kOS script manipulate a vessel’s flight controls directly in a raw way, rather than relying on kOS to handle the flying for you, then this is the type of structure you will need to use to do it. This is offered as an alternative to using the combination of LOCK STEERING and LOCK THROTTLE commands. To obtain the CONTROL variable for a vessel, use its :CONTROL suffix:

      -
      SET controlStick to SHIP:CONTROL.
      -SET controlStick:PITCH to 0.2.
      -
      -
      -

      Unlike with so-called “Cooked” steering, “raw” steering uses the SET command, not the LOCK command. Using LOCK with these controls won’t work. When controlling the ship in a raw way, you must decide how to move the controls in detail. Here is another example:

      -
      SET SHIP:CONTROL:YAW to 0.2.
      -
      -
      -

      This will start pushing the ship to rotate a bit faster to the right, like pushing the D key gently. All the following values are set between \(-1\) and \(+1\). Zero means the control is neutral. You can set to values smaller in magnitude than \(-1\) and \(+1\) for gentler control:

      -
      print "Gently pushing forward for 3 seconds.".
      -SET SHIP:CONTROL:FORE TO 0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 3.
      -SET SHIP:CONTROL:FORE to 0.0.
      -
      -print "Gently Pushing leftward for 3 seconds.".
      -SET SHIP:CONTROL:STARBOARD TO -0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 3.
      -SET SHIP:CONTROL:STARBOARD to 0.0.
      -
      -print "Starting an upward rotation.".
      -SET SHIP:CONTROL:PITCH TO 0.2.
      -SET now to time:seconds.
      -WAIT until time:seconds > now + 0.5.
      -SET SHIP:CONTROL:PITCH to 0.0.
      -
      -print "Giving control back to the player now.".
      -SET SHIP:CONTROL:NEUTRALIZE to True.
      -
      -
      -

      One can use SHIP:CONTROL:ROTATION and SHIP:CONTROL:TRANSLATION to see the ship’s current situation.

      -
      -

      Raw Flight Controls Reference

      -

      These “Raw” controls allow you the direct control of flight parameters while the current program is running.

      -
      -

      Note

      -

      The MAINTHROTTLE requires active engines and, of course, sufficient and appropriate fuel. The rotational controls YAW, PITCH and ROW require active reaction wheels with sufficient energy or RCS to be ON with properly placed thrusters and appropriate fuel. The translational controls FORE, STARBOARD and TOP require RCS to be ON with properly placed thrusters and appropriate fuel.

      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType, RangeEquivalent Key
      MAINTHROTTLEscalar [0,1]LEFT-CTRL, LEFT-SHIFT
      YAWscalar [-1,1]D, A
      PITCHscalar [-1,1]W, S
      ROLLscalar [-1,1]Q, E
      ROTATIONVector(YAW,PITCH,ROLL)
      YAWTRIMscalar [-1,1]ALT+D, ALT+A
      PITCHTRIMscalar [-1,1]ALT+W, ALT+S
      ROLLTRIMscalar [-1,1]ALT+Q, ALT+E
      FOREscalar [-1,1]N, H
      STARBOARDscalar [-1,1]L, J
      TOPscalar [-1,1]I, K
      TRANSLATIONVector(FORE,STARBOARD,TOP)
      WHEELSTEERscalar [-1,1]A, D
      WHEELTHROTTLEscalar [-1,1]W, S
      WHEELSTEERTRIMscalar [-1,1]ALT+A, ALT+D
      WHEELTHROTTLETRIMscalar [-1,1]ALT+W, ALT+S
      NEUTRALbooleanIs kOS Controlling?
      NEUTRALIZEbooleanReleases Control
      -
      -
      -SHIP:CONTROL:MAINTHROTTLE
      -

      Set between 0 and 1 much like the cooked flying LOCK THROTTLE command.

      -
      - -
      -
      -SHIP:CONTROL:YAW
      -

      This is the rotation about the “up” vector as the pilot faces forward. Essentially left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:PITCH
      -

      Rotation about the starboard vector up \((+1)\) or down \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROLL
      -

      Rotation about the logintudinal axis of the ship left-wing-down \((-1)\) or left-wing-up \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:ROTATION
      -

      This is a Vector object containing (YAW, PITCH, ROLL) in that order.

      -
      - -
      -
      -SHIP:CONTROL:YAWTRIM
      -

      Controls the YAW of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:PITCHTRIM
      -

      Controls the PITCH of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:ROLLTRIM
      -

      Controls the ROLL of the rotational trim.

      -
      - -
      -
      -SHIP:CONTROL:FORE
      -

      Controls the translation of the ship forward \((+1)\) or backward \((-1)\).

      -
      - -
      -
      -SHIP:CONTROL:STARBOARD
      -

      Controls the translation of the ship to the right \((+1)\) or left \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TOP
      -

      Controls the translation of the ship up \((+1)\) or down \((-1)\) from the pilot’s perspective.

      -
      - -
      -
      -SHIP:CONTROL:TRANSLATION
      -

      Controls the translation as a Vector (FORE, STARBOARD, TOP).

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEER
      -

      Turns the wheels left \((-1)\) or right \((+1)\).

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLE
      -

      Controls the wheels to move the ship forward \((+1)\) or backward \((-1)\) while on the ground.

      -
      - -
      -
      -SHIP:CONTROL:WHEELSTEERTRIM
      -

      Controls the trim of the wheel steering.

      -
      - -
      -
      -SHIP:CONTROL:WHEELTHROTTLETRIM
      -

      Controls the trim of the wheel throttle.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRAL
      -

      Returns true or false depending if kOS has any set controls. This is not settable.

      -
      - -
      -
      -SHIP:CONTROL:NEUTRALIZE
      -

      This causes manual control to let go. When set to true, kOS lets go of the controls and allows the player to manually control them again. This is not gettable.

      -
      - -
      -
      -

      Unlocking controls

      -

      Once any of the SET SHIP:CONTROL commands have been used to control the ship, then the manual control by the player is locked out. To give control back to the player you must execute:

      -
      SET SHIP:CONTROL:NEUTRALIZE to TRUE.
      -
      -
      -
      -
      -

      Advantages/Disadvantages

      -

      The control over RCS translation requires the use of Raw control. Also, with raw control you can choose how gentle to be with the controls and it can be possible to control wobbly craft better with raw control than with cooked control.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Cooked Control

      -

      Next topic

      -

      Pilot Input

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/flight/systems.html b/commands/flight/systems.html deleted file mode 100644 index 0f307261a..000000000 --- a/commands/flight/systems.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - Ship Systems — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Ship Systems

      -
      -
      -SET somepart:CONTROLFROM TO (true|false).
      -

      If you have a handle on a part, from LIST PARTS, you can select that part to set the orientation of the craft, just like using the “control from here” in the right-click menu in the game. For more information see Part:CONTROLFROM.

      -
      - -
      -
      -RCS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the RCS on or off, like using R at the keyboard:

      -
      RCS ON.
      -
      -
      -
      - -
      -
      -SAS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the SAS on or off, like using T at the keybaord:

      -
      SAS ON.
      -
      -
      -
      - -
      -
      -LIGHTS
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the lights on or off, like using the U key at the keyboard:

      -
      LIGHTS ON.
      -
      -
      -
      - -
      -
      -BRAKES
      -
      --- - - - -
      Access:Toggle ON/OFF
      -

      Turns the brakes on or off, like clicking the brakes button, though not like using the B key, because they stay on:

      -
      BRAKES ON.
      -
      -
      -
      - -
      -
      -TARGET
      -
      --- - - - - - -
      Access:Get/Set
      Type:string
      -

      Where name is the name of a target vessel or planet, this will set the current target:

      -
      SET TARGET TO name.
      -
      -
      -
      - -

      Note that the above options also can refer to a different vessel besides the current ship, for example, TARGET:THROTTLE to read the target’s throttle. But not all “set” or “lock” options will work with a different vessel other than the current one, because there’s no authority to control a craft the current program is not attached to.

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Pilot Input

      -

      Next topic

      -

      Time Warping

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/flight/warp.html b/commands/flight/warp.html deleted file mode 100644 index a7651659b..000000000 --- a/commands/flight/warp.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - Time Warping — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Time Warping

      -
      -
      -WARP
      -
      -The :global:`WARP` global variable can be set to change the game warp to a value between 0 and 7::
      -
      -
      SET WARP TO 5. // Sets warp to 1000x -SET WARP TO 0. // Sets warp to 0x (real time)
      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Ship Systems

      -

      Next topic

      -

      Predictions of Flight Path

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/list.html b/commands/list.html deleted file mode 100644 index 574e137af..000000000 --- a/commands/list.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - LIST Command — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      LIST Command

      -

      A List is a type of Structure that stores a list of variables in it. The LIST command either prints or crates a List object containing items queried from the game. For more information, see the page about the List structure.

      -
      -

      FOR Loop

      -

      Lists need to be iterated over sometimes, to help with this we have the FOR loop, explained on the flow control page. The LIST Command comes in 4 forms:

      -
        -
      1. -
        LIST.
        -

        When no parameters are given, the LIST command is exactly equivalent to the command:

        -
        LIST FILES.
        -
        -
        -
        -
        -
      2. -
      3. -
        LIST ListKeyword.
        -

        This variant prints items to the termianl sceen. Depending on the ListKeyword used (see below), different values are printed.

        -
        -
        -
      4. -
      5. -
        LIST ListKeyword IN YourVariable.
        -

        This variant takes the items that would otherwise have been printed to the terminal screen, and instead makes a List of them in YourVariable, that you can then iterate over with a FOR loop if you like.

        -
        -
        -
      6. -
      7. -
        LIST ListKeyword FROM SomeVessel IN YourVariable.
        -

        This variant is just like variant (3), except that it gives a list of the items that exist on some other vessel that might not necessarily be the current CPU_vessel.

        -
        -
        -
      8. -
      -
      -
      -

      Available Listable Keywords

      -

      The ListKeyword in the above command variants can be any of the -following:

      -
      -

      Universal Lists

      -

      These generate lists that are not dependent on which Vessel:

      -
      -
      Bodies
      -
      List of Celestial Bodies
      -
      Targets
      -
      List of possible target Vessels
      -
      -
      -
      -

      Vessel Lists

      -

      These generate lists of items on the Vessel:

      -
      -
      Resources
      -
      List of Resources
      -
      Parts
      -
      List of Parts
      -
      Engines
      -
      List of Engines
      -
      Sensors
      -
      List of Sensors
      -
      Elements
      -
      ??
      -
      DockingPorts
      -
      list of DockingPorts <DockingPort>
      -
      -
      -
      -

      File System Lists

      -

      These generate lists about the files in the system:

      -
      -
      Files
      -
      List the files on the current Volume. (note below)
      -
      Volumes
      -
      List all the Files and Volumes that exist.
      -
      -
      -

      Note

      -

      LIST FILES. is the default if you give the LIST command no parameters.

      -
      -

      Examples:

      -
      LIST.  // Prints the list of files on current volume.
      -LIST FILES.  // Does the same exact thing, but more explicitly.
      -LIST VOLUMES. // which volumes can be seen by this CPU?
      -LIST FILES IN fileList. // fileList is now a LIST() containing file structures.
      -
      -
      -

      The file structures returned by LIST FILES IN fileList. are documented on a separate page.

      -

      Here are some more examples:

      -
      // Prints the list of all
      -// Celestial bodies in the system.
      -LIST BODIES.
      -
      -// Puts the list of bodies into a variable.
      -LIST BODIES IN bodList.
      -// Iterate over everything in the list:
      -SET totMass to 0.
      -FOR bod in bodList {
      -    SET totMass to totMass + bod:MASS.
      -}.
      -PRINT "The mass of the whole solar system is " + totMass.
      -
      -// Adds variable foo that contains a list of
      -// resources for my currently target vessel
      -LIST RESOURCES FROM TARGET IN foo.
      -FOR res IN foo {
      -    PRINT res:NAME. // Will print the name of every
      -                    // resource in the vessel
      -}.
      -
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Predictions of Flight Path

      -

      Next topic

      -

      Querying a vessel’s parts

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/parts.html b/commands/parts.html deleted file mode 100644 index 6b89af318..000000000 --- a/commands/parts.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - Querying a vessel’s parts — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Querying a vessel’s parts

      -

      This is a quick list to get the idea across fast. The actual -details of the meaning of these things is complex enough to -warrant its own -topic.

      -

      To get the parts of a vessel (such as your current vessel, -called SHIP), you can do the following things:

      -

      These are equivalent. They get the full list of all the parts:

      -
      LIST PARTS IN MyPartList.
      -SET MyPartlist TO SHIP:PARTS.
      -
      -
      -

      This gets all the parts that have the name given, as either a -nametag (Part:TAG), a title (Part:TITLE), or a name, (Part:NAME):

      -
      SET MyPartList to SHIP:PARTSDUBBED("something").
      -
      -
      -

      These are other ways to get parts that are more specific about what -exact nomenclature system is being used:

      -
      SET MyPartList to SHIP:PARTSTAGGED("something"). // only gets parts with Part:TAG = "something".
      -SET MyPartList to SHIP:PARTSTITLED("something"). // only gets parts with Part:TITLE = "something".
      -SET MyPartList to SHIP:PARTSNAMED("something"). // only gets parts with Part:NAME = "something".
      -
      -
      -

      This gets all the PartModules on a ship that have the same module name:

      -
      SET MyModList to SHIP:MODULESNAMED("something").
      -
      -
      -

      This gets all the parts that have been defined to have some sort -of activity occur from a particular action group:

      -
      SET MyPartList to SHIP:PARTSINGROUP( AG1 ). // all the parts in action group 1.
      -
      -
      -

      This gets all the modules that have been defined to have some sort -of activity occur from a particular action group:

      -
      SET MyModList to SHIP:MODULESINGROUP( AG1 ). // all the parts in action group 1.
      -
      -
      -

      This gets the primary root part of a vessel (the command core that you -placed FIRST when building the ship in the VAB or SPH):

      -
      SET firstPart to SHIP:ROOTPART.
      -
      -
      -

      This lets you query all the parts that are immediate children of the -current part in the tree:

      -
      SET firstPart to SHIP:ROOTPART.
      -FOR P IN firstPart:CHILDREN {
      -  print "The root part as an immediately attached part called " + P:NAME.
      -}.
      -
      -
      -

      You could keep walking down the tree this way, or go upward with PARENT -and HASPARENT:

      -
      IF thisPart:HASPARENT {
      -  print "This part's parent part is "+ thisPart:PARENT:NAME.
      -}.
      -
      -
      -

      This tree method of walking the parts is slightly less useful because -user -functions don’t exist, making recursive algorithms messy to implement.

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      LIST Command

      -

      Next topic

      -

      File I/O

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/prediction.html b/commands/prediction.html deleted file mode 100644 index b31a448b4..000000000 --- a/commands/prediction.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - Predictions of Flight Path — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Predictions of Flight Path

      -
      -

      Note

      -

      Manipulating the maneuver nodes

      -

      To alter the maneuver nodes on a vessel’s flight plan, use the ADD and REMOVE commands as described on the maneuver node manipulation page.

      -

      Using the Add and Remove commands as described on that page, you may alter the flight plan of the CPU_vessel, however kOS does not automatically execute the nodes. You still have to write the code to decide how to successfully execute a planned maneuver node.

      -
      -

      The following prediction functions do take into account the future maneuver nodes planned, and operate under the assumption that they will be executed as planned.

      -

      These return predicted information about the future position and velocity of an object.

      -
      -
      -POSITIONAT(orbitable,time)
      -
      --- - - - - - - - - - -
      Parameters: -
      Type orbitable:

      Orbitable

      -
      Type time:

      Timestamp

      -
      Returns:

      A position Vector expressed as the coordinates in the ship-center-raw-rotation frame

      -
      -

      Returns a prediction of where the Orbitable will be at some universal Timestamp. If the Orbitable is a Vessel, and the Vessel has planned maneuver nodes, the prediction assumes they will be executed exactly as planned.

      -
      - -
      -
      -VELOCITYAT(orbitable,time)
      -
      --- - - - - - - - - - -
      Parameters: -
      Type orbitable:

      Orbitable

      -
      Type time:

      Timestamp

      -
      Returns:

      An ObitalVelocity structure.

      -
      -

      Returns a prediction of what the Orbitable’s velocity will be at some universal Timestamp. If the Orbitable is a Vessel, and the Vessel has planned maneuver nodes, the prediction assumes they will be executed exactly as planned.

      -
      - -
      -
      -ORBITAT(orbitable,time)
      -
      --- - - - - - - - - - -
      Parameters: -
      Type orbitable:

      Orbitable

      -
      Type time:

      Timestamp

      -
      Returns:

      An Orbit structure.

      -
      -

      Returns the Orbit patch where the Orbitable object is predicted to be at some universal Timestamp. If the Orbitable is a Vessel, and the Vessel has planned maneuver nodes, the prediction assumes they will be executed exactly as planned.

      -
      - -

      Examples:

      -
      //kOS
      -// test the future position and velocity prediction.
      -// Draws a position and velocity vector at a future predicted time.
      -
      -declare parameter item. // thing to predict for, i.e. SHIP.
      -declare parameter offset. // how much time into the future to predict.
      -declare parameter velScale. // how big to draw the velocity vectors.
      -              // If they're far from the camera you should draw them bigger.
      -
      -
      -set predictUT to time + offset.
      -set stopProg to false.
      -
      -set futurePos to positionat( item, predictUT ).
      -set futureVel to velocityat( item, predictUT ).
      -
      -set drawPos to vecdrawargs( v(0,0,0), futurePos, green, "future position", 1, true ).
      -set drawVel to vecdrawargs( futurePos, velScale*futureVel:orbit, yellow, "future velocity", 1, true ).
      -
      -
      -

      Example Screenshot:

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Time Warping

      -

      Next topic

      -

      LIST Command

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/commands/terminal.html b/commands/terminal.html deleted file mode 100644 index b13ef1719..000000000 --- a/commands/terminal.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - Terminal and game environment — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Terminal and game environment

      -
      -
      -CLEARSCREEN
      -

      Clears the screen and places the cursor at the top left:

      -
      CLEARSCREEN.
      -
      -
      -
      - -
      -
      -PRINT
      -

      Prints the selected text to the screen. Can print strings, or the result of an expression:

      -
      PRINT “Hello”.
      -PRINT 4+1.
      -PRINT “4 times 8 is: “ + (4*8).
      -
      -
      -
      - -
      -
      -AT(col,line)
      -
      --- - - - -
      Parameters:
        -
      • col – (integer) column starting with zero (left)
      • -
      • line – (integer) line starting with zero (top)
      • -
      -
      -

      Used in combination with PRINT. Prints the selected text to the screen at specified location. Can print strings, or the result of an expression:

      -
      PRINT “Hello” AT(0,10).
      -PRINT 4+1 AT(0,10).
      -PRINT “4 times 8 is: “ + (4*8) AT(0,10).
      -
      -
      -
      - -
      -
      -MAPVIEW
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      A variable that controls or queries whether or not the game is in map view:

      -
      IF MAPVIEW {
      -    PRINT "You are looking at the map.".
      -} ELSE {
      -    PRINT "You are looking at the flight view.".
      -}.
      -
      -
      -

      You can switch between map and flight views by setting this variable:

      -
      SET MAPVIEW TO TRUE.  // to map view
      -SET MAPVIEW TO FALSE. // to flight view
      -
      -
      -
      - -
      -
      -REBOOT
      -

      Reboots the kOS module.

      -
      - -
      -
      -SHUTDOWN
      -

      Causes kOS module to shutdown.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      File I/O

      -

      Next topic

      -

      Structure Reference

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/contribute.html b/contribute.html deleted file mode 100644 index a1895f035..000000000 --- a/contribute.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - Contribute — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Contribute

      -
      -

      How to Contribute to this Project

      -

      Do you know or are willing to learn C# and the KSP public API? Great, we could use your help! The source code for kOS is kept on github and is currently maintained by Chris Woerz and Steven Mading. The first steps you will want to take is to clone the latest version of kOS from github and try to build it using your favorite C# compiler suite.

      -
      -
      -

      How to Edit this Documentation

      -

      This documentation was written using reStructuredText and compiled into HTML using Sphinx and the Read The Docs Theme. It is maintained by Steven Mading, Chris Woerz and Johann Goetz

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Drawing Vectors on the Screen

      -

      Next topic

      -

      About kOS and KerboScript

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general.html b/general.html deleted file mode 100644 index 973a8d4a3..000000000 --- a/general.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - General Topics — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/general/applauncher_panel.html b/general/applauncher_panel.html deleted file mode 100644 index 3f119b522..000000000 --- a/general/applauncher_panel.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - kOS Control Panel — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      kOS Control Panel

      -

      As of kOS v0.15, kOS now makes use of Kerbal Space Program’s built-in -Application Launcher toolbar, to open a config/status panel for kOS.

      -

      This panel behaves like the other display panels the launcher creates, -and operates mutually exclusively with them. (For example you can’t -make the kOS App Control Panel appear at the same time as the stock -Resource display panel. Opening one toggles the other one off, -and visa versa.)

      -

      Here is an annotated image of the control panel and what it does:

      -
      -../_images/applauncher_panel.png -
      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      The kOS CPU hardware

      -

      Next topic

      -

      Files and Volumes

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/comm_range.html b/general/comm_range.html deleted file mode 100644 index a4ccf371f..000000000 --- a/general/comm_range.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - Communication Range For Remote Updates — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Communication Range For Remote Updates

      -
      -

      Warning

      -
      -

      Deprecated since version 0.12.2: The stock game and the future of this feature is still fuzzy, and will likely be related to RemoteTech2 in some way. If you don’t use RemoteTech2, then there will be no check for range anymore as of version 0.12.2. The following shortcuts are now used.

      -
      -
      COMMRANGE
      -
      always returns a Very Big Number, and
      -
      INRANGE
      -
      always returns true.
      -
      -

      If you are using a version of kOS >= 0.12.2, then most of what this page says won’t be true.

      -
      -
      -
      -

      Communication Range (Deprecated)

      -

      Kerbin must be within CommRange of the vessel in order for the following operations to work:

      -
        -
      • COPY a file from a local volume to Archive
      • -
      • COPY a file from Archive to a local volume.
      • -
      • LIST the files on the Archive.
      • -
      -

      You can always find out whether or not the vessel is within transmission range of Kerbin using the following:

      -
        -
      • PRINT COMMRANGE. // Shows a number, in meters.
      • -
      • PRINT INCOMMRANGE. // Shows a boolean true/false, for whether or not -you are in range.
      • -
      -

      A future plan is to implement a feature that when the RemoteTech mod is installed, kOS will query RemoteTech to ask whether or not the vessel is in communications range, and allow RemoteTech to override the calculation described below.

      -

      The system described below is meant to be used only when RemoteTech2 is not installed.

      -
      -

      How to calculate communications range

      -

      Communications range is decided by how many antennae are installed, and of what type. There are three categories of antenna:

      -
        -
      • longAntenna: (The Communotron 16 ‘stick’)
      • -
      • mediumDishAntenna: (The Comms DTS-M1)
      • -
      • commDish: (The Communotron 88-88)
      • -
      -

      The number of meters of range is decided by this formula:

      -

      max range = ( (100,000 + L*1,000,000) *100^M * 200^D ) meters Where: * L = number of longAntenna’s on the vessel. * M = number of mediumDishAntenna’s on the vessel. * D = number of commDish’s on the vessel.

      - ------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      No. of AntennaeMax rangeContext for comparison
      LongMedium -DishDish
      000100 km 
      1001100 km 
      2002100 km 
      01010,000 km 
      00120,000 kmMun-to-Kerbin = 12,000 km
      101220,000 km 
      201420,000 km 
      0201,000,000 km 
      0024,000,000 kmAlmost the closest distance -Moho gets to the Sun
      11122,000,000 km 
      10244,000,000 kmA bit bigger than the ‘diameter’ -of Duna’s orbit of the Sun
      20284,000,000 kmA bit bigger than the biggest -distance between Jool and the Sun
      302124,000,000 kmA bit bigger than the biggest -distance between Eeloo and the Sun
      1212,200,000,000 km 
      1038,800,000,000 kmLarger than any distance in the -Kerbal system
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Ship Parts and PartModules

      -

      Next topic

      -

      The KerboScript Language

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/compiling.html b/general/compiling.html deleted file mode 100644 index 26d8e4af7..000000000 --- a/general/compiling.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - KerboScript Machine Code — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      KerboScript Machine Code

      - -
      -

      Compiling to a KSM File

      -

      When you run your Kerboscript programs, behind the scenes they get compiled into a form in memory that runs much smoother but at the same time is quite hard for a Kerbal to read and understand. The actual computer hardware built by your friends at Compotronix incorporated actually run the program using these tiny instructions called “opcodes”. In the early days of room-sized computers before we were able to get them down to the compact size of just a meter or so across, all programmers had to use this difficult system, referred to as “machine language”. Ah, those were heady days, but they were hard.

      -

      The commands you actually write when you say something like SET X TO 1.0. are really a euphemism for these “machine language” opcodes under the surface.

      -

      When you try to “RUN” your script, the first thing that kOS does is transform your script into this ancient and arcane “machine language” form, storing it in its memory, and from then on it runs using that.

      -

      This process of transforming your script into Machine Language, or “ML” is called “Compiling”.

      -

      The “RUN” command does this silently, without telling you. This is why you may have noticed the universe slightly stutter for a moment when you first run your program. Compiling is hard work for the universe to do.

      -
      -

      Why Do I Care?

      -
      -

      Warning

      -

      This is an experimental feature.

      -
      -

      The reason it matters is this: Although once it’s loaded into memory and running, these opcodes actually have a lot of baggage and take up a lot of space, when they’re stored passively on the disk not doing anything, they can be smaller than your script programs are. For one thing, they don’t care about your comments (only other Kerbals reading your script do), and they don’t care about your indenting (only other Kerbals reading your script do).

      -

      So, given that the compiled “ML” codes are the only thing your program really needs to be run, why not just store THAT instead of storing the entire script, and then you can put the ML files on your remote probes instead of putting the larger script files on them.

      -

      And THAT is the purpose of the COMPILE command.

      -

      It does some, but not all, of the compiling work that the RUN command does, and then stores the results in a file that you can run instead of running the original script.

      -

      The output of the COMPILE command is a file in what we call KSM format.

      -

      KSM stands for “KerboScript Machine code”, and it has nearly the same information the program will have when it’s loaded and running, minus a few extra steps about relocating it in memory.

      -
      -
      -
      -

      How to Use KSM Files

      -

      Let’s say that you have 3 programs your probe needs, called:

      -
        -
      • myprog1.ks
      • -
      • myprog2.ks
      • -
      • myprog3.ks
      • -
      -

      And that myprog1 calls myprog2 and myprog3, and you normall would call the progam this way:

      -
      SWITCH TO 1.
      -COPY myprog1 from ARCHIVE.
      -COPY myprog2 from ARCHIVE.
      -COPY myprog3 from ARCHIVE.
      -RUN myprog1(1,2,"hello").
      -
      -
      -

      Then you can put just the compiled KSM versions of them on your vessel and run it this way:

      -
      SWITCH TO ARCHIVE.
      -
      -COMPILE myprog1.ks to myprog1.ksm.
      -COPY myprog1.ksm to 1.
      -
      -COMPILE myprog2. // If you leave the arguments off, it assumes you are going from .ks to .ksm
      -COPY myprog2.ksm to 1.
      -
      -COMPILE myprog3. // If you leave the arguments off, it assumes you are going from .ks to .ksm
      -COPY myprog2.ksm to 1.
      -
      -SWITCH TO 1.
      -RUN myprog1(1,2,"hello").
      -
      -
      -
      -
      -

      Default File Naming Conventions

      -

      When you have both a .ks and a .ksm file, the RUN command allows you to specify which one you meant explicitly, like so:

      -
      RUN myprog1.ks.
      -RUM myprog1.ksm.
      -
      -
      -

      But if you just leave the file extension off, and do this:

      -
      RUN myprog1.
      -
      -
      -

      Then the RUN command will first try to run a file called “myprog1.ksm” and if it cannot find such a file, then it will try to run one called “myprog1.ks”.

      -

      In this way, if you decide to take the plunge and attempt the use of KSM files, you shouldn’t have to change the way any of your scripts call each other, provided you just used versions of the filenames without mentioning the file extensions.

      -
      -
      -

      Downsides to Using KSM Files

      -
        -
      1. Be aware that if you use this feature, you do lose the ability to have the line of code printed out for you when the kOS computer finds an error in your program. It will still tell you what line number the error happened on, but it cannot show you the line of code. Just the number.
      2. -
      3. Know that you cannot view the program inside the in-game editor anymore when you do this. A KSM file will not appear right in the editor. It requires a magic tool called a “hex editor” to properly see what’s happening inside the file.
      4. -
      5. The file isn’t always smaller. There’s a threshold at which the KSM file is actually bigger than the source KS file. For large KS files, the KSM file will be smaller, but for short KS files, the KSM file will be bigger, because there’s a small amount of overhead they have to store that is only efficient if the data was large enough.
      6. -
      -
      -
      -

      More Reading and Fiddling with Your Bits

      -

      So, if you are intrigued by all this and want to see how it all REALLY works under the hood, Computronix has deciced to make internal document MLfile-zx1/a on the basic plan of the ML file system open for public viewing, if you are one of those rare Kerbals that enjoys fiddling with your bits. No, not THOSE kind of bits, the computery kind!

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Files and Volumes

      -

      Next topic

      -

      The Name Tag System

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/cpu_hardware.html b/general/cpu_hardware.html deleted file mode 100644 index 701367ad1..000000000 --- a/general/cpu_hardware.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - The kOS CPU hardware — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      The kOS CPU hardware

      -

      While it’s possible to write some software without knowing anything about the underlying computer hardware, and there are good design principles that state one should never make assumptions about the computer hardware when writing software, there are still some basic things about how computers work in general that a good programmer needs to be aware of to write good code. Along those lines, the KSP player writing a Kerboscript program needs to know a few basic things about how the simulated kOS CPU operates in order to be able to write more advanced scripts. This page contains that type of information.

      - -
      -

      Update Ticks and Physics Ticks

      -

      Kerbal Space Program simulates the universe by running the universe in small incremental time intervals that for the purpose of this document, we will call “physics ticks”. The exact length of time for a physics tick varies as the program runs. One physics tick might take 0.09 seconds while the next one might take 0.085 seconds. (The default setting for the rate of physics ticks is 25 ticks per second, just to give a ballpark figure, but you must not write any scripts that depend on this assumption because it’s a setting the user can change, and it can also vary a bit during play depending on system load. The setting is a target goal for the game to try to achieve, not a guarantee. If it’s a fast computer with a speedy animation frame rate, it will try to run physics ticks less often than it runs animation frame updates, to try to make the physics tick rate match this setting. On the other hand, If it’s a slow computer, it will try to sacrifice animation frame rate to archive this number (meaning physics get calculated faster than you can see the effects.) The game will try as hard as it can to keep the physics rate matched to the setting, not faster and not slower, because when the physics rate isn’t steady, the simulation breaks down and starts making erroneous things happen, like miscalculating forces on part joints and breaking ships. But however hard the game tries to stick to the setting, it can’t do it 100% the same every single moment, thus the need to actually measure elapsed time in the TIME variable in your scripts.

      -

      The entire simulated universe is utterly frozen during the duration of a physics tick. For example, if one physics tick occurs at timestamp 10.51 seconds, and the next physics tick occurs 0.08 seconds later at timestamp 10.59 seconds, then during the entire intervening time, at timestamp 10.52 seconds, 10.53 seconds, and so on, nothing moves. The clock is frozen at 10.51 seconds, and the fuel isn’t being consumed, and the vessel is at the same position. On the next physics tick at 10.59 seconds, then all the numbers are updated. The full details of the physics ticks system are more complex than that, but that quick description is enough to describe what you need to know about how kOS’s CPU works.

      -

      There is another kind of time tick called an Update tick. It is similar to, but different from, a physics tick. Update ticks often occur a bit more often than physics ticks. Update ticks are exactly the same thing as your game’s Frame Rate. Each time your game renders another animation frame, it performs another Update tick. On a good gaming computer with fast speed and a good graphics card, It is typical to have about 2 or even 3 Update ticks happen within the time it takes to have one physics tick happen. On a slower computer, it is also possible to go the other way and have Update ticks happening less frequently than physics tics. Basically, look at your frame rate. Is it higher than 25 fps? If so, then your update ticks happen faster than your physics ticks, otherwise its the other way around.

      -
      -

      Note

      -

      The kOS CPU runs every update tick rather than every physics tick.

      -
      -

      On each update tick, each kOS CPU that’s within physics range (i.e. 2.5 km), wakes up and performs the following steps, in this order:

      -
        -
      1. Run the conditional checks of all TRIGGERS (see below)
      2. -
      3. For any TRIGGERS who’s conditional checks are true, execute the entire body of the trigger.
      4. -
      5. If there’s a pending WAIT statement, check if it’s done. If so wake up.
      6. -
      7. If awake, then execute the next Config:IPU number of instructions of the main program.
      8. -
      -

      Note that the number of instructions being executed (CONFIG:IPU) are NOT lines of code or kerboscript statements, but rather the smaller instruction opcodes that they are compiled into behind the scenes. A single kerboscript statement might become anywhere from one to ten or so instructions when compiled.

      -
      -
      -

      Triggers

      -

      There are multiple things within kerboscript that run “in the background” always updating, while the main script continues on. The way these work is a bit like a real computer’s multithreading, but not quite. Collectively all of these things are called “triggers”.

      -

      Triggers are all of the following:

      -
        -
      • LOCKS which are attached to flight controls (THROTTLE, STEERING, -etc), but not other LOCKS.
      • -
      • ON condition { some commands }.
      • -
      • WHEN condition THEN { some commands }.
      • -
      -

      The way these work is that once per update tick, all the LOCK expressions which directly affect flight control are re-executed, and then each conditional trigger’s condition is checked, and if true, then the entire body of the trigger is executed all the way to the bottom *before any more instructions of the main body are executed*. This means that execution of a trigger never gets interleaved with the main code. Once a trigger happens, the entire trigger occurs all in one go before the rest of the main body continues.

      -
      -

      Do Not Loop a Long Time in a Trigger Body!

      -

      Because the entire body of a trigger will execute all the way to the bottom on within a single update tick, before any other code continues, it is vital that you not write code in a trigger body that takes a long time to execute. The body of a trigger must be kept quick. An infinite loop in a trigger body could literally freeze all of KSP, because the kOS mod will never finish executing its update.

      -

      As of kOS version 0.14 and higher, this condition is now being checked for and the script will be terminated with a runtime error if the triggers like WHEN/THEN and ON take more than Config:IPU instructions to execute. The sum total of all the code within your WHEN/THEN and ON code blocks MUST be designed to complete within one update tick.

      -

      This may seem harsh. Ideally, kOS would only generate a runtime error if it thought your script was stuck in an infinite loop, and allow it to exceed the Config:IPU number of instructions if it was going to finish and just needed a little longer to to finish its work. But, because of a well known problem in computer science called `the halting problem <http://en.wikipedia.org/wiki/Halting_problem>`__, it’s literally impossible for kOS, or any other software for that matter, to detect the difference between another program’s infinite loop versus another program’s loop that will end soon. kOS only knows how long your triggers have taken so far, not how long they’re going to take before they’re done, or even if they’ll be done.

      -

      If you suspect that your trigger body would have ended if it was allowed to run a little longer, try setting your Config:IPU setting a bit higher and see if that makes the error go away.

      -

      If it does not make the error go away, then you will need to redesign your script to not depend on running a long-lasting amount of code inside triggers.

      -
      -
      -

      But I Want a Loop!!

      -

      If you want a trigger body that is meant to loop, the only acceptable way to do it is to design it to execute just once, but then use the PRESERVE keyword to keep the trigger around for the next update. Thus your trigger becomes a sort of “loop” that executes one iteration per update tick.

      -

      It is also important to consider the way triggers execute for performance reasons too. Every time you write an expression for a trigger, you are creating a bit of code that gets executed fully to the end before your main body will continue, once each update tick. A complex expression in a trigger condition, which in turn calls other complex LOCK expressions, which call other complex LOCK expressions, and so on, may cause kOS to bog itself down during each update. (And as of version 0.14, it may cause kOS to stop your program and issue a runtime error if it’s taking too long.)

      -

      Because of how WAIT works, you cannot put a WAIT statement inside a trigger. If you try, it will have no effect. This is because WAIT requires the ability of the program to go to sleep and then in a later update tick, continue from where it left off. Because triggers run to the bottom entirely within one update tick, they can’t do that.

      -
      -
      -

      Wait!!!

      -

      Any WAIT statement causes the kerboscript program to immediately stop executing the main program where it is, even if far fewer than Config:IPU instructions have been executed in this update tick. It will not continue the execution until at least the next update tick, when it will check to see if the WAIT condition is satisfied and it’s time to wake up and continue.

      -

      Therefore ANY WAIT of any kind will guarantee that your program will allow at least one update tick to have happened before continuing. If you attempt to:

      -
      WAIT 0.001.
      -
      -
      -

      But the duration of the next update tick is actually 0.09 seconds, then you will actually end up waiting at least 0.09 seconds. It is impossible to wait a unit of time smaller than one update tick. Using a very small unit of time in a WAIT statement is an effective way to force the CPU to allow a update tick to occur before continuing to the next line of code. Similarly, if you just say:

      -
      WAIT UNTIL TRUE.
      -
      -
      -

      Then even though the condition is immediately true, it will still wait one update tick to discover this fact and continue.

      -
      -
      -
      -

      The Frozen Universe

      -

      Each update tick, the kOS mod wakes up and runs through all the currently loaded CPU parts that are in “physics range” (i.e. 2.5 km), and executes a batch of instructions from your script code that’s on them. It is important to note that during the running of this batch of instructions, because no physics ticks are happening during it, none of the values that you might query from the KSP system will change. The clock time returned from the TIME variable will keep the same value throughout. The amount of fuel left will remain fixed throughout. The position and velocity of the vessel will remaining fixed throughout. It’s not until the next physics tick occurs that those values will change to new numbers. It’s typical that several lines of your kerboscript code will run during a single update tick.

      -

      Effectively, as far as the simulated universe can tell, it’s as if your script runs several instructions in literally zero amount of time, and then pauses for a fraction of a second, and then runs more instructions in literally zero amount of time, then pauses for a fraction of a second, and so on, rather than running the program in a smoothed out continuous way.

      -

      If your animation rate is slow enough, it gets even weirder. If your animation update ticks occur less often than your physics ticks, then it’s as if your program spends the majority of the time paused, and only occasionally wakes up to execute a short burst of instructions.

      -

      Because of the difference between update ticks and physics ticks, it’s entirely possible that your kOS script runs multiple updates in a row while the universe is still frozen, or it’s possible to go the other way around and have the universe move more than one physics tick before your program has time to notice and react. A well written kOS script should be able to handle both cases.

      -

      This is a vital difference between how a kOS CPU behaves versus how a real world computer behaves. In a real world computer, you would know for certain that time will pass, even if it’s just a few picoseconds, between the execution of one statement and the next.

      -
      -

      So Why Does This Matter?

      -

      The reason this matters is because of code that tries to do things like this: Imagine something like this inside a script designed to hover in place:

      -
      PRINT "Waiting until altitude is".
      -PRINT "holding stable within 0.1 meters.".
      -
      -SET PREV_ALT TO -99999. // bogus start value
      -UNTIL ABS( PREV_ALT - SHIP:ALTITUDE ) < 0.1 {
      -
      -  SET PREV_ALT TO SHIP:ALTITUDE.
      -
      -  // Assume there's fancy PID controller
      -  // commands here, omitted for this example.
      -
      -}
      -
      -
      -

      This bit of code, if you assume you’ve written a nice bit of code where the comment is, looks like it would make sense at first. It looks like it should work. It records the previous altitude at the start of the loop body, and if the altitude hasn’t changed by much by the start of the next loop, it assumes the altitude has become stable and it stops.

      -

      BUT, due to the frozen nature of the measurements during a physics tick, it’s entirely possible, and quite likely, that the loop would exit prematurely because no simulation time has passed between the two altitude measurements. The previous altitude and the current altitude are the same. Not because the vessel has no vertical motion, but because the loop is executing fast enough to finish more than one iteration within the same physics tick. The two altitude measurements are the same because no time has passed in the simulated universe.

      -
      -
      -

      The Fix: Wait for Time to Change

      -

      If you are executing a loop like the one above in which it is absolutely vital that the next iteration of the loop must occur in a different physics tick than the previous one, so that it can take new measurements that are different, the solution is to use a WAIT statement that will delay until there’s evidence that the physics clock has moved a tick.

      -

      The most effective way to do that is to check the TIME and see if it’s different than it was before. As long as you are still within the same physics tick, the TIME will not move:

      -
      PRINT "Waiting until altitude is holding stable within 0.1 meters.".
      -
      -SET PREV_ALT TO -99999. // bogus start value
      -UNTIL ABS( PREV_ALT - SHIP:ALTITUDE ) < 0.1 {
      -
      -  SET PREV_ALT TO SHIP:ALTITUDE.
      -
      -  // Assume there's fancy PID controller
      -  // commands here, omitted for this example.
      -
      -  SET TIMESTAMP TO TIME:SECONDS.
      -  WAIT UNTIL TIME:SECONDS > TIMESTAMP. // clock will not move
      -                                       // until we are in a new
      -                                       // physics tick.
      -}
      -
      -
      -
      -
      -

      A More Elegant Solution

      -

      Thanks to user Cairan, who suggested this very good idea in the -forums. You may put this code up near the top of your script:

      -
      // force it to trigger immediately the first time through
      -SET LASTPHYS TO -99999.
      -
      -LOCK PHYSICS TO MIN(1,FLOOR((TIME:SECONDS-LASTPHYS) / 0.04 )).
      -
      -WHEN PHYSICS THEN {
      -  SET LASTPHYS TO TIME:SECONDS.
      -
      -  // Store your measurements from
      -  // the physical world here during
      -  // the body of this WHEN
      -
      -  PRESERVE.
      -}
      -
      -
      -
      -
      -

      An Even Better Solution

      -

      There has been talk of instituting a special command: WAIT UNTIL PHYSICS that will sleep until there has been a physics update, and it’s a good idea but it hasn’t been implemented yet.

      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      CPU Vessel (SHIP)

      -

      Next topic

      -

      kOS Control Panel

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/cpu_vessel.html b/general/cpu_vessel.html deleted file mode 100644 index f06846738..000000000 --- a/general/cpu_vessel.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - CPU Vessel (SHIP) — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      CPU Vessel (SHIP)

      -
      -

      Note

      -

      When kOS documentation refers to the “CPU vessel”, it has the following definition:

      -
        -
      • The “CPU Vessel” is whichever vessel happens to currently contain the CPU in which the executing code is running.
      • -
      -
      -

      It’s important to distinguish this from “active vessel”, which is a KSP term referring to whichever vessel the camera is centered on, and therefore the vessel that will receive the keyboard controls for W A S D and so on.

      -

      The two terms can differ when you are in a situation where there are two vessels near each other, both of them within full physics range (i.e. 2.5 km), such as would happen during a docking operation. In such a situation it is possible for kOS programs to be running on one, both, or neither of the two vessels. The vessel on which a program is executing is not necessarily the vessel the KSP game is currently considering the “active” one.

      -
      -

      Note

      -

      The built-in variable called SHIP is always set to the current CPU vessel. Whenever you see the documentation refer to CPU vessel, you can think of that as being “the SHIP variable”.

      -
      -

      For all places where a kOS program needs to do something with this vessel, for the sake of centering SHIP-RAW coordinates, for the sake of deciding which ship is having maneuver nodes added to it and for the sake of deciding which vessel is being controlled by the autopilot. The vessel it is referring to is itself the CPU vessel and not necessarily what KSP thinks of as the “active vessel”.

      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      General Topics

      -

      Next topic

      -

      The kOS CPU hardware

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/nametag.html b/general/nametag.html deleted file mode 100644 index bac2d572f..000000000 --- a/general/nametag.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - The Name Tag System — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      The Name Tag System

      -

      One useful thing to do is to be able to give parts on a craft your own chosen names that you can use to get a reference to the parts, utterly bypassing the naming schemes used by KSP, and ignoring the complex part tree system. The Name Tag system was designed to make it possible for you to just give any part on a craft whatever arbitrary name you feel like.

      - -
      -

      Giving a Part a Name

      -
        -
      1. Right click on any part. **You can do this in either the editor -VAB/SPH, -or during flight.** It is more useful to do beforehand when making -the -craft, but you can do it in the midst of a flight, which is useful -for -experimenting and testing.
      2. -
      3. Click the “change name tag” button. A small text pop-up will appear -with the ability to type a name for the part. Type any value you -like. In the example picture here, the value “the big tank” was typed -in.
      4. -
      5. From now on this part can be retrieved using either the :PARTSDUBBED -or -the :PARTSTAGGED methods of the vessel, as described -on the Vessel Page
      6. -
      -
      -
      -

      Cloning with Symmetry

      -

      If you name a part in the editor first, and then remove it from the -vessel and place it again with symmetry, all the symmetry copies of the -part will get the same nametag cloned to them. This is not an error. It -is allowed to give the same nametag to more than one part. If you do -this, -it just means that the :PARTSTAGGED or :PARTSDUBBED methods will return -lists containing more than one part.

      -

      If you want each part in a symmetrical group to get a unique nametag, -you -can change their names one at a time after you’ve placed the parts.

      -
      -
      -

      Where is it saved?

      -

      If you add a nametag to a part in the editor (VAB or SPH), then that -nametag will get saved inside the craft file for that vessel design. -All new instances of that craft design that you launch will get the -same nametag configuration on them.

      -

      On the other hand, if you added a nametag to a part after the vessel -was launched, during flight or on the launchpad, then that nametag -will only be attached to that part on that one instance of the -vessel. Other copies of the same design won’t have the name. In this -case the name is saved inside the saved game’s persistence file, but -not in the editor’s craft design file.

      -
      -
      -

      Examples of Using the Name

      -
      // Only if you expected to get
      -// exactly 1 such part, no more, no less.
      -SET myPart TO SHIP:PARTSDUBBED("my nametag here")[0].
      -
      -// OR
      -
      -// Only if you expected to get
      -// exactly 1 such part, no more, no less.
      -SET myPart TO SHIP:PARTSTAGGED("my nametag here")[0].
      -
      -// Handling the case of more than
      -// one part with the same nametag,
      -// or the case of zero parts with
      -// the name:
      -SET allSuchParts TO SHIP:PARTSDUBBED("my nametag here").
      -
      -// OR
      -
      -SET allSuchParts TO SHIP:PARTSTAGGED("my nametag here").
      -
      -// Followed by using the list returned:
      -FOR onePart IN allSuchParts {
      -  // do something with onePart here.
      -}
      -
      -
      -

      For more details on how this system works see the Parts and PartModules Section.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      KerboScript Machine Code

      -

      Next topic

      -

      Ship Parts and PartModules

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/general/parts_and_partmodules.html b/general/parts_and_partmodules.html deleted file mode 100644 index 08a99c046..000000000 --- a/general/parts_and_partmodules.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - Ship Parts and PartModules — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Ship Parts and PartModules

      -

      As of v0.15, kOS has introduced the ability to access the functionality of Parts’ actions, and right-click context menus. However, to understand how to use them it is necessary to first understand a little bit about the structure of parts in a vessel in Kerbal Space Program.

      -

      In Kerbal Space Program, a Vessel is a collection of Parts arranged in a tree Structure. In kOS, you can access the parts one of two ways:

      -
      -

      Tutorial

      -

      If you prefer the tutorial approach to learning, the following links will walk you through a specific pair of tasks to introduce you to this system. If you prefer a methodical reference approach, skip the tutorials and read on, then come back to the tutorials afterward.

      -

      TODO: PUT LINKS POINTING TO A TUTORIAL WALKING THROUGH WHAT THIS IS TEACHING.

      -

      THERE NEEDS TO BE TWO TUTORIALS MINIMUM:

      -
        -
      1. A Tuturial made on an ONLY STOCK (other than kOS of course) install, using only STOCK parts to do something interesting.
      2. -
      3. A Tutorial more complex showing that this can be used with mods too, probably the Leg Leveller example from the teaser video, but with the code updated to use the newer part query methods.
      4. -
      -
      -
      -

      Parts

      -
      -

      Note

      -

      The short and quick thing to remember

      -

      If you only remember one technique, it should be using the Part:PARTSDUBBED method described down below. It’s the most useful one that covers all the other cases.

      -
      -
      -

      Accessing the parts by various naming systems

      -

      Any time you have a vessel variable, you can use these suffixes to get lists of parts on it by their names using several different naming schemes:

      -

      Part Tag: A part’s tag is whatever custom name you have given it using the nametag system described here. This is probably the best naming convention to use because it lets you make up whatever name you like for the part and use it to pick the parts you want to deal with in your script.

      -

      Part Title: A part’s title is the name it has inside the GUI interface on the screen that you see as the user.

      -

      Part Name: A part’s name is the name it is given behind the scenes in KSP. It never appears in the normal GUI for the user to see, but it is used in places like Part.cfg files, the saved game persistence file, the ModuleManager mod, and so on.

      -

      Assuming you’ve done one of these:

      -
      SET somevessel to SHIP.
      -//    Or this:
      -SET somevessel to VESSEL("some vessel's name").
      -//    Or this:
      -SET somevessel to TARGET. // assuming TARGET is a vessel and not a body or docking port.
      -
      -
      -

      Then you can do one of these to query based on any of the above schemes:

      -
      // --------- :PARTSTAGGED -----------
      -// Finds all parts that have a nametag (Part:Tag suffix) matching the value given:
      -SET partlist to somevessel:PARTSTAGGED(nametag_of_part)
      -
      -// --------- :PARTSTITLED -----------
      -// Finds all parts that have a title (Part:Title suffix) matching the value given:
      -SET partlist to somevessel:PARTSTITLED(title_of_part)
      -
      -// --------- :PARTSNAMED -----------
      -// Finds all parts that have a name (Part:Name suffix) matching the value given:
      -SET partlist to somevessel:PARTSNAMED(name_of_part)
      -
      -// --------- :PARTSDUBBED -----------
      -// Finds all parts matching the string in any naming scheme, without caring what kind of naming scheme it is
      -// This is essentially the combination of all the above three searches.
      -SET partlist to somevessel:PARTSDUBBED(any_of_the_above)
      -
      -
      -

      In all cases the checks are performed case-insensitively.

      -

      These are different styles of naming parts, all slightly different, and you can use any of them you like to get access to the part or parts you’re interested in.

      -

      They all return a List of Parts rather than just one single part. This is because any name could have more than one hit. If you expect to get just one single hit, you can just look at the zero-th value of the list, like so:

      -
      SET onePart TO somevessel:PARTSDUBBED("my favorite engine")[0].
      -
      -
      -

      If the name does not exist, you can tell by seeing if the list returned -has a length of zero:

      -
      IF somevessel:PARTSDUBBED("my favorite engine"):LENGTH == 0 {
      -  PRINT "There is no part named 'my favorite engine'.".
      -}.
      -
      -
      -

      Examples:

      -
      // Change the altitude at which all the drouge chutes will deploy:
      -FOR somechute IN somevessel:PARTSNAMED("parachuteDrogue") {
      -  somechute:GETMODULE("ModuleParachute"):SETFIELD("DEPLOYALTITUDE", 1500).
      -}.
      -
      -
      -
      -
      -

      Accessing the parts list as a tree

      -

      Starting from the root part, Vessel:ROOTPART (SHIP:ROOTPART, TARGET:ROOTPART, or Vessel(“some ship name”):ROOTPART). You can get all its children parts with the Part:CHILDREN suffix. Given any Part, you can access its Parent part with Part:PARENT, and detect if it doesn’t have a parent with Part:HASPARENT. By walking this tree you can see how the parts are connected together.

      -

      The diagram here shows an example of a small vessel and how it might get represented as a tree of parts in KSP.

      -
      -
      -

      Accessing the parts list as a list

      -

      You can get a list of all the parts on a vessel using the suffix :PARTS, or by using the LIST PARTS IN command. When you do this, the resulting list is a “flattening” of the tree of parts, created by use of a depth-first search starting from the root part. In the diagram shown here, the red numbers indicate one possible way the parts might be represented in LIST indeces if you used SHIP:PARTS on such a vessel. Note there is no guarantee it would look exactly like this, as it depends on exactly what order the parts were attached in the VAB.

      -
      -
      -

      Shortcuts to smaller lists of parts

      -

      If you know some of the properties of the parts you’re interested in, you can ask kOS to give you a shorter list of parts that just includes those parts, using the following suffixes:

      -

      Return a List of just the parts who’s name is “someNameHere”:

      -
      SET ves TO SHIP. // or Target or Vessel("ship name").
      -SET PLIST TO ves:PARTSNAMED("someNameHere").
      -
      -
      -

      Return a List of just the parts that have had some sort of activity attached to action group 1:

      -
      SET ves TO SHIP. // or Target or Vessel("ship name").
      -SET PLIST TO ves:PARTSINGROUP(AG1).
      -
      -
      -
      -
      -
      -

      PartModules and the right-click menu:

      -

      Each Part, in turn has a list of what are called PartModules on it. A PartModule is a collection of variables and executable program hooks that gives the part some of its behaviors and properties. Without a PartModule, a part is really nothing more than a passive bit of structure that has nothing more than a shape, a look, and a strength to it. Some of the parts in the “structure” tab of the parts bin, like pure I-beams and girders, are like this - they have no PartModules on them. But all of the interesting parts you might want to do something with will have a PartModule on them. Through PartModules, **kOS will now allow you to manipulate or query anything that any KSP programmer, stock or mod, has added to the rightclick menu**, or action group actions, for a part.

      -
      -

      PartModules, Stock vs Mods:

      -

      It should be noted that even if you play an entirely stock installation of KSP (well, stock other than for kOS, obviously, otherwise you wouldn’t be reading this), you will still have PartModules on your Parts. Some people have muddied the terminology difference between “Mod” meaning “modification” and “Mod” meaning “module”. It should be made absolutely clear that PartModules are a feature of stock KSP, and BOTH stock KSP parts and Modded KSP Parts use them. Even if all you want to do is affect the stock behavior of stock parts in a completely unmodded way, you’ll still want to know about PartModules in order to do so.

      -
      -
      -

      PartModules and ModuleManager-like behavior:

      -

      Some Mods (meaning “modifications” here) operate by adding a new PartModule to every single part in the game. One example of such a mod is the Deadly Reentry mod. In order to track how fragile each part is and how well it withstands re-entry heat, the Deadly Re-entry mod adds a small module to each part in the game, even the stock parts that would normally have no mods at all on them.

      -

      Other Mods allow the user to add PartModule’s to any part they feel like, through the use of the ModuleManager mod.

      -

      Because of these, it’s impossible in this explanatory document to make blanket statements about which PartModules will exist on which Parts. Everything that is said here needs to be taken with a grain of salt, as depending on the mods you’ve installed on your game, you may find PartModules on your parts that are not normally on those parts for most other players.

      -
      -
      -
      -

      What a PartModule means to a kOS script

      -

      There are 3 ways that a kOS script may interface with a PartModule.

      -

      TODO - TAKE SOME SCREENSHOTS TO PUT ALONGSIDE THIS TEXT, SHOWING EXAMPLES OF THESE THINGS IN THE USER INTERFACE. WE NEED A SCREENSHOT THAT SHOWS BOTH A KSPFIELD AND A KSPEVENT IN A PART’S RMB CONTEXT MENU, A SCREENSHOT THAT SHOWS FIELDS COMING FROM MULTIPLE PARTMODULES, AND A SCREENSHOT SHOWING THE KSPACTIONS IN THE VAB ACTION EDITOR.

      -
      -

      KSPFields

      -

      A KSPField is a single variable that a PartModule attaches to a part. Some of the KSPFields are also displayed in the RMB context menu of a part. It has a current value, and if the field has had a “tweakable” GUI interface attached to it, then it’s also a settable field by the user manipulating the field in the context menu. In kOS, you can only access those KSPFields that are currently visible on the RMB context menu. We, the developers of kOS, instituted this rule out of respect for the developers of other mods and the stock KSP game. If they didn’t allow the user to see or manipulate the variable directly in the GUI, then we shouldn’t allow it to be manipulated or seen by a kOS script either.

      -

      KSPFields are read or manipulated by the following suffixes of PartModule

      -
        -
      • :GETFIELD(“name of field”).
      • -
      • :SETFIELD(“name of field”, new_value_for_field).
      • -
      -

      Note, that these are suffixes of the partmodule and NOT suffixes of the Part itself. This is because two different PartModule’s on the same Part might have used the same field name as each other, and it’s important to keep them separate.

      -
      -
      -

      KSPEvents

      -

      A KSPEvent, just like a KSPField, is a thing that a PartModule can put on the RMB context menu for a part. The difference is that a KSPEvent does not actually HAVE a value. It’s not a variable. Rather it’s just a button with a label next to it. When you press the button, it causes some sort of software inside the PartModule to run. An example of this is the “undock node” button you see on many of the docking ports.

      -

      Difference between a KSPEvent and a boolean KSPField: If you see a label next to a button in the RMB context menu, it might be a KSPEvent, OR it might be a boolean KSPField variable which is editable with a tweakable GUI. They look exactly the same in the user interface. To tell the difference, you need to look at what happens when you click the button. If clicking the button causes the button to depress inward and stay pressed in until you click it again, then this is a boolean value KSPField. If clicking the button pops the button in and then it pops out again right away, then this is a KSPEvent instead.

      -

      KSPEvents are manipulated by the following suffix of PartModule

      -
        -
      • :DOEVENT(“name of event”).
      • -
      -

      This causes the event to execute once.

      -
      -
      -

      KSPActions:

      -

      A KSPAction is a bit different from a KSPField or KSPEvent. A KSPAction is like a KSPEvent in that it causes some software inside the PartModule to be run. But it doesn’t work via the RMB context menu for the part. Instead KSPAction’s are those things you see being made avaiable to you as options you can assign into an Action Group in the VAB or SPH. When you have the action group editor tab enabled in the VAB or SPH, and then click on a part, that part asks all of its PartModules if they have any KSPActions they’d like to provide access to, and gathers all those answers and lists them in the user interface for you to select from and assign to the action group.

      -

      kOS now allows you to access any of those actions without necessarily having had to assign them to any action groups if you didn’t want to.

      -

      KSPActions are manipulated by the following suffix of PartModule

      -
        -
      • :DOACTION(“name of action”, new_boolan_value).
      • -
      -

      The name of the action is the name you see in the action group editor interface, and the new boolean value is either True or False. Unlike KSPEvents, a KSPAction has two states, true and false. When you toggle the brakes, for example, they go from on to off, or from off to on. When you call :DOACTION, you are specifying if the KSPAction should behave as if you have just toggled the group on, or just toggled the group off. But instead of actually toggling an action group - you are just telling the single PartModule on a single Part to perform the same behavior it would have performed had that action been assigned to an action group. You don’t actually have to assign the action to an action group for this to work.

      -
      -
      -
      -

      Exploring what’s there to find Field/Event/Action Names:

      -

      Okay, so you understand all that, but you’re still thinking “but how do I KNOW what the names of part modules are, or what the names of the fields on them are? I didn’t write all that C# source code for all the modules.”

      -

      There are some additional suffixes that are designed to help you explore what’s available so you can learn the answers to these questions. Also, some of the questions can be answered by other means:

      -
      -

      What PartModules are there on a part?

      -

      To answer this question you can do one of two things:

      -

      A: Use the part.cfg file All parts in KSP come with a part.cfg file defining them, both for modded parts and stock parts. If you look at this file, it will contain sections looking something like this:

      -
      // Example snippet from a Part.cfg file:
      -MODULE
      -{
      -    name = ModuleCommand
      -
      -
      -

      That would tell you that this part has a PartModule on it called ModuleCommand. there can be multiple such modules per part. But it doesn’t let you know about PartModules that get added afterward during runtime, by such things as the ModuleManager mod.

      -

      B: Use the :MODULES suffix of Part: If you have a handle on any part in kOS, you can print out the value of :MODULES and it will tell you the string names of all the modules on the part. For example:

      -
      FOR P IN SHIP:PARTS {
      -  LOG ("MODULES FOR PART NAMED " + P:NAME) TO MODLIST.
      -  LOG P:MODULES TO MODLIST.
      -}.
      -
      -
      -

      Do that, and the file MODLIST should now contain a verbose dump of all the module names of all the parts on your ship. You can get any of the modules now by using Part:GETMODULE(“module name”).

      -
      -
      -

      What are the names of the stuff that a PartModule can do?

      -

      These three suffixes tell you everything a part module can do:

      -
      SET MOD TO P:GETMODULE("some name here").
      -LOG ("These are all the things that I can currently USE GETFIELD AND SETFIELD ON IN " + MOD:NAME + ":") TO NAMELIST.
      -LOG MOD:ALLFIELDS TO NAMELIST.
      -LOG ("These are all the things that I can currently USE DOEVENT ON IN " +  MOD:NAME + ":") TO NAMELIST.
      -LOG MOD:ALLEVENTS TO NAMELIST.
      -LOG ("These are all the things that I can currently USE DOACTION ON IN " +  MOD:NAME + ":") TO NAMELIST.
      -LOG MOD:ALLACTIONS TO NAMELIST.
      -
      -
      -

      After that, the file NAMELIST would contain a dump of all the fields on this part module that you can use.

      -
      -
      -

      BE WARNED! Names are able to dynamically change!

      -

      Some PartModules are written to change the name of a field when something happens in the game. For example, you might find that after you’ve done this:

      -
      SomeModule:DOEVENT("Activate").
      -
      -
      -

      That this doesn’t work anymore after that, and the “Activate” event now causes an error.

      -

      And the reason is that the PartModule chose to change the label on the event. It changed to the word “Deactivate” now. kOS can no longer trigger an event called “Activate” because that’s no longer its name.

      -

      Be on the lookout for cases like this. Experiment with how the context menu is being manipulated and keep in mind that the list of strings you got the last time you exectued :ALLFIELDS a few minutes ago might not be the same list you’d get if you ran it now, because the PartModule has changed what is being shown on the menu.

      -
      -
      -
      - - -
      -
      -
      - -
      -
      - - - - \ No newline at end of file diff --git a/general/volumes.html b/general/volumes.html deleted file mode 100644 index de1a44e03..000000000 --- a/general/volumes.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - Files and Volumes — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Files and Volumes

      -

      Using the COPY, SWITCH, DELETE, and RENAME commands, you can manipulate the archive and the volumes as described in the File I/O page. But before you do that, it’s useful to know how kOS manages the archive and the volumes, and what they mean.

      - -
      -

      Warning

      -
      -

      Changed in version 0.15: Archive location and file extension change

      -

      The Archive where KerboScript files are kept has been changed from Plugins/PluginData/Archive to Ships/Script, but still under the top-level KSP installation directory. The file name extensions have also changes from .txt to .ks.

      -
      -
      -
      -

      Script Files

      -

      There is one file per program. You can use the words “file” and “program” interchangeably in your thinking for the most part. Files are stored in volumes and there can be more than one file in a volume provided there’s enough room. Volumes have small storage and there’s no way to span a file across two volumes, so the limit to the size of a volume is also effectively a limit to the size of a program.

      -
      -
      -

      File Storage Behind the Scenes

      -

      In the Archive:

      -
        -
      • If a file is stored on the volume called “Archive” (or volume number -zero to put it another way), then behind the scenes it’s really -stored as an actual file, with the extension .ks, on your -computer (As of right now it’s located in Ships/Script but that -location is likely to change to somewhere in GameData in a future -version.) Each program is a simple text file you can edit with any -text editor, and your edits will be seen immediately by KOS the next -time it tries running that program from the archive volume.
      • -
      • Historical note: older versions of kOS (0.14 and earlier) used the -directory Plugins/PluginData/Archive for the archive.
      • -
      -

      In any other volume besides Archive:

      -
        -
      • If a file is stored on any volume other than archive, then behind the -scenes it’s stored actually inside the saved game’s persistence file -in the section for the KOS part on the vessel. -What’s a Volume
      • -
      -

      A Volume is a small unit of disk storage that contains a single hard -drive with very limited storage capacity. It can store more than one -program on it. To simulate the sense that this game takes place at the -dawn of the space race with 1960’s and 1970’s technology, the storage -capacity of a volume is very limited. It can only store 10,000 bytes of -program text - less than 10 Kb The byte count of a program is just the -count of the characters in the source code text. Writing programs with -short cryptic variable names instead of long descriptive ones does save -space. This is old school programming, where squeezing every byte out -matters.

      -
      -
      -

      Multiple Volumes on One Vessel

      -

      Each kOS CX-4181 Scriptable Control System part contains ‘’‘one’‘’ such -volume inside it. Therefore to send a craft into space with more storage -capacity than 10,000 bytes requires putting multiple CX-4181 Scriptable -Control System parts on the craft.

      -

      If you have multiple CX-4181 parts on the same craft, they are assumed -to be networked together on the same system, and capable of reading each -other’s hard drives. Their disk drives each have a different Volume, and -by default they are simply numbered 1,2,3, … unless you rename them with -the RENAME command.

      -

      For example, if you have two CX-4181’s on the same craft, called 1 and -2, with volumes on them called 1 and 2, respectively, it is possible for -CPU 1 to run code stored on volume 2 by just having CPU number 1 issue -the command ‘’SWITCH TO 2.’‘

      -
      -
      -

      Naming Volumes

      -

      It’s important to note that if you have multiple volumes on the same -vessel, the numbering conventions for the volumes will differ on -different CPUs. The same volume which was called ‘2’ when one CPU was -looking at it might instead be called ‘1’ when a different CPU is -looking at it. Each CPU thinks of its OWN volume as number ‘1’.

      -

      Therefore using the RENAME command on the volumes is useful when dealing -with multiple CX-4181’s on the same vessel, so they all will refer to -the volumes using the same names.

      -
      -
      -

      Archive

      -

      The “archive” is a special volume that behaves much like any other -volume but with the following exceptions:

      -
        -
      • It is globally the same even across save games.
      • -
      • The archive represents the large bank of disk storage back at mission -control’s mainframe, rather than the storage on an indivdual craft. -While “Volume 1” on one vessel might be a different disk than “Volume -1” on another vessel, there is only volume called “archive” in the -entire solar system. Also, there’s only one “archive” across all -saved universes. If you play a new campaign from scratch, your -archive in that new game will still have all the files in it from -your previous saved game. This is because behid the scenes it’s -stored in the plugin’s directory, not the save game directory.
      • -
      • It is infinitely large.
      • -
      • Unlike the other volumes, the archive volume does not have a byte -limit. This is because the mainframe back at home base can store a -lot more than the special drives sent on the vessels - so much so -that it may as well be infinite by comparison.
      • -
      • Files saved there do not revert when you “revert flight”.
      • -
      • When you revert a flight, you are going back to a previous saved -state of the game, and therefore any disk data on the vessels -themselves also reverts to what it was at the time of the saved game. -Because the archive is saved outside the normal game save, changes -made there are retained even when reverting a flight.
      • -
      • It’s not always reachable if you are out in space, unless you have -antennae.
      • -
      • Once a vessel is more than 100,000 meters away from mission control, -by default it cannot access the files on the archive. Commands such -as SWITCH TO , and COPY FROM will fail to work when trying to access -the archive volume while out of range. This can be changed by putting -antennae on the vessel. With enough -antennae it becomes possible -to reach the archive drive from farther away. Using this method it is -possible to alter the software stored on a vessel after launch.
      • -
      • Files in Archive are editable with a text editor directly and they -will have the .ks extension.
      • -
      • Files in the Archive are stored on your computer in the subdirectory: -Ships/Script. You can pull them up in a text editor of your -choice and edit them directly, and the KOS Mod will see those changes -in its archive immediately. Files stored in other volumes, on the -other hand, are stored inside the vessel’s data in the persistence -file of the saved game and are quite a bit bit harder to edit there. -Editing the files in the Archive directory is allowed and in fact is -an officially accepted way to use the plugin. Editing the section in -a persistence file, on the other hand, is a bad idea and probably -constitutes a form of cheating similar to any other edit of the -persistence file.
      • -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      kOS Control Panel

      -

      Next topic

      -

      KerboScript Machine Code

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/genindex.html b/genindex.html deleted file mode 100644 index 0501f1998..000000000 --- a/genindex.html +++ /dev/null @@ -1,1614 +0,0 @@ - - - - - - - - - Index — kOS 0.15.3 documentation - - - - - - - - - - - - - - - -
      -
      -
      -
      - - -

      Index

      - -
      - A - | B - | C - | D - | E - | F - | G - | H - | I - | L - | M - | N - | O - | P - | Q - | R - | S - | T - | U - | V - | W - | Y - -
      -

      A

      - - - -
      - -
      ABS() -
      - - -
      ADD -
      - - -
      ANGLEAXIS() -
      - - -
      ARCCOS() -
      - - -
      ARCSIN() -
      - - -
      ARCTAN() -
      - - -
      ARCTAN2() -
      - - -
      AT() -
      - -
      - -
      Atmosphere [struct] -
      - - -
      Atmosphere:BODY -
      - - -
      Atmosphere:EXISTS -
      - - -
      Atmosphere:HEIGHT -
      - - -
      Atmosphere:OXYGEN -
      - - -
      Atmosphere:SCALE -
      - - -
      Atmosphere:SEALEVELPRESSURE -
      - -
      - -

      B

      - - - -
      - -
      BLACK -
      - - -
      BLUE -
      - - -
      Body [struct] -
      - - -
      Body:ALTITUDE -
      - - -
      Body:ANGULARVEL -
      - - -
      Body:ATM -
      - - -
      Body:DESCRIPTION -
      - - -
      Body:MASS -
      - -
      - -
      Body:MU -
      - - -
      Body:NAME -
      - - -
      Body:RADIUS -
      - - -
      Body:ROTATIONPERIOD -
      - - -
      Boolean Operators -
      - - -
      BRAKES, [1] -
      - - -
      BREAK -
      - -
      - -

      C

      - - - -
      - -
      CEILING() -
      - - -
      CLEARSCREEN -
      - - -
      Config [struct] -
      - - -
      Config:ARCH -
      - - -
      Config:IPU -
      - - -
      Config:RT2 -
      - - -
      Config:SAFE -
      - -
      - -
      Config:STAT -
      - - -
      Config:UCP -
      - - -
      Config:VERBOSE -
      - - -
      Control [struct], [1] -
      - - -
      COS() -
      - - -
      CYAN -
      - -
      - -

      D

      - - - -
      - -
      Direction [struct] -
      - - -
      Direction:FOREVECTOR -
      - - -
      Direction:PITCH -
      - - -
      Direction:ROLL -
      - - -
      Direction:STARVECTOR -
      - - -
      Direction:TOPVECTOR -
      - - -
      Direction:YAW -
      - - -
      DockingPort [struct] -
      - - -
      DockingPort:AQUIREFORCE -
      - -
      - -
      DockingPort:AQUIRERANGE -
      - - -
      DockingPort:AQUIRETORQUE -
      - - -
      DockingPort:DOCKEDSHIPNAME -
      - - -
      DockingPort:PORTFACING -
      - - -
      DockingPort:REENGAGEDDISTANCE -
      - - -
      DockingPort:STATE -
      - - -
      DockingPort:TARGETABLE -
      - - -
      DockingPort:UNDOCK() -
      - -
      - -

      E

      - - - -
      - -
      E -
      - - -
      Engine [struct] -
      - - -
      Engine:ACTIVATE() -
      - - -
      Engine:ALLOWRESTART -
      - - -
      Engine:ALLOWSHUTDOWN -
      - - -
      Engine:FLAMEOUT -
      - - -
      Engine:FUELFLOW -
      - -
      - -
      Engine:IGNITION -
      - - -
      Engine:ISP -
      - - -
      Engine:MAXTHRUST -
      - - -
      Engine:SHUTDOWN() -
      - - -
      Engine:THROTTLELOCK -
      - - -
      Engine:THRUST -
      - - -
      Engine:THRUSTLIMIT -
      - -
      - -

      F

      - - - -
      - -
      FileInfo [struct] -
      - - -
      FileInfo:CREATED -
      - - -
      FileInfo:FILETYPE -
      - - -
      FileInfo:MODIFIED -
      - - -
      FileInfo:NAME -
      - -
      - -
      FileInfo:SIZE -
      - - -
      FLOOR() -
      - - -
      FOR -
      - - -
      Fundamental Constants -
      - -
      - -

      G

      - - - -
      - -
      G -
      - - -
      GeoCoordinates [struct] -
      - - -
      GeoCoordinates:BEARING -
      - - -
      GeoCoordinates:DISTANCE -
      - - -
      GeoCoordinates:HEADING -
      - -
      - -
      GeoCoordinates:LAT -
      - - -
      GeoCoordinates:LNG -
      - - -
      GeoCoordinates:TERRAINHEIGHT -
      - - -
      GREEN -
      - -
      - -

      H

      - - -
      - -
      HEADING() -
      - -
      - -

      I

      - - - -
      - -
      IF -
      - - -
      Iterator [struct] -
      - - -
      Iterator:ATEND -
      - - -
      Iterator:INDEX -
      - -
      - -
      Iterator:NEXT() -
      - - -
      Iterator:RESET() -
      - - -
      Iterator:VALUE -
      - -
      - -

      L

      - - - -
      - -
      LATLNG() -
      - - -
      LIGHTS, [1] -
      - - -
      LIST (command) -
      - - -
      List [struct] -
      - - -
      List:ADD() -
      - - -
      List:CLEAR -
      - - -
      List:CONTAINS() -
      - - -
      List:COPY -
      - - -
      List:DUMP -
      - - -
      List:EMPTY -
      - -
      - -
      List:INSERT() -
      - - -
      List:ITERATOR -
      - - -
      List:LENGTH -
      - - -
      List:REMOVE() -
      - - -
      List:SUBLIST() -
      - - -
      LN() -
      - - -
      LOCK -
      - - -
      LOG10() -
      - - -
      LOOKDIRUP() -
      - -
      - -

      M

      - - - -
      - -
      MAGENTA -
      - - -
      ManeuverNode [struct] -
      - - -
      ManeuverNode:BURNVECTOR -
      - - -
      ManeuverNode:DELTAV -
      - - -
      ManeuverNode:ETA -
      - - -
      ManeuverNode:NORMAL -
      - - -
      ManeuverNode:ORBIT -
      - -
      - -
      ManeuverNode:PROGRADE -
      - - -
      ManeuverNode:RADIALOUT -
      - - -
      MAPVIEW -
      - - -
      Mathematical Functions -
      - - -
      MAX() -
      - - -
      MIN() -
      - - -
      MOD() -
      - -
      - -

      N

      - - - -
      - -
      NEXTNODE -
      - -
      - -
      NODE() -
      - -
      - -

      O

      - - - -
      - -
      ON -
      - - -
      Orbit [struct] -
      - - -
      Orbit:APOAPSIS -
      - - -
      Orbit:ARGUMENTOFPERIAPSIS -
      - - -
      Orbit:BODY -
      - - -
      Orbit:ECCENTRICITY -
      - - -
      Orbit:HASNEXTPATCH -
      - - -
      Orbit:INCLINATION -
      - - -
      Orbit:LAN -
      - - -
      Orbit:LONGITUDEOFASCENDINGNODE -
      - - -
      Orbit:MEANANOMALYATEPOCH -
      - - -
      Orbit:NAME -
      - - -
      Orbit:NEXTPATCH -
      - - -
      Orbit:PATCHES -
      - - -
      Orbit:PERIAPSIS -
      - - -
      Orbit:PERIOD -
      - - -
      Orbit:POSITION -
      - - -
      Orbit:SEMIMAJORAXIS -
      - - -
      Orbit:SEMIMINORAXIS -
      - - -
      Orbit:TRANSITION -
      - - -
      Orbit:TRUEANOMALY -
      - - -
      Orbit:VELOCITY -
      - - -
      Orbitable [struct] -
      - - -
      Orbitable:ALTITUDE -
      - -
      - -
      Orbitable:APOAPSIS -
      - - -
      Orbitable:BODY -
      - - -
      Orbitable:DIRECTION -
      - - -
      Orbitable:DISTANCE -
      - - -
      Orbitable:GEOPOSITION -
      - - -
      Orbitable:LATITUDE -
      - - -
      Orbitable:LONGITUDE -
      - - -
      Orbitable:NAME -
      - - -
      Orbitable:NORTH -
      - - -
      Orbitable:OBT -
      - - -
      Orbitable:PATCHES -
      - - -
      Orbitable:PERIAPSIS -
      - - -
      Orbitable:POSITION -
      - - -
      Orbitable:PROGRADE -
      - - -
      Orbitable:RETROGRADE -
      - - -
      Orbitable:SRFPROGRADE -
      - - -
      Orbitable:SRFRETROGRADE -
      - - -
      Orbitable:UP -
      - - -
      Orbitable:VELOCITY -
      - - -
      OrbitableVelocity [struct] -
      - - -
      OrbitableVelocity:ORBIT -
      - - -
      OrbitableVelocity:SURFACE -
      - - -
      ORBITAT() -
      - -
      - -

      P

      - - - -
      - -
      Part [struct] -
      - - -
      Part:ALLMODULES -
      - - -
      Part:CHILDREN -
      - - -
      Part:CONTROLFROM -
      - - -
      Part:FACING -
      - - -
      Part:GETMODULE() -
      - - -
      Part:HASPARENT -
      - - -
      Part:MODULES -
      - - -
      Part:NAME -
      - - -
      Part:PARENT -
      - - -
      Part:POSITION -
      - - -
      Part:RESOURCES -
      - - -
      Part:ROTATION -
      - - -
      Part:SHIP -
      - - -
      Part:STAGE -
      - - -
      Part:TAG -
      - - -
      Part:TARGETABLE -
      - - -
      Part:TITLE -
      - - -
      Part:UID -
      - -
      - -
      PartModule [struct] -
      - - -
      PartModule:ALLACTIONS -
      - - -
      PartModule:ALLEVENTS -
      - - -
      PartModule:ALLFIELDS -
      - - -
      PartModule:DOACTION() -
      - - -
      PartModule:DOEVENT() -
      - - -
      PartModule:GETFIELD() -
      - - -
      PartModule:HASACTION() -
      - - -
      PartModule:HASEVENT() -
      - - -
      PartModule:HASFIELD() -
      - - -
      PartModule:NAME -
      - - -
      PartModule:PART -
      - - -
      PartModule:SETFIELD() -
      - - -
      PI -
      - - -
      POSITIONAT() -
      - - -
      PRESERVE -
      - - -
      PRINT -
      - - -
      PURPLE -
      - -
      - -

      Q

      - - -
      - -
      Q() -
      - -
      - -

      R

      - - - -
      - -
      R() -
      - - -
      RAW-RAW (Reference Frame) -
      - - -
      RCS, [1] -
      - - -
      REBOOT -
      - - -
      RED -
      - - -
      REMOVE -
      - - -
      Resource [struct] -
      - -
      - -
      Resource:AMOUNT -
      - - -
      Resource:CAPACITY -
      - - -
      Resource:NAME -
      - - -
      RGB() -
      - - -
      RGBA() -
      - - -
      ROTATEFROMTO() -
      - - -
      ROUND(), [1] -
      - -
      - -

      S

      - - - -
      - -
      SAS, [1] -
      - - -
      Sensor [struct] -
      - - -
      Sensor:ACTIVE -
      - - -
      Sensor:POWERCONSUMPTION -
      - - -
      Sensor:READOUT -
      - - -
      Sensor:TOGGLE() -
      - -
      - -
      Sensor:TYPE -
      - - -
      SHIP-RAW (Reference Frame) -
      - - -
      SHUTDOWN -
      - - -
      SIN() -
      - - -
      SOI-RAW (Reference Frame) -
      - - -
      SQRT() -
      - -
      - -

      T

      - - - -
      - -
      TAN() -
      - - -
      TARGET, [1] -
      - - -
      The :global:`WARP` global variable can be set to change the game warp to a value between 0 and 7::, [1] -
      - - -
      TIME -
      - - -
      TimeSpan [struct] -
      - - -
      TimeSpan:CALENDAR -
      - - -
      TimeSpan:CLOCK -
      - -
      - -
      TimeSpan:DAY -
      - - -
      TimeSpan:HOUR -
      - - -
      TimeSpan:MINUTE -
      - - -
      TimeSpan:SECOND -
      - - -
      TimeSpan:SECONDS -
      - - -
      TimeSpan:YEAR -
      - - -
      Trigonometric Functions -
      - -
      - -

      U

      - - - -
      - -
      UNLOCK -
      - -
      - -
      UNTIL -
      - -
      - -

      V

      - - - -
      - -
      V() -
      - - -
      VANG() -
      - - -
      VCRS() -
      - - -
      VDOT() -
      - - -
      VecDraw [struct] -
      - - -
      VECDRAW() -
      - - -
      VecDraw:COLOR -
      - - -
      VecDraw:COLOUR -
      - - -
      VecDraw:LABEL -
      - - -
      VecDraw:SCALE -
      - - -
      VecDraw:SHOW -
      - - -
      VecDraw:START -
      - - -
      VecDraw:VEC -
      - - -
      VECDRAWARGS() -
      - - -
      Vector [struct] -
      - - -
      vector addition -
      - - -
      vector multiplication -
      - - -
      vector subtraction -
      - - -
      Vector:DIRECTION -
      - - -
      Vector:MAG -
      - - -
      Vector:NORMALIZED -
      - - -
      Vector:SQRMAGNITUDE -
      - - -
      Vector:VEC -
      - - -
      Vector:X -
      - - -
      Vector:Y -
      - - -
      Vector:Z -
      - - -
      VECTORANGLE() -
      - - -
      VECTORCROSSPRODUCT() -
      - - -
      VECTORDOTPRODUCT() -
      - - -
      VECTOREXCLUDE() -
      - - -
      VELOCITYAT() -
      - - -
      Vessel [struct] -
      - - -
      Vessel:AIRSPEED -
      - -
      - -
      Vessel:ALLPARTSTAGGED() -
      - - -
      Vessel:ANGULARMOMENTUM -
      - - -
      Vessel:ANGULARVEL -
      - - -
      Vessel:BEARING -
      - - -
      Vessel:CONTROL -
      - - -
      Vessel:FACING -
      - - -
      Vessel:HEADING -
      - - -
      Vessel:LOADED -
      - - -
      Vessel:MASS -
      - - -
      Vessel:MAXTHRUST -
      - - -
      Vessel:MODULESINGROUP() -
      - - -
      Vessel:MODULESNAMED() -
      - - -
      Vessel:PARTS -
      - - -
      Vessel:PARTSDUBBED() -
      - - -
      Vessel:PARTSINGROUP() -
      - - -
      Vessel:PARTSNAMED() -
      - - -
      Vessel:PARTSTAGGED() -
      - - -
      Vessel:PARTSTITLED() -
      - - -
      Vessel:PATCHES -
      - - -
      Vessel:ROOTPART -
      - - -
      Vessel:SENSORS -
      - - -
      Vessel:SURFACESPEED -
      - - -
      Vessel:TERMVELOCITY -
      - - -
      Vessel:VERTICALSPEED -
      - - -
      Vessel:VESSELNAME -
      - - -
      VesselSensors [struct] -
      - - -
      VesselSensors:ACC -
      - - -
      VesselSensors:GRAV -
      - - -
      VesselSensors:LIGHT -
      - - -
      VesselSensors:PRES -
      - - -
      VesselSensors:TEMP -
      - - -
      VXCL() -
      - -
      - -

      W

      - - - -
      - -
      WAIT -
      - - -
      WARP, [1] -
      - -
      - -
      WHEN -
      - - -
      WHITE -
      - -
      - -

      Y

      - - -
      - -
      YELLOW -
      - -
      - - - -
      -
      -
      -
      -
      - - - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 1902cad23..000000000 --- a/index.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - Welcome to the kOS Documentation Website! — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - -
      -
      -
      -
      - - -
      -

      Introduction to kOS and KerboScript

      -

      KerboScript is the language used to program the CPU device attached to your vessel and kOS is the operating system that interprets the code you write. The program can be as simple as printing the current altitude of the vessel and as complicated as a six-axis autopilot controller taking your vessel from the launchpad to Duna and back! With kOS, the sky is not the limit.

      -

      This mod is compatible with RemoteTech, you just have to make sure you copy the program onto the local CPU before it goes out of range of KSC.

      -
      -

      Installation

      -

      Like other mods, simply merge the contents of the zip file into your -Kerbal Space Program folder.

      -
      -
      -

      KerboScript

      -

      KerboScript is a programming language that is derived from the language of planet Kerbin, which sounds like gibberish to non-native speakers but for some reason is written exactly like English. As a result, KerboScript is very English-like in its syntax. For example, it uses periods as statement terminators.

      -

      The language is designed to be easily accessible to novice programmers, therefore it is case-insensitive, and types are cast automatically whenever possible.

      -

      A typical command in KerboScript might look like this:

      -
      PRINT "Hello World".
      -
      -
      -
      -
      -
      -

      Indices and tables

      - -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Next topic

      -

      Tutorials

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/language.html b/language.html deleted file mode 100644 index 482327fd0..000000000 --- a/language.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - The KerboScript Language — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Previous topic

      -

      Communication Range For Remote Updates

      -

      Next topic

      -

      General Features of the KerboScript Language

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/language/features.html b/language/features.html deleted file mode 100644 index 3b6d16350..000000000 --- a/language/features.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - General Features of the KerboScript Language — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      General Features of the KerboScript Language

      - -
      -

      Case Insensitivity

      -

      Everything in KerboScript is case-insensitive, including your own variable names and filenames. The only exception is when you perform a string comparison, ("Hello"="HELLO" will return false.)

      -

      Most of the examples here will show the syntax in all-uppercase to help make it stand out from the explanatory text.

      -
      -
      -

      Expressions

      -

      KerboScript uses an expression evaluation system that allows you to perform math operations on variables. Some variables are defined by you. Others are defined by the system. There are four basic types:

      -
      -

      1. Numbers

      -

      You can use mathematical operations on numbers, like this:

      -
      SET X TO 4 + 2.5.
      -PRINT X.             // Outputs 6.5
      -
      -
      -

      The system follows the order of operations, but currently the implementation is imperfect. For example, multiplication will always be performed before division, regardless of the order they come in. This will be fixed in a future release.

      -
      -
      -

      2. Strings

      -

      Strings are pieces of text that are generally meant to be printed to the screen. For example:

      -
      PRINT "Hello World!".
      -
      -
      -

      To concatenate strings, you can use the + operator. This works with mixtures of numbers and strings as well:

      -
      PRINT "4 plus 3 is: " + (4+3).
      -
      -
      -
      -
      -

      3. Structures

      -

      Structures are variables that contain more than one piece of information. For example, a Vector has an X, a Y, and a Z component. Structures can be used with SET.. TO just like any other variable. To access the sub-elements of a structure, you use the colon operator (”:”). Here are some examples:

      -
      PRINT "The Mun's periapsis altitude is: " + MUN:PERIAPSIS.
      -PRINT "The ship's surface velocity is: " + SHIP:VELOCITY:SURFACE.
      -
      -
      -

      Many structures also let you set a specific component of them, for example:

      -
      SET VEC TO V(10,10,10).  // A vector with x,y,z components
      -                         // all set to 10.
      -SET VEC:X to VEC:X * 4.  // multiply just the X part of VEC by 4.
      -PRINT VEC.               // Results in V(40,10,10).
      -
      -
      -
      -
      -

      4. Structure Methods

      -

      Structures also often contain methods. A method is a suffix of a structure that actually performs an activity when you mention it, and can sometimes take parameters. The following are examples of calling methods of a structure:

      -
      SET PLIST TO SHIP:PARTSDUBBED("my engines"). // calling a suffix
      -                                             // method with one
      -                                             // argument that
      -                                             // returns a list.
      -PLIST:REMOVE(0). // calling a suffix method with one argument that
      -                 // doesn't return anything.
      -PRINT PLIST:SUBLIST(0,4). // calling a suffix method with 2
      -                          // arguments that returns a list.
      -
      -
      -
      -

      Note

      -
      -

      New in version 0.15: Methods now perform the activity when the interpreter comes up to it. Prior to this version, execution was sometimes delayed until some later time depending on the trigger setup or flow-control.

      -
      -
      -

      For more information, see the Structures Section. A full list of structure types can be found on the Structures page. For a more detailed breakdown of the language, see the Language Syntax Constructs page.

      -
      -
      -
      -

      Structures

      -

      Structures, introduced above, are variable types that contain more than one piece of information. All structures contain sub-values or methods that can be accessed with a colon (:) operator. Multiple structures can be chained together with more than one colon (:) operator:

      -
      SET myCraft TO SHIP.
      -SET myMass TO myCraft:MASS.
      -SET myVel TO myCraft:VELOCITY:ORBIT.
      -
      -
      -

      These terms are referred to as “suffixes”. For example Velocity is a suffix of Vessel. It is possible to set some suffixes as well. The second line in the following example sets the ETA of a NODE 500 seconds into the future:

      -
      SET n TO Node( TIME:SECONDS + 60, 0, 10, 10).
      -SET n:ETA to 500.
      -
      -
      -

      The full list of available suffixes for each type can be found here.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      The KerboScript Language

      -

      Next topic

      -

      KerboScript Syntax Specification

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/language/flow.html b/language/flow.html deleted file mode 100644 index 43b81e24d..000000000 --- a/language/flow.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - Flow Control — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Flow Control

      - -
      -

      BREAK

      -

      Breaks out of a loop:

      -
      SET X TO 1.
      -UNTIL 0 {
      -    SET X TO X + 1.
      -    IF X > 10 { BREAK. } // Exits the loop when
      -                         // X is greater than 10
      -}
      -
      -
      -
      -
      -

      IF / ELSE

      -

      Checks if the expression supplied returns true. If it does, IF executes the following command block. Can also have an optional ELSE to execute when the IF condition is not true. ELSE can have another IF after it, to make a chain of IF/ELSE conditions:

      -
      SET X TO 1.
      -IF X = 1 { PRINT "X equals one.". }     // Prints "X equals one."
      -IF X > 10 { PRINT "X is greater than ten.". }  // Does nothing
      -
      -// IF-ELSE structure:
      -IF X > 10 { PRINT "X is large".  } ELSE { PRINT "X is small".  }
      -
      -// An if-else ladder:
      -IF X = 0 {
      -    PRINT "zero".
      -} ELSE IF X < 0 {
      -    PRINT "negative".
      -} ELSE {
      -    PRINT "positive".
      -}
      -
      -
      -
      -

      Note

      -

      The period (.) is optional after the end of a set of curly braces like so:

      -
      // both of these lines are fine
      -IF TRUE { PRINT "Hello". }
      -IF TRUE { PRINT "Hello". }.
      -
      -
      -

      In the case where you are using the ELSE keyword, you must not end the previous IF body with a period, as that terminates the IF command and causes the ELSE keyword to be without a matching IF:

      -
      // works:
      -IF X > 10 { PRINT "Large". }  ELSE { PRINT "Small". }.
      -
      -// syntax error - ELSE without IF.
      -IF X > 10 { PRINT "Large". }. ELSE { PRINT "Small". }.
      -
      -
      -
      -
      -
      -

      LOCK

      -

      Locks an identifier to an expression. Each time the identifier is used in an expression, its value will be re-calculated on the fly:

      -
      SET X TO 1.
      -LOCK Y TO X + 2.
      -PRINT Y.         // Outputs 3
      -SET X TO 4.
      -PRINT Y.         // Outputs 6
      -
      -
      -

      Unlike variables created with the SET or DECLARE commands, LOCK variables are local to the current program. If program A calls program B, and program B issues a LOCK command, program A will not be able to read that LOCK variable’s result.

      -
      -

      Note

      -

      If a LOCK expression is used with a flight control such as THROTTLE or STEERING, then it will get continually evaluated in the background each update tick.

      -
      -
      -
      -

      UNLOCK

      -

      Releases a lock on a variable. See LOCK:

      -
      UNLOCK X.    // Releases a lock on variable X
      -UNLOCK ALL.  // Releases ALL locks
      -
      -
      -
      -
      -

      UNTIL

      -

      Performs a loop until a certain condition is met:

      -
      SET X to 1.
      -UNTIL X > 10 {      // Prints the numbers 1-10
      -    PRINT X.
      -    SET X to X + 1.
      -}
      -
      -
      -

      Note that if you are creating a loop in which you are watching a physical value that you expect to change each iteration, it’s vital that you insert a small WAIT at the bottom of the loop like so:

      -
      SET PREV_TIME to TIME:SECONDS.
      -SET PREV_VEL to SHIP:VELOCITY.
      -SET ACCEL to V(9999,9999,9999).
      -PRINT "Waiting for accellerations to stop.".
      -UNTIL ACCEL:MAG < 0.5 {
      -    SET ACCEL TO (SHIP:VELOCITY - PREV_VEL) / (TIME:SECONDS - PREV_TIME).
      -    SET PREV_TIME to TIME:SECONDS.
      -    SET PREV_VEL to SHIP:VELOCITY.
      -
      -    WAIT 0.001.  // This line is Vitally Important.
      -}
      -
      -
      -

      The full explanation why is in the CPU hardware description -page.

      -
      -
      -

      FOR

      -

      Loops over a list collection, letting you access one element at a time. Syntax:

      -
      FOR variable1 IN variable2 { use variable1 here. }
      -
      -
      -

      Where:

      -
        -
      • variable1 is a variable to hold each element one at a time.
      • -
      • varaible2 is a LIST variable to iterate over.
      • -
      -

      Example:

      -
      PRINT "Counting flamed out engines:".
      -SET numOUT to 0.
      -LIST ENGINES IN MyList.
      -FOR eng IN MyList {
      -    IF ENG:FLAMEOUT {
      -        set numOUT to numOUT + 1.
      -    }
      -}
      -PRINT "There are " + numOut + "Flamed out engines.".
      -
      -
      -
      -
      -

      WAIT

      -

      Halts execution for a specified amount of time, or until a specific set of criteria are met. Note that running a WAIT UNTIL statement can hang the machine forever if the criteria are never met. Examples:

      -
      WAIT 6.2.                     // Wait 6.2 seconds
      -WAIT UNTIL X > 40.            // Wait until X is greater than 40
      -WAIT UNTIL APOAPSIS > 150000. // You can see where this is going
      -
      -
      -

      Note that any WAIT statement, no matter what the actual expression is, will always result in a wait time that lasts at least one physics tick.

      -
      -
      -

      WHEN / THEN

      -

      Executes a command when a certain criteria are met. Unlike WAIT, WHEN -does not halt execution. It starts a check in the background that will keep actively looking for the trigger condition while the rest of the code continues. When it triggers, the body after the THEN will execute exactly once, after which the trigger is removed unless the PRESERVE is used, in which case the trigger is not removed.

      -

      The body of a THEN or an ON statement interrupts the normal flow of a kOS program. When the event that triggers the body happens, the main kOS program is paused until the body of the THEN completes.

      -
      -

      Warning

      -

      Do not make the body of a WHEN/THEN take a long time to execute. If you attempt to run code that lasts too long in the body of your WHEN/THEN statement, it will cause an error. Avoid looping during WHEN/THEN if you can. For details on how to deal with this, see the tutorial on design patterns.

      -
      -
      -

      Note

      -
      -

      Changed in version 0.12: IMPORTANT BREAKING CHANGE: In previous versions of kOS, the body of a WHEN/THEN would execute simultaneously in the background with the rest of the main program. This behavior has changed as of version 0.12 of kOS, as described above, and scripts that used to rely on this behavior will not work with version 0.12 of kOS

      -
      -
      -

      Example:

      -
      WHEN BCount < 99 THEN PRINT BCount + " bottles of beer on the wall”.
      -
      -// Watch in the background for when the altitude is high enough.
      -// Once it is, then turn on the solar panels and action group 1
      -WHEN altitude > 70000 THEN {
      -    PRINT "ACTIVATING PANELS AND AG 1.".
      -    PANELS ON.
      -    AG1 ON.
      -}
      -
      -
      -

      A WHEN/THEN trigger is removed when the program that created it exits, even if it has not occurred yet. The PRESERVE can be used inside the THEN clause of a WHEN statement. If you are going to make extensive use of WHEN/THEN triggers, it’s important to understand more details of how they work in the kOS CPU.

      -
      -
      -

      ON

      -

      The ON command is almost identical to the WHEN/THEN command. ON sets up a trigger in the background that will run the selected command exactly once when the boolean variable changes state from true to false or from false to true. This command is best used to listen for action group activations.

      -

      Just like with the WHEN/THEN command, the PRESERVE command can be used inside the code block to cause the trigger to remain active and not go away.

      -

      How does it differ from WHEN/THEN? The WHEN/THEN triggers are executed whenever the conditional expression becomes true. ON triggers are executed whenever the boolean variable changes state either from false to true or from true to false.

      -

      The body of an ON statement can be a list of commands inside curly braces, just like for WHEN/THEN. Also just like with WHEN/THEN, the body of the ON interrupts all of KSP while it runs, so it should be designed to be a short and finish quickly without getting stuck in a long loop:

      -
      ON AG3 {
      -   PRINT "Action Group 3 Activated!”.
      -}
      -ON SAS PRINT "SAS system has been toggled”.
      -ON AG1 {
      -    PRINT "Action Group 1 activated.".
      -    PRESERVE.
      -}
      -
      -
      -
      -

      Warning

      -

      DO NOT make the body of an ON statement take a long time to execute. If you attempt to run code that lasts too long in the body of your ON statement, it will cause an error. For general help on how to deal with this, see the tutorial on design patterns.

      -
      -

      Avoid looping during ON code blocks if you can. If you are going to make extensive use of ON triggers, it’s important to understand more details of how they work in the kOS CPU.

      -
      -
      -

      PRESERVE

      -

      PRESERVE is a command keyword that is only valid inside of WHEN/THEN and ON code blocks.

      -

      When a WHEN/THEN or ON condition is triggered, the default behavior is to execute the code block body exactly once and only once, and then the trigger condition is removed and the trigger will never occur again.

      -

      To alter this, execute the PRESERVE command anywhere within the body of the code being executed and it tells the kOS computer to keep the trigger condition active. When it finishes executing the code block of the trigger, if PRESERVE has happened anywhere within that run of the block of code, it will not remove the trigger. Instead it will allow it to re-trigger, possibly as soon as the very next tick. If the PRESERVE keyword is executed again and again each time the trigger occurs, the trigger could remain active indefinitely.

      -

      The following example sets up a continuous background check to keep looking for if there’s no fuel in the current stage, and if there is, then it activates the next stage, but no more often than once every half second. Once more than NUMSTAGES have happened, it allows the check to stop executing but it keeps the check alive until that happens:

      -
      SET NUMSTAGES TO 5.
      -SET COOLDOWN_START TO 0.
      -
      -WHEN (TIME:SECONDS > COOLDOWN_START + 0.5) AND STAGE:LIQUIDFUEL = 0 {
      -    SET COOLDOWN_START TO TIME:SECONDS.
      -    STAGE.
      -    SET NUMSTAGES TO NUMSTAGES - 1.
      -    IF NUMSTAGES > 0 {
      -        PRESERVE.
      -    }
      -}
      -
      -// Continue to the rest of the code
      -
      -
      -
      -
      -

      Boolean Operators

      -

      All conditional statements, like IF, can make use of boolean operators. The order of operations is as follows:

      -
        -
      • = < > <= >= <>
      • -
      • AND
      • -
      • OR
      • -
      • NOT
      • -
      -

      Boolean is a type that can be stored in a variable and used that way as well. The constants True and False (case insensitive) may be used as values for boolean variables. If a number is used as if it was a Boolean variable, it will be interpreted in the standard way (zero means false, anything else means true):

      -
      IF X = 1 AND Y > 4 { PRINT "Both conditions are true". }
      -IF X = 1 OR Y > 4 { PRINT "At least one condition is true". }
      -IF NOT (X = 1 or Y > 4) { PRINT "Neither condition is true". }
      -IF X <> 1 { PRINT "X is not 1". }
      -SET MYCHECK TO NOT (X = 1 or Y > 4).
      -IF MYCHECK { PRINT "mycheck is true." }
      -LOCK CONTINUOUSCHECK TO X < 0.
      -WHEN CONTINUOUSCHECK THEN { PRINT "X has just become negative.". }
      -IF True { PRINT "This statement happens unconditionally." }
      -IF False { PRINT "This statement never happens." }
      -IF 1 { PRINT "This statement happens unconditionally." }
      -IF 0 { PRINT "This statement never happens." }
      -IF count { PRINT "count isn't zero.". }
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      KerboScript Syntax Specification

      -

      Next topic

      -

      Variables & Statements

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/language/syntax.html b/language/syntax.html deleted file mode 100644 index a7afd4fa7..000000000 --- a/language/syntax.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - KerboScript Syntax Specification — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      KerboScript Syntax Specification

      -

      This describes what is and is not a syntax error in the KerboScript programming language. It does not describe what function calls exist or which commands and built-in variables are present. Those are contained in other documents.

      - -
      -

      General Rules

      -

      Whitespace consisting of consecutive spaces, tabs, and line breaks are all considered identical to each other. Because of this, indentation is up to you. You may indent however you like.

      -
      -

      Note

      -

      Statements are ended with a period character (”.”).

      -
      -

      The following are reserved command keywords and special -operator symbols:

      -

      Arithmetic Operators:

      -
      +  -  *  /  ^  e  (  )
      -
      -
      -

      Logic Operators:

      -
      not  and  or  true  false  <>  >=  <=  =  >  <
      -
      -
      -

      Instructions and keywords:

      -
      set  to  if  else  until  lock  unlock  print  at  on  toggle
      -wait  when  then  off  stage  clearscreen  add  remove  log
      -break  preserve  declare  parameter  switch  copy  from  rename
      -volume  file  delete  edit  run  compile  list  reboot  shutdown
      -for  unset  batch  deploy  in  all
      -
      -
      -

      Other symbols:

      -
      {  }  [  ]  ,  :  //
      -
      -
      -

      Comments consist of everything from a “//” symbol to the end of the line:

      -
      set x to 1. // this is a comment.
      -
      -
      -

      Identifiers: Identifiers consist of: a string of (letter, digit, or -underscore). The first character must be a letter. The rest may be letters, digits or underscores. Identifiers are case-insensitive. The following are identical identifiers:

      -
      My_Variable  my_varible  MY_VARAIBLE
      -
      -
      -
      -
      case-insensitivity
      -

      The same case-insensitivity applies throughout the entire language, with all keywords except when comparing literal strings. The values inside the strings are still case-sensitive, for example, the following will print “unequal”:

      -
      if "hello" = "HELLO" {
      -    print "equal".
      -} else {
      -    print "unequal".
      -}
      -
      -
      -
      -
      Suffixes
      -

      Some variable types are structures that contain sub-portions. The separator between the main variable and the item inside it is a colon character (:). When this symbol is used, the part on the right-hand side of the colon is called the “suffix”:

      -
      list parts in mylist.
      -print mylist:length. // length is a suffix of mylist
      -
      -
      -
      -
      -

      Suffixes can be chained together, as in this example:

      -
      print ship:velocity:orbit:x.
      -
      -
      -

      In the above example you’d say “velocity is a suffix of ship”, and “orbit is a suffix of ship:velocity”, and “x is a suffix of ship:velocity:orbit”.

      -
      -
      -

      Functions

      -

      There exist a number of built-in functions you can call using their names. When you do so, you can do it like so:

      -
      functionName( *arguments with commas between them* ).
      -
      -
      -

      For example, the ROUND function takes 2 arguments:

      -
      print ROUND(1230.12312, 2).
      -
      -
      -

      The SIN function takes 1 argument:

      -
      print SIN(45).
      -
      -
      -

      When a function requires zero arguments, it is legal to call it using the parentheses or not using them. You can pick either way:

      -
      // These both work:
      -CLEARSCREEN.
      -CLEARSCREEN().
      -
      -
      -
      -
      -

      Suffixes as Functions (Methods)

      -

      Some suffixes are actually functions you can call. When that is the case, these suffixes are called “method suffixes”. Here are some examples:

      -
      set x to ship:partsnamed("rtg").
      -print x:length().
      -x:remove(0).
      -x:clear().
      -
      -
      -
      -
      -

      Built-In Special Variable Names

      -

      Some variable names have special meaning and will not work as identifiers. Understanding this list is crucial to using kOS effectively, as these special variables are the usual way to query flight state information. The full list of reserved variable names is on its own page.

      -
      -
      -

      What does not exist (yet?)

      -

      Concepts that many other languages have, that are missing from KerboScript, are listed below. Many of these are things that could be supported some day, but at the moment with the limited amount of developer time available they haven’t become essential enough to spend the time on supporting them.

      -
      -
      user-made functions
      -
      There are built-in functions you can call, but you can’t make your own in the script. The closest you can come to this is to make a separate script file and you can RUN the script file from another script file.
      -
      local variables
      -
      All variables are in the same global namespace. You can’t make local variables. If homemade functions are ever supported, that is when local variables would become useful.
      -
      user-made structures or classes
      -
      Several of the built-in variables of kOS are essentially “classes” with methods and fields, however there’s currently no way for user code to create its own classes or structures. Supporting this would open up a large can of worms, as it would then make the kOS system more complex.
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      General Features of the KerboScript Language

      -

      Next topic

      -

      Flow Control

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/language/variables.html b/language/variables.html deleted file mode 100644 index 68652226f..000000000 --- a/language/variables.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - Variables & Statements — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Variables & Statements

      - -
      -

      DECLARE

      -

      Declares a global variable. Alternatively, a variable can be implicitly declared by any SET or LOCK statement:

      -
      DECLARE X.
      -
      -
      -
      -
      -

      DECLARE PARAMETER

      -

      Declares variables to be used as a parameter that can be passed in using the RUN command.

      -

      Program 1:

      -
      // This is the contents of program1:
      -DECLARE PARAMETER X.
      -DECLARE PARAMETER Y.
      -PRINT "X times Y is " + X*Y.
      -
      -
      -

      Program 2:

      -
      // This is the contents of program2, which calls program1:
      -SET A TO 7.
      -RUN PROGRAM1( A, A+1 ).
      -
      -
      -

      The above example would give the output:

      -
      X times Y is 56.
      -
      -
      -

      It is also possible to put more than one parameter into a single DECLARE PARAMETER statement, separated by commas, as shown below:

      -
      DECLARE PARAMETER X, Y, CheckFlag.
      -
      -
      -

      This is exactly equivalent to:

      -
      DECLARE PARAMETER X.
      -DECLARE PARAMETER Y.
      -DECLARE PARAMETER CheckFlag.
      -
      -
      -

      Note: Unlike normal variables, Parameter variables are local to the program. When program A calls program B and passes parameters to it, program B can alter their values without affecting the values of the variables in program A.

      -
      -
      Caveat
      -
      This is only true if the values are primitive singleton values like numbers or booleans. If the values are Structures like Vectors or Lists, then they do end up behaving as if they were passed by reference, in the usual way that should be familiar to people who have used languages like Java or C# before.
      -
      -

      The DECLARE PARAMETER statements can appear anywhere in a program as long as they are in the file at a point earlier than the point at which the parameter is being used. The order the arguments need to be passed in by the caller is the order the DECLARE PARAMETER statements appear in the program being called.

      -
      -

      Note

      -

      Pass By Value

      -

      The following paragraph is important for people familiar with other programming languages. If you are new to programming and don’t understand what it is saying, that’s okay you can ignore it.

      -

      At the moment the only kind of parameter supported is a pass-by-value parameter, and pass-by reference parameters don’t exist. Be aware, however, that due to the way kOS is implemented on top of a reference-using object-oriented language (CSharp), if you pass an argument which is a complex aggregate structure (i.e. a Vector, or a List - anything that kOS lets you use a colon suffix with), then the parameters will behave exactly like being passed by reference because all you’re passing is the handle to the object rather than the object itself. This should be familiar behavior to anyone who has written software in Java or C# before.

      -
      -
      -
      -

      SET

      -

      Sets the value of a variable. Declares a global variable if it doesn’t already exist:

      -
      SET X TO 1.
      -
      -
      -
      -
      -

      LOCK

      -

      Declares that the idenifier will refer to an expression that is always re-evaluated on the fly every time it is used:

      -
      SET Y TO 1.
      -LOCK X TO Y + 1.
      -PRINT X.    // prints "2"
      -SET Y TO 2.
      -PRINT X.    // prints "3"
      -
      -
      -
      -
      -

      TOGGLE

      -

      Toggles a variable between TRUE or FALSE. If the variable in question starts out as a number, it will be converted to a boolean and then toggled. This is useful for setting action groups, which are activated whenever their values are inverted:

      -
      TOGGLE AG1. // Fires action group 1.
      -TOGGLE SAS. // Toggles SAS on or off.
      -
      -
      -
      -
      -

      ON

      -

      Sets a variable to TRUE. This is useful for the RCS and SAS bindings:

      -
      RCS ON.  // Turns on the RCS
      -
      -
      -
      -
      -

      OFF

      -

      Sets a variable to FALSE. This is useful for the RCS and SAS bindings:

      -
      RCS OFF.  // Turns off the RCS
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Flow Control

      -

      Next topic

      -

      Mathematics and Basic Geometry

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math.html b/math.html deleted file mode 100644 index df7429858..000000000 --- a/math.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - Mathematics and Basic Geometry — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Previous topic

      -

      Variables & Statements

      -

      Next topic

      -

      Fundamental Constants

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math/basic.html b/math/basic.html deleted file mode 100644 index efe169419..000000000 --- a/math/basic.html +++ /dev/null @@ -1,505 +0,0 @@ - - - - - - - - Fundamental Constants — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Fundamental Constants

      -

      A few fundamental constants can be obtained by using the expression CONSTANT() followed by a colon (:) followed by one of the following:

      - ---- - - - - - - - - - - - - - - - - -
      IdentifierDescription
      GNewton’s Gravitational Constant
      ENatural Log
      PI\(π\)
      -
      -
      -Constant():G
      -

      Newton’s Gravitational Constant, 6.67384E-11:

      -
      PRINT "Gravitational parameter of Kerbin is:".
      -PRINT constant():G * Kerbin:Mass.
      -
      -
      -
      - -
      -
      -Constant():E
      -

      Natural Log base “e”:

      -
      PRINT "e^2 is:".
      -PRINT constant():e ^ 2.
      -
      -
      -
      - -
      -
      -Constant():PI
      -

      Ratio of circumference of a circle to its diameter

      -
      - -
      -
      -

      Mathematical Functions

      - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      FunctionDescription
      ABS(a)absolute value
      CEILING(a)round up
      FLOOR(a)round down
      LN(a)natural log
      LOG10(a)log base 10
      MOD(a,b)modulus
      MIN(a,b)minimum
      MAX(a,b)maximum
      ROUND(a)round to whole number
      ROUND(a,b)round to nearest place
      SQRT(a)square root
      -
      -
      -ABS(a)
      -

      Returns absolute value of input:

      -
      PRINT ABS(-1). // prints 1
      -
      -
      -
      - -
      -
      -CEILING(a)
      -

      Rounds up to the nearest whole number:

      -
      PRINT CEILING(1.887). // prints 2
      -
      -
      -
      - -
      -
      -FLOOR(a)
      -

      Rounds down to the nearest whole number:

      -
      PRINT FLOOR(1.887). // prints 1
      -
      -
      -
      - -
      -
      -LN(a)
      -

      Gives the natural log of the provided number:

      -
      PRINT LN(2). // prints 0.6931471805599453
      -
      -
      -
      - -
      -
      -LOG10(a)
      -

      Gives the log base 10 of the provided number:

      -
      PRINT LOG10(2). // prints 0.30102999566398114
      -
      -
      -
      - -
      -
      -MOD(a,b)
      -

      Returns remainder from integer division:

      -
      PRINT MOD(21,6). // prints 3
      -
      -
      -
      - -
      -
      -MIN(a,b)
      -

      Returns The lower of the two values:

      -
      PRINT MIN(0,100). // prints 0
      -
      -
      -
      - -
      -
      -MAX(a,b)
      -

      Returns The higher of the two values:

      -
      PRINT MAX(0,100). // prints 100
      -
      -
      -
      - -
      -
      -ROUND(a)
      -

      Rounds to the nearest whole number:

      -
      PRINT ROUND(1.887). // prints 2
      -
      -
      -
      - -
      -
      -ROUND(a,b)
      -

      Rounds to the nearest place value:

      -
      PRINT ROUND(1.887,2). // prints 1.89
      -
      -
      -
      - -
      -
      -SQRT(a)
      -

      Returns square root:

      -
      PRINT SQRT(7.89). // prints 2.80891438103763
      -
      -
      -
      - -
      -

      Trigonometric Functions

      - --- - - - - - - - - - - - - - - - - - - - - -
      Function
      SIN(a)
      COS(a)
      TAN(a)
      ARCSIN(x)
      ARCCOS(x)
      ARCTAN(x)
      ARCTAN2(x,y)
      -
      -
      -SIN(a)
      -
      --- - - - - - -
      Parameters:
        -
      • a – (deg) angle
      • -
      -
      Returns:

      sine of the angle

      -
      -
      PRINT SIN(6). // prints 0.10452846326
      -
      -
      -
      - -
      -
      -COS(a)
      -
      --- - - - - - -
      Parameters:
        -
      • a – (deg) angle
      • -
      -
      Returns:

      cosine of the angle

      -
      -
      PRINT COS(6). // prints 0.99452189536
      -
      -
      -
      - -
      -
      -TAN(a)
      -
      --- - - - - - -
      Parameters:
        -
      • a – (deg) angle
      • -
      -
      Returns:

      tangent of the angle

      -
      -
      PRINT TAN(6). // prints 0.10510423526
      -
      -
      -
      - -
      -
      -ARCSIN(x)
      -
      --- - - - - - -
      Parameters:
        -
      • x – (scalar)
      • -
      -
      Returns:

      (deg) angle whose sine is x

      -
      -
      PRINT ARCSIN(0.67). // prints 42.0670648
      -
      -
      -
      - -
      -
      -ARCCOS(x)
      -
      --- - - - - - -
      Parameters:
        -
      • x – (scalar)
      • -
      -
      Returns:

      (deg) angle whose cosine is x

      -
      -
      PRINT ARCCOS(0.67). // prints 47.9329352
      -
      -
      -
      - -
      -
      -ARCTAN(x)
      -
      --- - - - - - -
      Parameters:
        -
      • x – (scalar)
      • -
      -
      Returns:

      (deg) angle whose tangent is x

      -
      -
      PRINT ARCTAN(0.67). // prints 33.8220852
      -
      -
      -
      - -
      -
      -ARCTAN2(y,x)
      -
      --- - - - - - -
      Parameters:
        -
      • y – (scalar)
      • -
      • x – (scalar)
      • -
      -
      Returns:

      (deg) angle whose tangent is \(\frac{y}{x}\)

      -
      -
      PRINT ARCTAN2(0.67, 0.89). // prints 36.9727625
      -
      -
      -

      The two parameters resolve ambiguities when taking the arctangent. See the wikipedia page about atan2 for more details.

      -
      - -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Mathematics and Basic Geometry

      -

      Next topic

      -

      Vectors

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math/direction.html b/math/direction.html deleted file mode 100644 index a5346680d..000000000 --- a/math/direction.html +++ /dev/null @@ -1,430 +0,0 @@ - - - - - - - - Directions — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Directions

      - -

      Direction objects represent a rotation starting from an initial point in KSP‘s coordinate system where the initial state was looking down the \(+z\) axis, with the camera “up” being the \(+y\) axis. This exists primarily to enable automated steering.

      -

      In your thinking, you can largely think of Directions as being Rotations and Rotations as being Directions. The two concepts can be used interchangably. Used on its own to steer by, a rotation from the default XYZ axes of the universe into a new rotation does in fact provide an absolute direction, thus the name Direction for these objects even though in reality they are just Rotations. It’s important to know that Directions are just rotations because you can use them to modify other directions or vectors.

      -
      -

      Creation

      - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      MethodDescription
      R(pitch,yaw,roll)Euler rotation
      Q(x,y,z,rot)Quaternion
      HEADING(dir,pitch)Compass heading
      LOOKDIRUP(lookAt,lookUp)Looking along vector lookAt, rolled so that lookUp is upward.
      ANGLEAXIS(degress,axisVector)A rotation that would rotate the universe around an axis
      ROTATEFROMTO(fromVec,toVec)A rotation that would go from vectors fromVec to toVec
      FACINGFrom SHIP or TARGET
      UPFrom SHIP
      PROGRADE, etc.From SHIP, TARGET or BODY
      -
      -
      -R(pitch,yaw,roll)
      -

      A Direction can be created out of a Euler Rotation, indicated with the R() function, as shown below where the pitch, yaw and roll values are in degrees:

      -
      SET myDir TO R( a, b, c ).
      -
      -
      -
      - -
      -
      -Q(x,y,z,rot)
      -

      A Direction can also be created out of a Quaternion tuple, indicated with the Q() function, as shown below where x, y, and z are a Vector to rotate around, and rot is how many degrees to rotate:

      -
      SET myDir TO Q( x, y, z, rot ).
      -
      -
      -
      - -
      -
      -HEADING(dir,pitch)
      -

      A Direction can be created out of a HEADING() function. The first parameter is the compass heading, and the second parameter is the pitch above the horizon:

      -
      SET myDir TO HEADING(degreesFromNorth, pitchAboveHorizon).
      -
      -
      -
      - -
      -
      -LOOKDIRUP(lookAt,lookUp)
      -

      A Direction can be created with the LOOKDIRUP function by using two vectors. This is like converting a vector to a direction directly, except that it also provides roll information, which a single vector lacks. lookAt is a vector describing the Direction’s FORE orientation (its local Z axis), and lookUp is a vector describing the direction’s TOP orientation (its local Y axis). Note that lookAt and lookUp need not actually be perpendicualr to each other - they just need to be non-parallel in some way. When they are not perpendicular, then a vector resulting from projecting lookUp into the plane that is normal to lookAt will be used as the effective lookUp instead:

      -
      // Aim up the SOI's north axis (V(0,1,0)), rolling the roof to point to the sun.
      -LOCK STEERING TO LOOKDIRUP( V(0,1,0), SUN:POSITION ).
      -//
      -// A direction that aims normal to orbit, with the roof pointed down toward the planet:
      -LOCK normVec to VCRS(SHIP:BODY:POSITION,SHIP:VELOCITY:ORBIT).  // Cross-product these for a normal vector
      -LOCK STEERING TO LOOKDIRUP( normVec, SHIP:BODY:POSITION).
      -
      -
      -
      - -
      -
      -ANGLEAXIS(degress,axisVector)
      -

      A Direction can be created with the ANGLEAXIS function. It represents a rotation of degrees around an axis of axisVector. To know which way a positive or negative number of degrees rotates, remember this is a left-handed coordinate system:

      -
      // Pick a new rotation that is pitched 30 degrees from the current one, taking into account
      -// the ship's current orientation to decide which direction is the 'pitch' rotation:
      -//
      -SET pitchUp30 to ANGLEAXIS(-30,SHIP:STARFACING).
      -SET newDir to pitchUp30*SHIP:FACING.
      -LOCK STEERING TO newDir.
      -
      -
      -
      - -
      -
      -ROTATEFROMTO(fromVec,toVec)
      -

      A Direction can be created with the ROTATEFROMTO function. It is one of the infinite number of rotatations that could rotate vector fromVec to become vector toVec (or at least pointing in the same direction as toVec, since fromVec and toVec need not be the same magnitude). Note the use of the phrase “infinite number of”. Because there’s no guarantee about the roll information, there are an infinite number of rotations that could qualify as getting you from one vector to another, because there’s an infinite number of roll angles that could result and all still fit the requirement:

      -
      SET myDir to ROTATEFROMTO( v1, v2 ).
      -
      -
      -
      - -
      -
      -Suffix terms from other structures
      -

      A Direction can be made from many suffix terms of other structures, as shown below:

      -
      SET myDir TO SHIP:FACING.
      -SET myDir TO TARGET:FACING.
      -SET myDir TO SHIP:UP.
      -
      -
      -
      - -

      Whenever a Direction is printed, it always comes out showing its Euler Rotation, regardless of how it was created:

      -
      // Initializes a direction to prograde
      -// plus a relative pitch of 90
      -SET X TO SHIP:PROGRADE + R(90,0,0).
      -
      -// Steer the vessel in the direction
      -// suggested by direction X.
      -LOCK STEERING TO X.
      -
      -// Create a rotation facing northeast,
      -// 10 degrees above horizon
      -SET Y TO HEADING(45, 10).
      -
      -// Steer the vessel in the direction
      -// suggested by direction X.
      -LOCK STEERING TO Y.
      -
      -// Set by a rotation in degrees
      -SET Direction TO R(0,90,0).
      -
      -
      -
      -
      -

      Structure

      -
      -
      -structure Direction
      -

      The suffixes of a Direction cannot be altered, so to get a new Direction you must construct a new one.

      -

      The Direction object exists primarily to enable automated steering. You can initialize a Direction using a Vector or a Rotation. Direction objects represent a rotation starting from an initial point in KSP‘s coordinate system where the initial state was looking down the \(+z\) axis, with the camera “up” being the \(+y\) axis. So for example, a Direction pointing along the \(x\) axis might be represented as R(0,90,0), meaning the initial \(z\)-axis direction was rotated 90 degrees around the \(y\) axis.

      -

      If you are going to manipulate directions a lot, it’s important to note that the order in which the rotations occur is:

      -
        -
      1. First rotate around \(z\) axis.
      2. -
      3. Then rotate around \(x\) axis.
      4. -
      5. Then rotate around \(y\) axis.
      6. -
      -

      What this means is that if you try to ROLL and YAW in the same tuple, like so: R(0,45,45), you’ll end up rolling first and then yawing, which might not be what you expected. There is little that can be done to change this as it’s the native way things are represented in the underlying Unity engine.

      -

      Also, if you are going to manipulate directions a lot, it’s important to note how KSP‘s native coord system works.

      -
      - -
      -
      -Direction:PITCH
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      Rotation around the \(x\) axis.

      -
      - -
      -
      -Direction:YAW
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      Rotation around the \(y\) axis.

      -
      - -
      -
      -Direction:ROLL
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      Rotation around the \(z\) axis.

      -
      - -
      -
      -Direction:FOREVECTOR
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      Vector of length 1 that is in the same direction as the “look-at” of this Direction. Note that it is the same meaning as “what the Z axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe”. When you LOCK STEERING to a direction, that direction’s FOREVECTOR is the vector the nose of the ship will orient to. SHIP:FACING:FOREVECTOR is the way the ship’s nose is aimed right now.

      -
      - -
      -
      -Direction:TOPVECTOR
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      Vector of length 1 that is in the same direction as the “look-up” of this Direction. Note that it is the same meaning as “what the Y axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe”. When you LOCK STEERING to a direction, that direction’s TOPVECTOR is the vector the roof of the ship will orient to. SHIP:FACING:TOPVECTOR is the way the ship’s roof is aimed right now.

      -
      - -
      -
      -Direction:STARVECTOR
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      Vector of length 1 that is in the same direction as the “starboard side” of this Direction. Note that it is the same meaning as “what the X axis of the universe would be rotated to if this rotation was applied to the basis axes of the universe”. When you LOCK STEERING to a direction, that direction’s STARVECTOR is the vector the right wing of the ship will orient to. SHIP:FACING:STARVECTOR is the way the ship’s right wing is aimed right now.

      -
      - -
      -

      Note

      -

      The difference between a :struct:`Direction` and a ``Vector``

      -

      Vector and a Direction can be represented with the exact same amount of information: a tuple of 3 floating point numbers. So you might wonder why it is that a Vector can hold information about the magnitude of the line segment, while a Direction cannot, given that both have the same amount of information. The answer is that a Direction does contain one thing a Vector does not. A Direction knows which way is “up”, while a Vector does not. If you tell kOS to LOCK STEERING to a Vector, it will be able to point the nose of the vessel in the correct direction, but won’t know which way you want the roof of the craft rotated to. This works fine for axial symmetrical rockets but can be a problem for airplanes.

      -
      -
      -
      -

      Operations and Methods

      -

      You can use math operations on Direction objects as well. The next example uses a rotation of “UP” which is a system variable describing a vector directly away from the celestial body you are under the influence of:

      -

      Supported Direction Operators:

      -
      -

      Direction Multiplied by Direction Dir1 * Dir2 - This operator returns the result of rotating Dir2 by the rotation of Dir1. Note that the order of operations matters here. Dir1*Dir2 is not the same as Dir2*Dir1. Example:

      -
      // A direction pointing along compass heading 330, by rotating NORTH by 30 degrees around UP axis:
      -SET newDir TO ANGLEAXIS(30,SHIP:UP) * NORTH.
      -
      -
      -

      Direction Multiplied by Vector Dir * Vec - This operator returns the result of rotating the vector by Dir:

      -
      // What would the velocity of your ship be if it was angled 20 degrees to your left?
      -SET Vel to ANGLEAXIS(-20,SHIP:TOPVECTOR) * SHIP:VELOCITY:ORBIT.
      -// At this point Vel:MAG and SHIP:VELOCITY:MAG should be the same, but they don't point the same way
      -
      -
      -

      Direction Added to Direction Dir1 + Dir2 - This operator is less reliable because its exact behavior depends on the order of operations of the UnityEngine’s X Y and Z axis rotations, and it can result in gimbal lock. It’s supposed to perform a Euler rotation of one direction by another, but it’s preferred to use Dir*Dir instead, as that doesn’t experience gimbal lock, and does not require that you know the exact transformation order of Unity.

      -
      -

      For vector operations, you may use the :VECTOR suffix in combination with the regular vector methods:

      -
      SET dir TO SHIP:UP.
      -SET newdir TO VCRS(SHIP:PROGRADE:VECTOR, dir:VECTOR)
      -
      -
      -
      -
      -

      Vectors and Directions

      -

      There are some consequences when converting from a Direction to a Vector and vice versa which should not be overlooked.

      -

      A Vector and a Direction can be represented with the exact same amount of information: a tuple of 3 floating point numbers. So you might wonder why it is that a Vector can hold information about the magnitude of the line segment, while a Direction cannot, given that both have the same amount of information. The answer is that a Direction does contain one thing a Vector does not. A Direction knows which way is “up”, while a Vector does not. If you tell kOS to LOCK STEERING to a Vector, it will be able to point the nose of the vessel in the correct direction, but won’t know which way you want the roof of the craft rotated to. This works fine for axial symmetrical rockets but can be a problem for airplanes.

      -

      Therefore if you do this:

      -
      SET MyVec to V(100,200,300).
      -SET MyDir to MyVec:DIRECTION.
      -
      -
      -

      Then MyDir will be a Direction, but it will be a Direction where you have no control over which way is “up” for it.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Vectors

      -

      Next topic

      -

      Geographic Coordinates

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math/geocoordinates.html b/math/geocoordinates.html deleted file mode 100644 index ec441d62e..000000000 --- a/math/geocoordinates.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - Geographic Coordinates — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Geographic Coordinates

      -
      -

      Contents

      - -
      -

      The GeoCoordinates object (also LATLNG) represents a latitude and longitude pair, which is a location on the surface of a Body.

      -
      -

      Creation

      -
      -
      -LATLNG(lat,lng)
      -
      --- - - - - - -
      Parameters:
        -
      • lat – (deg) Latitude
      • -
      • lng – (deg) Longitude
      • -
      -
      Returns:

      GeoCoordinates

      -
      -

      This function creates a GeoCoordiantes object with the given latitude and longitude. Once created it can’t be changed. The GeoCoordinates:LAT and GeoCoordinates:LNG suffixes are get-only and cannot be set. To switch to a new location, make a new call to LATLNG().

      -

      It is also possible to obtain a GeoCoordiates from some suffixes of some other structures. For example:

      -
      SET spot to SHIP:GEOPOSITION.
      -
      -
      -
      - -
      -
      -

      Structure

      -
      -
      -structure GeoCoordinates
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      LATscalar (deg)Latitude
      LNGscalar (deg)Longitude
      DISTANCEscalar (m)distance from CPU Vessel
      TERRAINHEIGHTscalar (m)above or below sea level
      HEADINGscalar (deg)absolute heading from CPU Vessel
      BEARINGscalar (deg)relative direction from CPU Vessel
      -
      - -
      -
      -GeoCoordinates:LAT
      -

      The latitude of this position on the surface.

      -
      - -
      -
      -GeoCoordinates:LNG
      -

      The longitude of this position on the surface.

      -
      - -
      -
      -GeoCoordinates:DISTANCE
      -

      Distance from the CPU_Vessel to this point on the surface.

      -
      - -
      -
      -GeoCoordinates:TERRAINHEIGHT
      -

      Distance of the terrain above “sea level” at this geographical position. Negative numbers are below “sea level.”

      -
      - -
      -
      -GeoCoordinates:HEADING
      -

      The absolute compass direction from the CPU_Vessel to this point on the surface.

      -
      - -
      -
      -GeoCoordinates:BEARING
      -

      The relative compass direction from the CPU_Vessel to this point on the surface. For example, if the vessel is heading at compass heading 45, and the geo-coordinates location is at heading 30, then GeoCoordinates:BEARING will return -15.

      -
      - -
      -
      -

      Examples Usage

      -
      SET spot TO LATLNG(10, 20).     // Initialize point at latitude 10,
      -                                // longitude 20
      -
      -PRINT spot:LAT.                 // Print 10
      -PRINT spot:LNG.                 // Print 20
      -
      -PRINT spot:DISTANCE.            // Print distance from vessel to x
      -                                // (same altitude is presumed)
      -PRINT spot:HEADING.             // Print the heading to the point
      -PRINT spot:BEARING.             // Print the heading to the point
      -                                // relative to vessel heading
      -
      -SET spot TO SHIP:GEOPOSITION.   // Make spot into a location on the
      -                                // surface directly underneath the
      -                                // current ship
      -
      -SET spot TO LATLNG(spot:LAT,spot:LNG+5). // Make spot into a new
      -                                         // location 5  degrees east
      -                                         // of the old one
      -
      -PRINT "THESE TWO NUMBERS SHOULD BE THE SAME:".
      -PRINT (SHIP:ALTITIUDE - SHIP:GEOPOSITION:TERRAINHEIGHT).
      -PRINT ALT:RADAR.
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Directions

      -

      Next topic

      -

      Reference Frames

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math/ref_frame.html b/math/ref_frame.html deleted file mode 100644 index 718abc7dc..000000000 --- a/math/ref_frame.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - Reference Frames — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Reference Frames

      -

      This page describes the \((x,y,z)\) reference frame used for most of kOS‘s vectors. The coordinate system of Kerbal Space Program does some strange things that don’t make a lot of sense at first. For nomenclature, the following terms are used in this documentation:

      -
      -
      -SHIP-RAW
      -

      The name of the reference frame in which the origin point is CPU Vessel (SHIP), and the rotation is identical to KSP‘s native raw coordinate grid.

      -
      - -
      -
      -SOI-RAW
      -

      The name of the reference frame in which the origin point is the center of the SOI body, and the rotation is identical to KSP‘s native raw coordinate grid.

      -
      - -
      -
      -RAW-RAW
      -

      The name of the reference fraem in which both the origin point and the rotation of the axes is identical to KSP‘s native raw coordinate grid. This is never exposed to the KerbalScript program, because the origin point is meaningless to work with.

      -
      - -
      -

      Note

      -

      It is hoped that this may be expanded in the future, and conversion routines provided to let people pick a reference frame that makes sense depending on what the script is trying to do. At the moment the only reference frames used are SHIP-RAW and SOI-RAW, as they match closely to what KSP is using internally.

      -
      -
      -

      Raw Orienatation

      -
      -../_images/KSP_body_coords.png -
      -

      The Y axis of KSP is the only consistent thing. Imagine a ray starting in the center of the SOI body and pointing upward out through the north pole. That is the direction of the Y axis. (If you move to the SOI of a body with an inclinded spin, presumably it will also change the angle of the Y axis to point in the new direction of the body’s spin axis).

      -

      The X and Z axes of the coordinate grid are then consequently aligned with the equator plane of the SOI body, 90 degrees to each other. KSP uses a left-handed coordinate system, so the Z axis will always be rotated 90 degrees to the east of the X axis.

      -
      -../_images/KSP_body_latlong.png -
      -

      However, the X and Z axes are hard to predict where they’ll exactly be. They keep moving depending on where you are, to the point where it’s impossible to get a fix on just which direction they’ll point.

      -
      -
      -

      Origin Position

      -

      The origin position of the \((x,y,z)\) coordinate grid in KSP is also a bit messy. It’s usually near but not exactly on the current ship. kOS performs some conversions for you to make this a bit simpler and keep everything consistent.

      -

      Regardless of where the origin of the underlying KSP system is, in kOS, whenever a POSITION is reported, it will always be reported in a frame of reference where the origin is located at the CPU Vessel.

      -

      However, for the sake of VELOCITY, the origin point of all vectors is usually not SHIP, but rather it’s the SOI body’s center. This is because if the origin point was the SHIP, then the ship’s velocity would always be zero in that frame of reference, and that would not be useful.

      -

      The makers of kOS are aware that this is not technically a proper frame of reference, because the origin point varies depending on if you’re getting POSITION or getting VELOCITY. Fixing it at this point would break a lot of existing scripts, however.

      -

      So the rule of thumb is:

      -
        -
      • For POSITION returned by KSP, the SHIP-RAW reference frame is used: centered on SHIP, with raw axes rotation.
      • -
      • For VELOCITY returned by KSP, the SOI-RAW reference frame is used: centered on SOI Body, with raw axes rotation.
      • -
      -
      -
      -

      Converting

      -

      Converting between SHIP-RAW and SOI-RAW reference frames is a simple matter of adding or subtracting the SHIP:BODY:POSITION vector from the coordinate, to move the origin point. This is because both are using the same axes rotation.

      -
        -
      • Any SHIP-RAW vector Minus SHIP:BODY:POSITION Gives the vector in SOI-RAW coordinates.
      • -
      • Any SOI-RAW vector Plus SHIP:BODY:POSITION Gives the vector in SHIP-RAW coordinates.
      • -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Geographic Coordinates

      -

      Next topic

      -

      Command Reference

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/math/vector.html b/math/vector.html deleted file mode 100644 index 8cf9e78a1..000000000 --- a/math/vector.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - Vectors — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Vectors

      - -
      -

      Creation

      -
      -
      -V(x,y,z)
      -
      --- - - - - - -
      Parameters:
        -
      • x – (scalar) \(x\) coordinate
      • -
      • y – (scalar) \(y\) coordinate
      • -
      • z – (scalar) \(z\) coordinate
      • -
      -
      Returns:

      Vector

      -
      -

      This creates a new vector from 3 components in \((x,y,z)\):

      -
      SET vec TO V(x,y,z).
      -
      -
      -

      Here, a new Vector called vec is created . The object Vector represents a three-dimensional euclidean vector To deeply understand most vectors in kOS, you have to understand a bit about the underlying coordinate system of KSP. If you are having trouble making sense of the direction the axes point in, go read that page.

      -
      - -
      -
      -

      Structure

      -
      -
      -structure Vector
      -
      - ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeGetSet
      Xscalaryesyes
      Yscalaryesyes
      Yscalaryesyes
      MAGscalaryesyes
      NORMALIZEDVectoryesno
      SQRMAGNITUDEscalaryesno
      DIRECTIONDirectionyesyes
      VECVectoryesno
      -
      - -
      -
      -Vector:X
      -
      --- - - - - - -
      Type:scalar
      Access:Get/Set
      -

      The \(x\) component of the vector.

      -
      - -
      -
      -Vector:Y
      -
      --- - - - - - -
      Type:scalar
      Access:Get/Set
      -

      The \(y\) component of the vector.

      -
      - -
      -
      -Vector:Z
      -
      --- - - - - - -
      Type:scalar
      Access:Get/Set
      -

      The \(z\) component of the vector.

      -
      - -
      -
      -Vector:MAG
      -
      --- - - - - - -
      Type:scalar
      Access:Get/Set
      -

      The magnitude of the vector, as a scalar number, by the Pythagorean Theorem.

      -
      - -
      -
      -Vector:NORMALIZED
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      This creates a unit vector pointing in the same direction as this vector. This is the same effect as multiplying the vector by the scalar 1 / vec:MAG.

      -
      - -
      -
      -Vector:SQRMAGNITUDE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      The magnitude of the vector, squared. Use instead of vec:MAG^2 if you need to square of the magnitude as this skips the step in the Pythagorean formula where you take the square root in the first place. Taking the square root and then squaring that would introduce floating point error needlessly.

      -
      - -
      -
      -Vector:DIRECTION
      -
      --- - - - - - -
      Type:Direction
      Access:Get/Set
      -
      -
      GET:
      -
      The vector rendered into a Direction (see note at the bottom of this page about information loss when doing this).
      -
      SET:
      -
      Tells the vector to keep its magnitude as it is but point in a new direction, adjusting its \((x,y,z)\) numbers accordingly.
      -
      -
      - -
      -
      -Vector:VEC
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      This is a suffix that creates a COPY of this vector. Useful if you want to copy a vector and then change the copy. Normally if you SET v2 TO v1, then v1 and v2 are two names for the same vector and changing one would change the other.

      -
      - -
      -
      -

      Operations and Methods

      - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Method / OperatorReturn Type
      * (asterisk)scalar or Vector
      + (plus)Vector
      - (minus)Vector
      VDOT, VECTORDOTPRODUCT, *scalar
      VCRS, VECTORCROSSPRODUCTVector
      VANG, VECTORANGLEscalar (deg)
      VXCL, VECTOREXCLUDEVector
      -
      -
      -*
      -

      Scalar multiplication or dot product of two Vectors. See also VECTORDOTPRODUCT:

      -
      SET a TO 2.
      -SET vec1 TO V(1,2,3).
      -SET vec2 TO V(2,3,4).
      -PRINT a * vec1.     // prints: V(2,4,6)
      -PRINT vec1 * vec2.  // prints: 20
      -
      -
      -
      - -
      -
      -+, -
      -

      Vector addition and subtraction by a scalar or another Vector:

      -
      SET a TO 2.
      -SET vec1 TO V(1,2,3).
      -SET vec2 TO V(2,3,4).
      -PRINT vec1 + vec2.  // prints: V(3,5,7)
      -PRINT vec2 - vec1.  // prints: V(1,1,1)
      -
      -
      -
      - -
      -
      -VDOT(v1,v2)
      -

      Same as VECTORDOTPRODUCT(v1,v2) and v1 * v2.

      -
      - -
      -
      -VECTORDOTPRODUCT(v1,v2)
      -
      --- - - - - - - - -
      Parameters: -
      Returns:

      The vector dot-product

      -
      Return type:

      scalar

      -
      -

      This is the dot product of two vectors returning a scalar number. This is the same as v1 * v2:

      -
      SET vec1 TO V(1,2,3).
      -SET vec2 TO V(2,3,4).
      -
      -// These will all print the value: 20
      -PRINT vec1 * vec2.
      -PRINT VDOT(vec1, vec2).
      -PRINT VECTORDOTPRODUCT(vec1, vec2).
      -
      -
      -
      - -
      -
      -VCRS(v1,v2)
      -

      Same as VECTORCROSSPRODUCT(v1,v2)

      -
      - -
      -
      -VECTORCROSSPRODUCT(v1,v2)
      -
      --- - - - - - - - -
      Parameters: -
      Returns:

      The vector cross-product

      -
      Return type:

      Vector

      -
      -

      The vector cross product of two vectors in the order (v1,v2) returning a new Vector:

      -
      SET vec1 TO V(1,2,3).
      -SET vec2 TO V(2,3,4).
      -
      -// These will both print: V(-1,2,-1)
      -PRINT VCRS(vec1, vec2).
      -PRINT VECTORCROSSPRODUCT(vec1, vec2).
      -
      -
      -
      - -
      -
      -VANG(v1,v2)
      -

      Same as VECTORANGLE(v1,v2).

      -
      - -
      -
      -VECTORANGLE(v1,v2)
      -
      --- - - - - - - - -
      Parameters: -
      Returns:

      Angle between two vectors

      -
      Return type:

      scalar

      -
      -

      This returns the angle between v1 and v2. It is the same result as:

      -
      -\[\arccos\left( - \frac{ - \vec{v_1}\cdot\vec{v_2} - }{ - \left|\vec{v_1}\cdot\vec{v_2}\right| - } -\right)\]
      -

      or in KerboScript:

      -
      arccos( (VDOT(v1,v2) / VDOT(v1,v2):MAG ) )
      -
      -
      -
      - -
      -
      -VXCL(v1,v2)
      -

      Same as VECTOREXCLUDE(v1,v2)

      -
      - -
      -
      -VECTOREXCLUDE(v1,v2)
      -

      This is a vector, v2 with all of v1 excluded from it. In other words, the projection of v2 onto the plane that is normal to v1.

      -
      - -

      Some examples of using the Vector object:

      -
      // initializes a vector with x=100, y=5, z=0
      -SET varname TO V(100,5,0).
      -
      -varname:X.    // Returns 100.
      -V(100,5,0):Y. // Returns 5.
      -V(100,5,0):Z. // Returns 0.
      -
      -// Returns the magnitude of the vector
      -varname:MAG.
      -
      -// Changes x coordinate value to 111.
      -SET varname:X TO 111.
      -
      -// Lengthen or shorten vector to make its magnitude 10.
      -SET varname:MAG to 10.
      -
      -// get vector pointing opposite to surface velocity.
      -SET retroSurf to (-1)*velocity:surface.
      -
      -// use cross product to find normal to the orbit plane.
      -SET norm to VCRS(velocity:orbit, ship:body:position).
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Fundamental Constants

      -

      Next topic

      -

      Directions

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/objects.inv b/objects.inv deleted file mode 100644 index f387f9910..000000000 Binary files a/objects.inv and /dev/null differ diff --git a/search.html b/search.html deleted file mode 100644 index eda054785..000000000 --- a/search.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - Search — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -

      Search

      -
      - -

      - Please activate JavaScript to enable the search - functionality. -

      -
      -

      - From here you can search these documents. Enter your search - words into the box below and click "search". Note that the search - function will automatically search for all of the words. Pages - containing fewer words won't appear in the result list. -

      -
      - - - -
      - -
      - -
      - -
      -
      -
      -
      -
      -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/searchindex.js b/searchindex.js deleted file mode 100644 index 53d6fdc65..000000000 --- a/searchindex.js +++ /dev/null @@ -1 +0,0 @@ -Search.setIndex({envversion:42,terms:{yellow:[22,55,33],interchang:[64,0],four:[6,2],prefix:[12,28,40],sleep:41,electriccharg:[12,51,56],whose:35,messi:[38,17],swap:31,under:[63,0,1,33,55,58,20,54,64],futurevel:55,digit:[8,2],everi:[46,0,1,51,36,19,4,37,44,58,39,61,25,41,49,45],rel:[64,24,1,36,37],cooldown_start:49,blanket:61,archetectur:58,allowshutdown:15,trigonometr:[],affect:[46,59,61,39,41,54],school:[0,54],plural:59,scalar:[51,65,1,2,15,34,18,35,4,56,44,24,48,33,37,42,43,64,21,28,40],frozen:[12,32],vector:[14,55,6,39,40,42,12,28],red:[22,61],searchfil:2,tuturi:61,namelist:61,seper:12,direct:[12,14,28,42],histor:0,enjoi:20,consequ:[38,64],second:[30,14,49,33,2,19,44,6,59,41,42,43,12,28,45],aggreg:39,gforce_setpoint:45,even:[58,28,40],hide:21,neg:[46,49,33,19,24,64],altitud:[30,13,61,1,18,19,37,44,6,24,41,54,43,49,12,45],"new":[30,58,0,39,33,61,5,38,6,24,59,41,43,12,48],symmetr:[64,5],ever:[8,2,54],gimbal:64,behavior:[28,40],never:[31,49,18,19,4,38,59,41,54,43,61,45],pilotstarboard:[28,40],here:[1,54,4,6,8,10,12,18,19,21,25,28,30,33,34,41,42,43,45,46,49,51,52,61,5,57,58,64,48],met:[19,49],confuis:59,weirdli:54,interpret:[6,12,49,13],my_vess:37,listabl:47,forum:41,prognam:58,anymor:[20,61,16],precis:59,permit:46,studi:45,glu:37,mutual:10,campaign:[46,59,12,0],lengthen:48,homemad:8,brought:45,thrust:[15,34,37,54,12,45],unix:59,txt:[58,0,45],unit:[0,1,33,15,18,44,41,54,43,12,48],highli:45,plot:45,describ:[55,0,49,41,2,5,61,16,4,37,44,38,8,31,43,12,64],would:[1,7,8,15,19,20,21,25,28,30,31,38,39,41,54,43,46,49,61,56,58,60,64,48],ddthh:2,call:[0,42,6,7,8,31,15,19,20,21,24,28,17,33,39,41,54,45,48,49,51,61,58,60,65],recommend:[19,31],pilotyawtrim:[28,40],until:[14,50,61,58,6,41,42,12,28],angularvel:[12,37,44],relat:16,warp:47,exce:41,progam:20,midst:5,hold:[49,37,56,41,43,64],addon:45,pilotwheelst:[28,40],join:65,room:[20,0],setup:[6,45,54],work:[0,1,42,4,6,59,12,14,16,19,28,30,38,22,41,54,45,49,61,5,57,58,20,8,64],worm:8,nextpatch:[43,37],functionnam:8,conceptu:54,introduc:[61,19,6,54,48,45],rework:19,getmodul:[61,4],root:[46,17,35,4,37,61,48],overrid:[28,16],defer:58,give:[28,42,25,41,32],flung:43,indic:[12,61],liter:[8,41,15],want:[20,3],plist:[6,61],end:[30,14,49,18,19,39,58,60,8,40,41,54,43,64,28],quot:58,travel:[45,37],how:[14,55,58,42,12,28],sever:[59,61,19,8,41,54,45],pilotpitchtrim:[28,40],rewind:60,answer:[61,64,31],perspect:[28,40,42],updat:[12,14,28,32],topvector:64,lan:43,bodlist:25,outsid:[46,0,2,34,59,54,43],ladder:49,earlier:[39,0,33],diagram:61,befor:[13,0,33,2,39,6,60,31,20,41,54,28],wrong:36,lat:24,core:[17,4,37,54],arch:46,parallel:[64,1],demonstr:45,attempt:[46,49,33,58,20,41,54,28],opaqu:22,minim:21,imposs:[38,46,61,41],detent:31,perform:[46,59,49,33,19,38,6,61,41,64],curent:12,green:[22,55,33],incorpor:[20,45],enter:[43,12,54],exclus:[10,19],order:[30,61,49,16,54,39,6,60,48,40,41,42,64,65,28],wind:37,oper:[50,16,61,55,6,7,41,10,12],feedback:[27,19],over:[30,54,14,49,19,60,25,42,64,28,45],becaus:[0,4,59,31,15,20,28,30,17,36,38,39,41,54,43,51,61,57,58,60,8,64],keyboard:[7,57,28,54],vari:[31,51,2,19,37,38,60,41],myfil:58,suffix:[50,61,6,40,42,12,28],gentl:[28,42],fit:[12,19,64,45],better:[28,42],fade:21,persist:[46,0,61,5,4,40,54,28],hidden:31,numout:49,them:[0,42,4,55,6,7,8,10,12,14,19,25,28,37,41,54,45,46,61,5,58,20,64],anim:[59,41],thei:[0,6,8,12,31,14,19,28,17,38,39,41,54,45,46,49,61,55,57,58,59,20,64],press:[12,61],promin:45,safe:46,"break":[50,41],interrupt:[49,54],bank:0,dampen:[14,28],choic:[0,54],tylo:44,oxygen:[18,15],accommod:19,arrow:21,each:[46,0,49,61,5,59,38,6,7,8,20,41,43,12,64,45],side:[30,4,8,54,64,65],mean:[14,5,32,17,41,42,12,28],setpoint:[19,45],forgot:28,dawn:0,depress:61,network:[58,0],goe:[13,54],crucial:[12,8],angular:37,content:58,adapt:[19,45],reader:[19,45,54],got:61,navig:4,hang:[49,54],midpoint:21,infin:[46,37],free:[14,28],standard:[12,49,54],speedi:41,convent:32,sceen:25,angl:[38,43,64,35,48],atm:[18,44],isn:[58,20,49,41,54],onto:[46,13,48,31],rang:[42,28,40,32],english:13,surfspe:45,render:[48,41],wast:54,necess:59,hook:61,unlik:[0,49,61,54,39,14,42,28],alreadi:[51,60,39,45,54],somepart:[28,57],perpendicualr:64,wasd:54,hood:20,nomenclatur:[38,17],mymass:6,top:[0,54,56,58,39,62,40,41,42,64,28,45],sometim:[37,58,6,25,54,65],downsid:32,ton:37,too:[61,49,19,44,58,22,41,54,45],similarli:[31,41],pilottop:[28,40],listen:49,namespac:8,tool:20,mainthrottl:[28,40,45,42],termin:[28,47,25,40],technic:[38,54,44],exceut:58,target:[61,4,37,57,58,25,41,12,65,28,64],keyword:[12,47],mymodlist:17,provid:[58,0,35,38,20,61,12,64],tree:[17,5],zero:[30,46,0,1,2,34,61,54,5,4,38,59,60,8,62,41,42,49,12,28,45],freefal:37,matter:[12,20],flame:49,minut:[59,61,19,45,2],beginn:27,latitud:[12,1,24],retrograd:[12,1,33],ran:61,mind:[61,19],rai:38,raw:47,meananomalyatepoch:43,increment:[60,31,45,41],seen:[61,0,25,31,21],seem:[46,36,41],seek:28,minu:[38,20,48],strength:61,ksp:[0,3,4,7,59,12,14,18,28,31,33,37,38,41,54,43,45,46,48,49,51,61,5,58,64,65],span:[0,9],blue:[22,54],copi:47,myprog1:20,myprog3:20,myprog2:20,munsrf:36,object:[39,31,1,51,34,18,36,55,37,44,60,25,40,42,43,12,48,28,64,24],regular:64,letter:[58,8,2],phase:19,prematur:41,tradit:54,don:[17,16,34,61,19,20,38,39,59,12],doc:3,flow:[6,25,50],doe:[55,58,20,25,12,10],dummi:[30,18],declar:[58,8,49,55,50],tech:[46,54],sum:[41,37],dot:[58,48],opposit:[28,48,14,1,36],probe:20,accvec:[19,45],radiu:[19,1,45,44],syntax:[6,49,50],planetari:[43,19],earth:59,thermomet:34,involv:58,despit:44,northeast:[64,54],menu:[57,28,32],explain:[46,28,14,25,54],configur:[12,52,5],theme:3,folder:[13,54],rgba:22,indivdu:0,stop:[49,19,40,41,54,28],ceil:35,solidfuel:12,pogram:54,report:[38,43],parachut:12,mylist:[30,60,8,49,56],sacrific:41,cairan:41,method:[17,50,61,5,14,0,40,28],twice:12,bad:0,septemb:2,apoapsi:[30,1,33,43,49,12],respond:54,moduleparachut:61,mandatori:21,result:[30,13,59,49,2,19,20,58,6,60,61,62,46,12,48,64,45],fail:[58,0,15],exectu:61,best:[49,61,4,58,54,12],subject:31,awar:[14,18,20,38,39,59,40,41,43,12,28],said:[18,61],rare:[20,19],wikipedia:[35,45,41],figur:41,awak:41,awai:[0,49,19,61,41,54,1,64,65],mun:[1,16,36,44,6,43],approach:61,totmass:25,attribut:21,accord:[59,31,45,54],extend:[12,31],extens:[0,49,2,19,58,20],thisatmo:18,allmodul:4,advertis:18,obitalveloc:55,protect:46,easi:[19,54],howev:[58,59,61,19,55,38,39,8,41],against:28,allpartstag:37,steer:[14,49,33,19,40,41,42,12,28,45],gobbledygook:19,logic:[8,19],col:62,guis:58,height:18,guid:54,assum:[0,61,55,4,58,20,41,54,12,45],panel:[12,32],duplic:44,union:37,three:[16,18,61,48,28,45],been:[17,49,61,58,0,25,41,42,28],beer:49,much:[0,15,18,54,55,56,20,59,37,41,42,43,12,28],interest:[61,54],basic:[6,12,20,41],new_boolan_valu:61,tini:20,quickli:[19,49,45],excercis:54,argument:47,multithread:41,craft:[0,54,5,57,14,40,42,64,28],spin:38,degreesfromnorth:64,ident:[46,49,33,38,8,12],tank:[5,45],windup:45,launcher:[27,13,10,54,32],properti:[12,61,4,37],intak:18,air:[18,37,54],aim:[54,14,28,64,65],euclidean:48,calcul:12,player:[61,42,4,40,41,54,28],brake:[12,61,28,57],comptronix:54,somemodul:61,program1:39,program2:39,receiv:7,suggest:[64,41,33],make:[59,1,4,44,6,8,10,31,14,15,19,21,24,25,27,28,30,17,33,38,41,43,45,46,49,61,5,58,20,48],format:[20,59,2],complex:[30,14,41,61,19,5,17,58,39,8,31,54,28],big:[16,55,45,5],in_deadband:45,complet:[61,49,19,37,41,54,27,45],wheel:[12,54,28,40,42],fragil:61,evid:41,nake:46,pick:[14,61,36,4,38,8,64,65,28],rail:[12,4,37],hand:[59,0,2,19,5,38,8,41,54,64],fairli:45,instructionsperupd:46,new_value_for_field:61,techniqu:[61,19,54],kept:[30,0,19,3,58,41],bewar:59,thu:[64,4,41],hypothet:33,weirder:41,thi:[14,57,58,17,25,40,42,62,12,28],programm:[13,31,19,20,61,41,54],everyth:[30,31,1,18,19,38,6,8,25,54,43,61,12],jool:[16,44],left:[54,4,56,38,62,40,41,42,12,28,64,45],certaintli:19,identifi:[49,33,35,4,58,8],just:[0,44,6,59,12,13,15,18,20,21,25,28,30,31,33,38,22,41,54,43,45,49,61,5,57,60,64],parachutedrogu:61,newton:[18,35],via:[46,61,31,4],farther:0,human:[46,54],onepart:[61,5],yet:[49,50,41],languag:20,partsingroup:[61,17,37],expos:[38,31],had:[61,20,19,54],board:34,els:[58,12,62,50],save:[12,32],explanatori:[6,61],applic:10,mayb:15,preserv:[50,41],background:[49,14,28,41,54],srfprograd:[12,1],measur:[59,18,19,41,12,45],specif:[6,17,49,61],arbitrari:[30,5],manual:[14,33,54,40,42,12,28],dockedshipnam:65,"10km":19,remind:30,unstabl:45,channel:22,uppercas:[6,54],crudest:54,underli:[38,64,48,41],oxid:[12,15],right:[5,32,20,40,42,12,57,28],old:[30,24,0,31,54],deal:[0,49,61,4,58,54,45],interv:[31,45,41],velscal:55,percentag:15,intern:[38,20,14,28],flatten:61,bore:37,successfulli:55,transmiss:16,total:[59,33,34,19,41,45],bottom:[48,49,41],track:[61,65,45,37],overcom:45,bareword:58,condit:[34,49,41,15],foo:[30,25,37],peek:[43,58],plu:[38,6,64,48],sensibl:[14,28],compress:46,burn:[33,15,54],wheelsteertrim:[28,40,42],quaternion:64,yoke:[28,40],promot:[19,45],plug:18,rootpart:[61,17,37],slightli:[61,20,17,54],simul:[12,0,41,2],gentler:[28,42],horizon:[64,14,28,54],liftoff:54,obt:[12,1,37],produc:[19,45,33],pilottransl:[28,40],soi:[14,1,36,37,38,43,64,28],xyz:64,"float":[59,22,14,31,64,48,28],down:[54,14,61,35,4,20,17,40,41,42,64,28],intakeair:12,storag:32,often:[6,31,49,41,44],east:[38,24,14,28,54],accordingli:48,wai:[0,42,4,8,12,14,16,18,19,28,31,37,39,40,41,54,43,45,49,61,17,58,20,64],support:[59,39,8,64,31],transform:[20,64],fight:[28,54],avail:[58,47],width:[58,54],reli:[49,19,28,42],pilotyaw:[28,40],sessiontim:12,editor:[0,61,5,58,20,54],fraction:[41,2],overhead:20,constantli:[14,28,19,54],myfilenam:58,head:[14,19,37,21,24,54,12,28,64,45],medium:16,form:[58,20,0,25,19],offer:[28,42],forc:[14,18,19,41,65,28],fore:[4,40,42,64,28,45],heat:61,solar:[0,49,34,25,54,43,12],"true":[1,2,54,4,8,12,15,16,18,21,28,30,31,37,39,40,41,42,43,46,49,51,61,55,57,58,60,62,65],reset:[46,60,65,54],vecdrawarg:[55,21],enablert2integr:46,maximum:[30,14,35,18,19,56,31,37,43,28,45],tell:[49,34,61,44,20,41,54,64,48,45],primarili:[64,14,28],fundament:[],ref_fram:[],featur:[58,20,61,50,16],alongsid:61,classic:45,request:34,drive:[46,58,0,54],exist:[28,17,25,61,50],glanc:36,check:[30,46,31,49,2,15,16,61,4,51,60,33,41,12,65],moduleenvirosensor:51,floor:[35,41],tip:54,yourvari:25,role:54,test:[31,33,5,19,4,55,45],presum:[38,24,37,54],telemetri:45,roll:[14,40,42,64,28,45],runtim:[61,31,41],node:[6,7,61,55],intend:54,notepad:54,keybaord:[28,57],notic:[19,20,41,54,65,45],consid:[46,19,7,8,41,45],"30km":[19,45],faster:[54,28,41,42],bullet:30,anywher:[49,33,19,39,41,54,12],salt:61,"5km":19,ignor:[39,19,5,45],gforc:[19,45],time:[58,12,47],push:[30,18,46,28,42],backward:[30,42,28,36,40],osx:58,concept:[59,60,8,64,54],chain:[6,8,49],skip:[48,61],global:[59,0,2,33,11,22,39,8,28],chair:12,rot:64,row:[30,28,41,42],decid:[31,16,55,7,20,42,64,28],depend:[30,31,61,19,38,6,59,25,41,42,43,12,28,64,45],decic:20,graph:45,hellolanch:54,decim:[12,2],readabl:34,countdown:54,certainli:19,mathemat:6,vec:[6,22,48,64,21],vel:64,verticalspe:[12,37],sourc:[58,61,20,0,3],string:[61,57,58,62,12,28],kilonewton:37,cook:47,cyan:[22,33],exact:[17,64,31,25,41],level:[0,1,18,19,37,44,58,24,61,12,45],did:[30,54],gui:[46,61,31,4],iter:[49,25,9,41,52],magnet:65,item:[30,55,60,8,25,43],quick:[27,17,19,61,41],round:[35,31,8,56],dir:64,prevent:[14,28],slower:[12,41],reengageddist:65,cost:46,roof:64,port:[61,31,4,65],appear:[31,33,61,5,37,21,39,20,54,12,4,10],uniform:30,current:[59,1,2,3,6,7,8,12,13,15,19,24,25,28,30,31,33,34,37,38,40,41,42,43,54,49,61,17,57,58,60,64,65],axial:64,suspect:41,setter:[28,40],deriv:[],longitud:[43,12,1,24],gener:[58,25],satisfi:41,explicitli:[28,12,25,20],modif:[13,61,45],checkflag:39,along:[41,64,45,37,33],toolbar:10,wait:[28,42],invis:22,bop:44,shift:[28,40,42],behav:[0,61,39,41,10,12,45],extrem:19,partstitl:[61,17,37],bod:25,bog:41,novic:[13,19],regardless:[30,6,64,38,37],extra:[20,45],tweak:15,modul:[13,17,61,19,4,37,31,62,45],prefer:[27,30,64,61],fake:[12,33],instal:[58,61,0,16],eccentr:43,voumenumb:47,sake:[38,7],kerbin:[13,35,1,16,18,19,36,37,44,59,54,43,45],live:54,criteria:49,scope:[43,54],capit:[58,2],peopl:[38,61,39,59,28],claus:49,ksm:[58,32],teaser:61,examin:59,easiest:45,fly:[31,49,42,39,54,28],graphic:41,setfield:[61,31],uniqu:[12,65,5,15,4],fli:54,whatev:[30,46,61,5,4,54,43],purpos:[20,45,41,54],problemat:45,nearest:[31,35],predict:47,topic:[58,17],abort:12,termveloc:[45,37],occur:[17,49,33,19,59,41,54,43,64,45],alwai:[0,1,33,2,16,34,39,37,38,6,7,20,41,54,49,64,45],multipl:[61,14,28,41,32],positionat:[55,21],tilt:54,write:[13,0,61,19,55,58,20,14,41,54,28,45],till:33,vital:[49,41,54],anyon:39,pilotwheelthrottletrim:[28,40],pure:[43,61],map:[12,62,33,21],product:[48,64,14,28],max:[31,15,16,35,37,54,43,45],clone:[3,32],spot:[30,24,1],usabl:31,mac:[58,54],cours:[19,61,42,43,28,45],mag:[48,64,19,49,45],mai:[30,46,0,49,41,61,36,19,64,55,37,4,38,20,8,31,54,43,12,65,58],underscor:[58,8],data:[46,13,47,0,34,19,37,20,54,45],practic:54,liquid:[12,45,54],beam:61,eng:[49,15],favorit:[61,3,45],inform:[47,18,55,9,57,58,6,20,8,25,41,48,28],"switch":[12,47],combin:[61,1,34,19,42,62,54,64,28],callabl:65,acceleromet:[19,45],untest:45,talk:[1,41],kerbalscript:38,shield:65,file2:58,hasnextpatch:43,pitch:[14,42,40,54,64,28,45],slingshot:43,still:[46,31,0,16,61,55,58,59,20,8,41,54,64,65],snippet:61,group:[17,49,61,5,37,39,31,54,12],thank:41,partmodul:[17,5,32],passag:12,window:[58,12,54],curli:49,main:[46,31,14,49,44,59,8,41,54,28],avaiabl:61,non:[13,64,19,45,37],halt:[49,41],initi:[46,24,54,43,64,48],underneath:24,aquiretorqu:65,half:[18,22,49,54],now:[30,0,33,16,28,19,5,44,6,31,25,41,42,61,10,4,12,45],discuss:[27,19,52,45,32],term:[1,18,19,44,38,6,7,12,64,45],plung:20,realist:45,didn:[61,19,31,54],controlfrom:[28,4,57],separ:[31,61,19,58,39,8,25,65],compil:47,replac:[30,31,54],individu:12,continu:[14,49,31,41,54,28],year:[59,2],happen:[30,61,49,19,4,7,20,41,12],shown:[46,31,15,61,21,39,54,64,65,45],referenc:58,space:[46,13,0,2,18,61,32,38,20,8,41,54,43,10,58],formula:[18,48,54,16],fraem:38,sensor:[52,12,25],correct:[64,59,36],periapsi:[43,6,12,1,33],lag:[12,59],allsuchpart:5,org:41,"byte":[0,2],card:41,torqu:[65,54],suffici:[28,45,42],frequenc:19,synchron:59,refus:65,motion:[14,28,41],thing:[1,4,5,8,12,31,19,20,21,25,30,17,37,38,41,54,44,45,61,55,56,60,64],plane:[33,37,38,12,48,64],place:[30,46,54,0,17,35,5,37,4,22,59,7,31,62,41,42,61,48,28,58],principl:[41,54],think:[61,7,0,64,54],frequent:41,first:[59,2,3,8,12,14,18,19,20,28,30,17,36,38,41,43,45,46,61,5,60,48],origin:[63,20],eeloo:[16,44],directli:[0,1,41,2,18,54,58,24,14,31,42,43,61,64,28],carri:19,onc:[54,0,49,33,15,18,36,19,24,21,60,31,20,41,42,61,28,45],currenlti:34,yourself:54,"long":[58,16],symmetri:32,oppos:12,open:[58,10,8,20,54],predefin:[14,28],size:[20,0,45,2],given:[30,46,31,61,19,4,37,58,60,17,25,40,54,20,28,64,24],silent:20,workaround:33,stuck:[49,41,15],fuelflow:15,necessarili:[61,7,31,25],zieger:45,averag:45,circl:35,deciph:46,arithmet:[59,8],white:[22,21],friend:20,includ:[6,19,61,45,2],girder:61,thruster:[54,28,42],variable1:49,orbitableveloc:[52,53,1],variable2:49,specifi:[49,61,20,21,58,22,62],forward:[28,40,42],"short":[0,49,19,58,20,61,41,54,45],altitiud:24,computronix:20,pilotrolltrim:[28,40],than:[0,2,42,6,59,12,16,19,21,28,30,31,33,36,39,41,54,46,49,61,5,57,58,20],serv:45,untweak:15,were:[31,15,33,61,39,20],posit:[14,49,55,24,41,28],seri:[58,19],pre:[34,58,22],allev:[61,31],sai:[16,19,20,39,8,41,54,65],separagt:58,ani:[0,2,54,44,6,59,12,14,16,18,19,22,25,28,30,31,33,36,37,38,39,41,42,43,46,49,61,5,58,20],rent:33,exclud:48,calendar:59,engin:[49,52,18,61,6,25,42,28],squar:[30,18,46,35,48],note:[59,0,1,61,4,36,39,14,25,41,48,49,12,57,28],ideal:[58,45,41,15,54],squad:58,take:[0,1,3,44,6,8,12,13,19,25,28,30,35,36,37,40,41,43,46,49,61,55,59,20,64,48],yaxi:21,noth:[49,61,21,41,54,1],radialout:33,begin:[59,33,19,37,60,27,12,45],sure:[13,14,28,15,54],reloc:20,normal:[0,1,33,61,4,39,14,20,31,54,49,12,48,28,64],multipli:[6,64,48,21],nametag_of_part:61,throttlelock:15,pair:[61,24,31,36,65],miscalcul:41,renam:47,later:[6,19,45,41,54],pilotrot:[28,40],wing:[64,28,40,42],pilotrol:[28,40],touchi:54,axi:[13,14,4,37,21,38,40,42,43,64,44,28,45],steadi:[45,41,54],slope:45,show:[46,16,61,21,58,6,20,54,43,64,45],cheat:0,friction:54,permiss:31,threshold:20,corner:12,ground:[28,40,42],onli:[0,1,2,4,44,6,17,14,15,16,18,19,20,24,28,30,31,33,34,36,38,39,40,41,43,45,59,48,49,51,61,5,56,58,60,65],slow:[14,28,45,41],ratio:35,activ:[63,31,49,51,15,34,61,19,54,39,37,58,6,7,17,40,42,12,65,28,45],behind:[20,61,41,32],black:22,analyz:45,conic_patch_limit:37,offici:[18,0],pilotfor:[28,40],nearli:20,variou:12,get:[59,1,2,4,44,17,12,14,15,16,18,19,20,21,24,28,30,31,33,34,36,37,38,41,54,43,46,48,49,51,61,5,56,57,60,62,64,65],mission:0,cannot:[0,60,58,20,41,64,24],portfac:65,geo:24,requir:[0,51,54,58,20,8,41,42,64,28,45],degress:64,through:[61,33,19,37,38,43,41,54,27],where:[14,16,55,32,58,7,41,57,28],summari:[12,31,37],wiki:41,burst:41,station:37,vec1:48,rmb:61,lng:24,wonder:[64,54],infinit:[64,0,41,54],detect:[61,41],label:[61,21],enough:[58,31,17,49,19,0,20,8,41,54,45],minmu:44,between:[54,14,1,51,16,28,19,4,32,38,39,8,62,41,42,61,12,48,11,64],"import":12,across:[59,20,0,17,54],assumpt:[41,55,33],parent:[61,17,4,45,44],vdot:48,screen:[46,61,9,6,25,62,12],preattach:65,comm:16,uncondition:49,come:[46,33,61,6,8,25,43,64,45],mypart:5,reaction:[54,28,42],geocoordiant:24,ballpark:41,myiter:60,tutori:32,mani:[30,31,16,61,19,6,8,12,64,45],trim:[28,40,42],acceler:[34,45],color:[52,9],period:[13,49,58,8,54,43,45],pop:[61,5],unwork:31,doaction:[61,31],pol:44,colon:[6,39,8,35],typic:[13,19,41],undock:[61,31,65],the_mun:44,unmod:61,needlessli:48,ultim:45,wobbli:[14,28],coupl:45,stretch:19,west:[],invert:39,mark:45,addit:[48,61,45],arcsin:35,sea_level_alt:18,wake:41,geoposit:[12,1,24],bonjour:60,those:[0,61,4,37,20,8,41,54,45],pilot:47,sound:13,cast:13,invok:31,partstag:[61,17,5,37],ctrl:[19,28,40,42],metric:37,worri:19,destin:58,awesomedisk:58,mapview:[12,62],ascii:2,kerbal:[46,13,59,2,16,18,61,32,38,20,41,54,43,10,12],develop:[46,63,31,61,19,8,27],harsh:41,author:[31,28,57],same:[0,4,44,8,10,12,31,18,19,21,24,25,28,30,17,36,37,38,22,40,41,54,43,45,59,48,61,5,58,20,64,65],epoch:[12,59],html:3,pad:[58,19,2],document:[58,25],breakdown:6,my_vara:8,finish:[19,49,41,54],closest:[8,16],my_vari:8,capabl:[0,19,45],improv:19,extern:[58,54],droug:61,booster:[15,54],appropri:[28,42],inconsist:43,pitchup30:64,without:[31,49,61,19,20,58,39,59,41,54,45],joystick:28,dimension:[48,45],execut:[46,54,14,49,15,19,55,58,6,7,61,40,41,42,43,28],when:[0,50,16,61,20,5,17,58,6,7,14,25,40,41,42,12,28],rest:[30,8,49,41,54],halfwai:[14,28],aspect:27,vesselsensor:52,speed:[46,54,41,37,44],versu:41,miscellan:13,except:12,littl:[64,61,41,54],vecdraw:[22,21],versa:[10,64,12,51],reentri:61,bcount:49,momentum:[43,37],earli:20,hover:[41,54],xaxi:21,around:[14,1,33,18,44,41,64,28],read:[14,3,32,58,40,12,57,28],monopropel:12,defaul:21,temperatur:34,grid:38,picosecond:41,vacuum:37,world:[6,41,18],mod:[12,41,16],whitespac:8,realtim:12,pole:38,integ:[30,46,31,2,35,37,21,60,59,62],benefit:54,either:[46,17,49,33,61,19,5,21,58,8,25,54,12],yawtrim:[28,40,42],output:[39,49,20,6,60,45],inter:19,manag:0,yyyi:[59,2],ascend:43,constitut:0,freez:[46,41],easili:13,definit:[7,12],legal:8,moon:44,thispart:17,exit:[49,41,54],pilotneutr:[28,40],complic:[13,19],refer:12,power:[19,54],asterisk:48,found:[18,6,54,12,52,45],compiledprogram:47,acc:[34,19,45],comparison:[6,0,16],stone:58,rotationperiod:44,degre:[14,1,37,38,24,54,43,64,28],stand:[6,20],maxthrust:[12,45,37,15,54],"2x3":30,forevector:64,routin:[38,46],effici:[20,45],lastli:45,allowrestart:15,terminolog:61,overpow:45,liquidfuel:[49,15,19,56,54,12,45],your:[14,3,32,58,17,42,12,28],log:47,her:19,area:54,hex:20,maxtwr:45,start:[30,46,59,49,33,15,19,39,21,38,43,60,61,62,41,42,27,12,28,45],starv:15,interfac:[46,61,4,33,32],low:45,lot:[0,19,36,38,20,31,54,64,45],gravit:[34,35,45,44],strictli:[19,28,40],ship_raw:37,pitchabovehorizon:64,bottl:49,monoton:45,tupl:64,bundl:58,oscil:45,modlist:61,kosscript:31,longer:[61,33,19,36,44,41,45],pull:[34,0,65],manuev:43,immedi:[46,0,15,33,19,21,17,41,54,45],dirti:54,possibl:[30,13,0,1,15,2,39,19,5,6,7,61,25,45,41,42,43,49,28,33,24],"default":[58,25,32],vice:64,gibberish:13,expect:[61,1,33,19,5,43,49,12,64],gone:[31,54],uid:4,creat:[30,63,14,49,33,2,36,61,64,24,21,22,59,60,8,41,54,10,48,28,12],scriptabl:[13,0,54],subprogram:58,logintudin:[28,40,42],deep:19,orbit:[14,52,16,18,55,44,6,8,12,48,28],decreas:19,file:47,shut:15,vorb:36,proport:[27,19],rearrang:45,energi:[54,28,42],fill:[56,54],again:[54,31,49,15,19,5,58,61,42,28],antenna:[0,16],velocityat:55,orient:[4,57,39,54,64,28,45],drawvel:55,valid:[43,58,19,49],you:[0,1,2,3,4,5,6,7,8,10,12,14,16,18,19,20,21,22,25,27,28,30,31,33,34,36,38,39,40,41,42,43,44,45,46,49,61,55,17,57,58,59,60,62,48],gettabl:[12,28,42],symbol:8,nichol:45,dthrott:[19,45],peak:45,prev_vel:49,partcount:4,reduc:19,cpu_vessel:[24,25,55],directori:[46,58,0,45],descript:[0,1,2,4,44,59,12,15,18,21,24,30,31,33,34,35,37,41,43,46,49,51,56,60,64,65],kilogram:[18,44],"10000m":54,mass:[18,35,37,21,6,25,12,44,45],potenti:43,escap:43,cpu:[28,12,25,32],unset:[8,21],all:[0,44,6,7,8,12,14,18,25,28,17,38,39,41,42,49,61,5,57,58,20,48],forget:[19,45,54],illustr:[59,45],lack:[64,54],month:[59,2],zaxi:21,abil:[61,5,37,20,41,54,28],dish:16,follow:[0,1,2,54,55,6,7,8,12,14,16,18,19,21,22,25,27,28,31,33,35,38,39,41,42,43,44,45,46,49,61,5,17,58,59,65],disk:[20,0],children:[61,17,4],showstatist:46,tottarget:4,tail:21,program:[12,47],predictut:55,queri:[28,12,14,25],prograd:[12,1,64,33],norm:48,"case":[50,61,5,58,41,28],ag10:12,far:[31,33,18,55,37,60,41,65,45],utim:33,mechan:19,fall:54,veri:[46,13,0,49,15,16,19,58,59,41,54,45],angleaxi:64,strang:[38,12],compotronix:20,mycolor:22,list:[58,12,28,47,57],adjust:[14,19,21,31,54,48,28],cosin:35,small:[13,0,49,19,5,20,61,41,54,45],dimens:30,primari:17,ten:[49,41],past:45,strung:43,rate:[51,59,45,41,15],pressur:[34,18],design:[31,49,61,5,41,27],pass:[30,46,31,33,58,39,59,41,12],further:[18,12,54,36,21],what:[17,16,55,32,7,20,41,12,10],sub:[6,8],clock:[59,41,2],sun:[1,16,34,44,43,64],section:[31,61,19,5,58,6,0,54,45],abl:[5,58,20,41,12,28],delet:47,version:[0,1,16,3,37,44,58,6,20,59,41,43,49,12],intersect:[43,37],consecut:8,deepli:48,"public":[20,3],discript:58,hasn:[41,33],full:[17,49,51,19,4,56,58,6,7,8,41,54,12,45],themselv:[30,0],vall:44,situat:[7,28,42],sophist:54,wasn:31,modular:45,shouldn:[20,61],burnvector:33,ineffici:54,modifi:[59,31,19,64,2],valu:[59,2,4,6,8,12,11,14,18,19,22,25,28,30,31,33,34,35,37,39,41,42,43,45,46,48,49,51,61,5,56,58,60,64,65],search:[13,61],tweakabl:[61,31,15],prior:6,amount:[49,33,34,19,56,20,8,41,54,12,64],atmo:18,surfacespe:[12,37],action:[12,17,32],magnitud:[33,34,37,42,64,48,28],diamet:[35,16],reignit:45,primit:[46,39],transit:12,listkeyword:25,filenam:47,pythagorean:48,thankfulli:[14,28],select:[14,49,61,4,57,58,62,54,12,28],goetz:3,aggress:45,wheelthrottletrim:[28,40,42],distinct:[59,1,37],two:[54,0,41,2,35,19,4,44,7,14,31,65,48,61,64,21,28,24],twr:45,taken:[31,34,61,59,41,43,45],minor:[43,12],more:[28,17,25,57,32],reachabl:0,flat:[59,54],desir:19,hundr:54,stutter:[12,59,20,54],flag:12,stick:[41,16],particular:[17,45],known:[14,28,19,41],dictat:[14,28],none:[30,12,41],hour:[59,36,2],remain:[46,49,58,41,54,43],paragraph:39,caveat:39,learn:[61,3,54],deg:[1,35,37,24,43,64,48],explod:54,"67384e":35,bogu:41,clearscreen:[8,62,54],atend:60,share:[28,1,40,37],accept:[0,41],sphere:[12,1,37],minimum:[43,61,31,35],explor:32,phrase:64,magenta:22,modulesnam:[17,37],goal:[14,19,41,54,28,45],divid:46,rather:[30,46,0,2,18,54,38,39,61,41,42,12,28,58],anoth:[30,0,49,41,54,58,48,8,31,42,43,12,65,28,64],divis:[6,35],simpl:[13,0,38,59,54,27,45],unabl:58,somechut:61,variant:25,vesselnam:[12,37],okai:[61,39,31],deployaltitud:61,associ:[31,4,45,54],stabil:45,chute:[12,61],github:3,wobbl:[54,14,28,65,42],unityengin:64,ambigu:35,caus:[61,49,51,33,54,4,37,62,41,42,12,65,28,45],atan2:35,dread:19,rotat:[55,14,65,36,37,44,38,40,42,64,4,28,45],soon:[46,49,45,41,54],radar:[12,24],circumfer:35,vec2:48,angularmomentum:[12,37],pilotwheelsteertrim:[28,40],longitudeofascendingnod:43,starfac:64,paramet:[50,55,58,6,8,25,42,62,28],style:[27,61,14,28,19],nifti:54,inward:61,pend:41,bypass:[31,5],clamor:54,might:[30,13,0,1,61,60,31,25,41,43,12,64,45],alter:[0,49,55,39,43,64],termainl:54,lookout:61,wouldn:61,good:[19,41,2,54],"return":[59,1,2,4,55,6,12,15,16,18,24,25,28,30,31,33,34,35,36,37,38,40,41,42,43,48,49,51,61,5,56,60,64,65],timestamp:[55,41],lookdirup:64,ssss:2,skipper:30,detach:65,complain:19,bigger:[20,55,16],nivekk:63,instruct:[46,20,8,41],conic:43,achiev:[1,45,41],reactiv:15,radian:[43,37],radial:33,reslist:56,leftov:59,dir2:64,dir1:64,interleav:41,unequ:8,hard:[0,19,21,38,20,14,41,44,28],idea:[17,0,41],realli:[0,33,61,20,54,12],connect:[61,31],prev_alt:41,hasact:31,beyond:[33,54],todo:61,event:32,screenshot:[61,55],research:54,fanci:[19,41,54],rotatefromto:64,print:[2,54,4,6,8,12,13,15,16,18,20,24,25,28,30,17,33,35,39,41,42,46,49,51,61,56,58,60,62,64,48],allact:[61,31],qualifi:64,advanc:[41,54],duna:[43,13,16,44],remotetech2:[46,16],reason:[13,14,33,2,19,58,20,61,41,54,28],base:[0,19,61,35,37,14,54,28,45],put:[0,33,19,20,58,39,61,25,41,45],teach:61,basi:[43,64],vectorexclud:48,launch:[0,45,5,19,54],veloc:[14,1,33,36,55,37,44,38,6,8,41,54,43,49,12,48,28,64,45],omit:[30,41],solidli:65,computeri:20,perhap:45,lookat:64,wheelsteer:[12,28,40,42],undergo:34,assign:[61,4,21],major:[43,58,12,41],perturb:1,feel:[61,31,5],misc:52,number:[0,16,61,58,20,14,41,12,28],placehold:18,done:[31,61,37,21,40,41,54,64,28,45],construct:[6,64,19,33,21],blank:[37,33,54],stabl:41,miss:[58,8],tovec:64,differ:[0,49,18,19,57,7,59,25,41,54,43,61,12,65,28,64,45],jet:18,script:[14,32,58,20,40,41,42,12,28],interact:46,smoother:20,least:[49,2,19,37,41,54,64],partlist:61,statement:[61,8,49,41],natur:[12,19,41,35],master:54,scheme:[61,5],headi:20,imperfect:6,option:[30,46,31,49,61,21,58,12,57,28],part:[28,12,25,47,57],consult:12,varaible2:49,exposur:34,kind:[59,51,61,20,58,39,41,65],outnumberd:31,whenev:[30,13,49,19,39,38,7,54,43,64],remot:58,remov:[30,49,33,34,19,55,5,6,8],horizont:[45,37,54],stall:46,store:[46,0,49,2,34,20,60,59,25,41,45],str:58,arrang:[61,22,31],toward:[64,14,28,4,54],comput:[59,0,49,20,60,14,41,54,12,28],aquireforc:65,atmospher:[66,52],exert:19,beforehand:5,biggest:16,imagin:[38,19,41],built:[7,20,10,50],equival:[17,39,25,40,42,28],pilotwheelthrottl:[28,40],idenifi:39,also:[0,42,44,6,59,14,15,19,21,24,28,30,31,37,38,39,41,54,45,46,49,61,57,58,64,48],build:[17,3,31,21],prev_tim:49,brace:49,hellolaunch:54,previou:[0,49,19,41,54,45],reach:[43,12,0,19,45],mixtur:6,react:41,most:[0,16,61,38,6,40,41,54,48,28],plai:[59,61,58,0,41,54,12],plan:[43,20,55,33,16],alpha:22,model:[37,54],charg:[51,56,54],filesystem:58,clear:[30,61,8,62],cover:[61,45],clean:45,visibl:[61,31,33,21],rtg:[8,54],phenomenon:12,sublist:[30,6],font:[58,54],fine:[64,19,49,45,54],find:[20,32,28,16],gilli:44,rocket:[27,64,19,45,54],partsnam:[17,8,61,37],loglin:45,factor:[18,45],hit:[19,61,54,43,12,45],unus:31,express:[14,50,55,58,62,41,28],nativ:[38,13,64],mediumdishantenna:16,rt2:46,myvari:15,indec:61,restart:54,coord:[64,21],soonest:33,common:28,wrote:54,set:[14,49,50,28,20,62,55,17,5,58,6,7,8,25,40,41,42,61,12,57,11],dump:[30,61,51,45],printout:54,touch:65,see:[0,1,4,6,7,12,18,21,25,27,28,30,31,33,35,41,42,43,45,49,61,5,57,58,20,48],bare:58,sea:[1,18,37,44,24,12,45],arg:58,reserv:[12,8,44],someth:[46,17,61,5,7,31,20,41,12,45],won:[31,16,34,54,5,59,42,64,28],experi:[64,61,5,54],altern:[30,39,28,42],popup:54,numer:[30,60],"40km":19,gamedata:[0,54],disallow:31,lowercas:[58,54],plugindata:[58,0],distinguish:7,purpl:[22,33],inertia:37,struct:64,verbos:[30,46,61],both:[59,1,15,34,61,19,36,21,38,7,8,20,41,43,49,12,48,64,45],cryptic:0,last:[31,49,2,19,60,61,41,54,12,45],alon:37,context:[61,31,16],tangent:35,anarrow:21,whole:[59,19,35,31,25,54],load:[46,59,4,37,20,41,12],simpli:[13,0,37,33,54],celesti:[52,12,25],point:[59,1,2,4,14,19,21,24,28,30,31,33,37,38,39,54,45,46,61,22,60,64,48],address:[45,54],controlstick:[28,42],shutdown:[8,62,15],linux:58,batteri:54,throughout:[30,8,41],termianl:25,faithfulli:46,vertic:41,java:39,startonarch:46,help:[19,1,3,4,6,61,25,49,45],damp:45,overlook:64,devic:13,due:[46,14,39,41,54,43,28,45],empti:[30,21],semimajoraxi:43,exercis:45,fire:[39,54],imag:[58,10],great:3,coordin:[7,14,28,55],understand:[61,49,19,20,58,39,8,54,12,48],vang:48,proporion:58,ignit:[45,15],look:[30,13,0,49,61,19,59,60,31,62,41,54,43,46,64,45],solid:[37,15,54],straight:[28,14,1,45,54],erron:41,batch:[8,41],durat:41,"while":[30,0,49,58,59,14,40,41,42,64,65,28],csharp:39,abov:[1,44,6,8,12,14,18,19,21,24,25,28,30,31,37,39,41,54,45,46,49,61,22,57,58,64],error:[46,49,33,61,5,20,8,41,48],fun:54,loop:[12,47],real:[46,18,11,41,12,28],angularveloc:12,readi:[65,21],mystic:19,myarrow:22,itself:[30,46,1,36,61,39,4,7,41,54,43,65],mylog:58,obsolet:31,shorten:48,shorter:61,woerz:[63,3],sqrmagnitud:48,grand:54,higher:[35,45,41],maneuv:[7,28,55],optim:[27,45,54],psuedo:46,dockingport:[52,25],moment:[59,14,2,15,34,41,4,38,39,8,20,31,12,22,28],temporari:65,user:[46,14,41,33,18,61,4,17,8,40,31,12,28],robust:45,hello2:54,chang:[14,11,58,20,40,12,28],focal:43,lower:35,task:[13,61,54],older:[30,0,31],entri:61,parenthes:[30,58,8],expens:[19,45],docker:65,pitchtrim:[28,40,42],spend:[8,41],explan:[27,49,54],violat:54,munorb:36,shape:[43,61,45],cut:45,cur:33,scenario:[19,45],restructuredtext:3,aloha:60,rgb:[22,21],firstpart:17,theorem:48,input:47,docke:65,app:[46,10],euler:64,bin:[61,54],transpar:[22,54,21],rolltrim:[28,40,42],usecompressedpersist:46,insert:[30,49,33,54],bit:[12,32,28,42,16],characterist:45,semi:[43,54],resolv:35,elaps:[45,41],collect:[30,60,61,49,41],baggag:20,nextnod:33,ipu:[46,41],some:[1,6,8,12,13,15,16,18,19,20,24,25,27,30,31,33,37,38,41,54,43,45,48,61,55,17,58,60,64,65],back:[30,13,0,61,54,58,59,42,28,45],haspar:[61,17,4],understood:51,strucur:59,surpris:45,scale:[18,21],plenti:54,pessen:45,though:[19,57,41,43,64,28,45],per:[46,0,18,19,37,59,14,41,61,28],retri:54,larg:[0,49,58,20,8,64,45],slash:54,allfield:[61,31],flameout:[49,15],machin:[58,32],somevessel:[61,25],semiminoraxi:43,run:[12,47],rum:20,word:[59,61,58,0,14,54,48,28],perpendicular:64,step:[30,31,3,20,41,48],squeez:0,meantim:33,subtract:[38,48,59],shine:54,normvec:64,memori:20,mycurr:60,page:[13,0,49,41,16,35,55,37,5,38,6,8,25,31,54,12,48,58,45],idl:[14,28,54],block:[49,41],cutoff:19,file1:58,univers:12,enbabl:12,within:[46,49,33,16,7,41],drain:51,steven:[63,3],ensur:[28,40,54],institut:[61,41],question:[39,61],fast:[59,17,37,58,14,41,54,12,28],custom:[61,4],adjac:4,atmoeff:45,communotron:16,suit:3,somevari:51,properli:[58,20,28,45,42],repeatedli:21,geocoordi:24,link:61,translat:[28,40,45,42],newer:[30,61],delta:[31,33],continuouscheck:49,orienat:[],line:[49,44,6,20,8,62,41,54,43,64,45],info:58,concaten:6,consist:[14,1,38,8,43,28],latlng:24,caller:39,planet:[13,14,18,37,44,59,64,57,28],similar:[0,1,19,41,45],constant:49,getfield:[61,31],doesn:[14,61,6,39,54,43,64,28],repres:[48,61,24,0],areodynam:54,home:[13,0,54],"1000x":[28,11],"70000m":54,tic:[59,41],titl:[61,17,4,37],nan:46,leftward:[28,42],bracket:30,ag9:12,ag8:12,ag7:12,ag6:12,ag5:12,ag4:12,ag3:[12,49],ag2:12,ag1:[61,12,17,49,39],nice:[41,54],draw:[52,55,9],utterli:[5,41],geocoordin:[52,24,1],fromvec:64,drag:[37,33],amplitud:45,relaunch:54,ago:61,land:[12,54],algorithm:[46,17],enablesafemod:46,futurepo:55,visual:[30,45],depth:61,"40000m":54,hello:[49,20,58,6,60,8,62],code:[58,12,3,55,32],scratch:[0,54],mypartlist:17,ellips:43,ellipt:43,inrang:16,compact:20,secur:31,sensit:[8,37,54],elsewher:58,send:0,nose:64,sens:[0,19,38,41,54,48],airplan:64,sent:0,passiv:[20,61],deactiv:[61,51],whichev:[7,12,33],longantenna:16,readout:[51,54],volum:47,disast:19,implicitli:39,tri:[46,0,19,14,41,43,28],magic:20,modulesingroup:[17,37],button:[31,61,5,57,54,28],inclin:43,geograph:[],fewer:[59,41],"try":[46,58,0,19,41,3,38,20,14,31,54,12,28,64,45],race:0,dealt:45,ddd:59,pleas:[59,19,58,43,27,12],impli:45,smaller:[20,28,41,42],monospac:[58,54],cfg:[43,61,31,4,37],hardcod:[30,2],maintain:[3,54],acual:12,video:61,click:[12,57,28,5,32],append:[30,54],compat:[30,13],index:[30,13,60,45],compar:8,terrainheight:24,access:[62,12,28,57],experiment:[46,58,20,45,37],impuls:15,dissapoint:54,can:[14,16,28,20,5,57,58,7,17,25,40,41,42,62,10,11,12],chose:[61,31],leg:[12,61],krisc:46,let:[46,54,14,49,17,19,4,37,21,38,6,39,31,20,42,61,28],sine:35,sinc:[59,1,16,19,43,12,64,45],partsdub:[6,17,61,5,37],convert:39,convers:[38,18],larger:[43,46,20,16],technolog:0,arcco:[46,48,35],climb:[19,45],maker:38,danger:54,appli:[58,18,64,8,45],approxim:[45,54],senstiv:58,api:[46,51,3,4,37,43],opcod:[20,41],deadband:45,nest:19,thrott:[19,45],from:[12,47],zip:13,commun:32,doubl:51,mydir:64,next:[30,46,0,49,33,61,19,21,59,60,31,41,54,43,12,64,45],few:[35,19,20,61,41,54,45],camera:[7,64,55],simpler:[38,14,28,31,54],remaind:[59,35],sort:[17,2,61,37,44,58,41,54],name2:47,insensit:[61,50],name1:47,actual:[46,0,49,41,33,18,19,36,17,58,6,20,8,31,61,12,45],sph:[61,31,5,17],account:[31,1,55,37,43,64],retriev:5,annot:10,obvious:[61,45],rightclick:[61,31,54],aliv:49,proof:31,tab:[61,8,54],process:[58,20,19,45],high:[49,54],newdir:64,gravioli:[19,45],tag:[17,32],slip:43,tan:35,delai:[6,41,54],surfac:[14,1,18,36,37,44,6,24,20,48,28,45],realiti:64,sit:[12,54],six:[13,59,45],subdirectori:0,aft:4,instead:[46,0,1,33,2,18,61,4,58,59,20,14,25,31,48,49,65,28],sin:[8,35],chri:[63,3],stock:[10,28,16],singular:59,watch:49,act:45,coast:54,physic:[12,32],essenti:[59,61,8,40,42,28],light:[34,12,31,28,57],element:[6,60,25,49],issu:[0,49,14,41,54,28],allow:[0,42,4,6,59,13,16,19,20,21,28,30,31,37,40,41,54,46,49,61,5,58,60],mainfram:0,creation:[],compass:[14,37,24,54,64,28],meter:[0,1,33,16,18,20,41],drawpo:55,comma:[58,39,8],actaulli:54,chosen:[31,5],therefor:[13,0,33,15,18,60,37,36,51,7,31,41,64,65,45],crash:54,greater:49,handl:[54,61,19,5,57,39,41,42,28],auto:21,spell:[12,22],dai:[59,20,8,2,44],mention:[58,6,20],bar:30,advantg:[14,28],somewher:0,anyth:[49,33,61,20,6,39,41,54,12],edit:47,slide:31,vectordotproduct:48,mode:46,mycheck:49,circular:54,upward:[38,64,17,28,42],subset:30,myprogram:58,bump:65,consum:[45,41],fluctuat:45,our:45,patch:[43,37,1,55,33],special:[0,50,58,14,41,12,28],out:[0,42,4,6,59,13,16,19,28,30,31,33,37,38,39,40,41,54,49,61,20,64,65],matrix:30,reload:54,influenc:[12,1,64,37],oribt:36,reboot:[8,62],categori:16,vcr:[48,64,14,28],disappear:[54,21],vectorangl:48,hardwar:[12,20,32],ref:43,math:6,statist:46,title_of_part:61,insid:[46,0,49,61,19,5,4,60,8,20,41,54,43],manipul:[0,33,61,55,31,42,64,28],releas:[49,33,54,6,42,65,28],afterward:61,throttle_log:45,indent:[20,8],could:[19,49,15,18,3,17,60,8,41,54,61,64,45],ask:[34,61,54,16],pilotpitch:[28,40],keep:[17,1,19,38,61,41,54,49,48,45],length:[30,61,4,44,8,41,64],navbal:[12,54],retain:0,timezon:2,south:[14,28],behid:0,softwar:[0,61,39,41,54,45],doevent:[61,31],overshoot:45,scene:[20,61,41,32],arctan2:35,ziegler:45,date:2,ancient:20,unknown:2,perfectli:19,capac:[0,56],messag:[46,19],attach:[13,31,33,61,57,5,4,17,41,65,28],any_of_the_abov:61,"final":[43,19],prone:45,gear:12,fuzzi:16,slider:31,thrustlimit:15,exactli:[13,59,49,33,5,61,55,37,44,38,39,25,41,43,12],haven:[54,8,65],"20km":19,structur:[50,61,55,25,40,42,12,28],charact:[8,58,0,59],zx1:20,becom:[31,0,49,19,60,8,41,54,43,64,65,45],bind:39,sec:33,unman:54,start_tim:45,my_var:[8,44],deprec:32,peform:59,have:[0,2,55,7,8,12,14,18,20,25,28,30,17,39,41,42,44,46,49,61,5,57,58,60,48],close:[38,18],need:[30,58,54,59,33,18,19,39,22,7,61,25,20,41,42,43,12,48,28,64,45],turn:[31,49,51,15,61,57,39,59,41,42,28,45],gentli:[28,42],recharg:54,volnum:58,min:[43,31,45,41,35],mix:30,programfil:47,which:[0,4,7,8,12,13,14,15,18,19,20,24,25,28,30,31,37,38,39,41,54,43,45,46,49,51,61,5,56,58,59,60,64,65],scren:21,sealevelpressur:18,detector:[19,45],graviti:[34,45,54],singl:[0,1,51,61,56,39,41,12,64,45],powerconsumpt:51,unless:[49,0,28],orbital_inclin:43,who:[30,1,61,39,41,54],discov:[41,37],somenameher:61,stupidli:54,visa:[10,12,51],deploi:[61,8],arcan:20,segment:64,"class":8,gather:61,upset:45,filelist:[25,2],face:[4,37,40,42,12,65,28,64,45],inde:45,snapshot:34,determin:19,occasion:41,constrain:[46,31],keypress:12,fact:[46,64,0,41,54],text:47,filetyp:2,purposefulli:45,crate:25,sssssz:2,varnam:48,locat:[58,0,1,4,38,24,62,54],launchpad:[46,5,45],modulecommand:61,forev:[43,49],should:[39,46,14,49,33,2,19,55,37,21,24,61,41,54,12,28,64,45],suppos:[64,19],ksc:13,intrigu:20,fuel:[49,15,54,56,41,42,12,28,45],local:[46,13,49,2,16,58,39,8,54,64],hope:38,meant:[31,16,19,6,20,41],count:[30,59,49,60,0,54],move:[30,1,33,54,37,38,60,40,41,42,28],familiar:[39,59,54],accel:49,bear:[24,37],autom:[13,64,54],joint:41,increas:[19,45],portion:8,enabl:[46,31,51,15,34,61,4,12,65,64],upper:[12,54],grav:[34,19,45],integr:46,contain:[30,54,0,2,61,36,19,5,4,58,6,7,8,25,40,41,42,12,28,64,45],grab:33,hei:54,view:[31,33,21,20,62,12],withstand:61,frame:[14,28,55,41],terrain:[12,24],stack:[46,54],incommrang:16,modulu:35,statu:[10,12,54],hasfield:31,correctli:[46,54],pattern:[27,49],tend:54,written:[13,19,3,39,61,41,54],crude:54,progress:54,neither:[7,49],kei:[42,57,40,54,12,28],foreshadow:19,acceller:[34,49],entir:[0,41,61,19,4,20,8,31,54,12],thumb:38,instant:36,plugin:[46,58,0],career:54,equal:[30,8,49,33,54],etc:[64,41,56],instanc:[12,5],grain:61,equat:38,comment:[31,34,20,8,41,54],unimpl:2,anti:33,unclear:[43,65],ucp:46,wall:49,arriv:33,walk:[27,61,17,4,54],johann:3,respect:[61,0,45,31],axisvector:64,quit:[0,18,19,20,14,41,54,28],aquirerang:65,addition:45,yaw:[14,40,42,64,28,45],anomali:43,compon:[48,6,22,59],besid:[0,28,57],treat:12,electr:[51,56],muddi:61,popul:[4,21],starvector:64,upcom:33,vectorcrossproduct:48,deliber:31,togeth:[0,61,58,6,8,43],present:[43,18,8],multi:19,tpart:4,align:38,autopilot:[13,7,45,54],harder:0,cursor:62,defin:[31,1,61,6,22,17],runwai:46,observ:45,commrang:[12,16],layer:19,langaug:46,almost:[18,19,49,31,16],"5th":2,archiv:[58,20,32,41,16],fiddl:32,scienc:41,vsrf:36,uniti:[58,64],isp:15,began:59,cross:[48,64,14,28,45],sqrt:35,speaker:13,orbitat:55,constel:43,difficult:20,http:41,cubic:18,upon:[28,40],effect:[30,0,18,37,21,8,41,12,48,64,45],logfil:45,expand:38,off:[14,50,61,57,20,8,41,10,28,12],center:[1,55,21,38,7,54,44],dock:[31,61,4,7,54,65],stopprog:55,colour:[22,21],well:[30,0,49,51,61,19,44,6,60,14,41,54,64,28,45],senselist:51,thought:41,exampl:[55,32,58,25,41,42,10,57,28],command:12,choos:[31,28,42],undefin:58,starboard:[64,28,40,45,42],spacebar:54,latest:3,distanc:[24,65,1,16],paus:[59,49,41,54],deltav:33,less:[46,17,2,5,59,0,41,64,45],trueanomali:43,obtain:[30,2,18,35,4,36,60,42,43,28,45,24],settabl:[12,61,28,40,42],simultan:49,airspe:[12,37],retrosurf:48,rapid:45,monoprop:56,lastphi:41,onward:54,sky:[13,54],add:[30,1,33,61,55,5,60,8,25,45],wheelthrottl:[12,28,40,42],densiti:18,lookup:64,warrant:[31,17],match:[58,14,49,61,4,37,21,38,41,12,28],knob:33,piec:[6,54],volumenumb:47,five:19,know:[0,61,3,20,41,54,64],mynod:33,redesign:41,mycraft:6,recurs:17,loss:48,numstag:49,like:[14,16,5,57,58,20,25,41,42,12,28,10],lost:[58,54],header:58,name_of_part:61,necessari:[61,54,19,31,21],srfrerograd:12,lose:20,decis:46,drop:[45,54],commdish:16,revert:[0,54],arctang:35,postion:30,certain:[49,41],smoothli:12,proper:[34,38,1,54],guarante:[64,61,41],fileinfo:[59,52,2],moho:[16,44],leaf:4,lead:46,avoid:[49,45,54],vxcl:48,leav:[12,28,20,54],settl:45,speak:[28,40],throttl:[54,14,49,15,19,57,40,41,42,27,12,28,45],slight:45,acronym:54,usag:[],textedit:54,verboseexcept:46,although:20,offset:[55,45],after:[59,0,1,33,2,61,19,5,58,60,31,40,54,43,49,65,28,45],stage:[49,19,4,8,27,12,45],inclind:38,interven:41,column:[30,62,45],autolaunch:58,fals:[2,4,6,8,12,15,16,19,21,28,31,37,39,40,42,43,46,49,61,55,57,60,62],disabl:65,own:[30,46,0,17,19,5,37,6,8,14,31,54,12,28,64,45],absolut:[19,35,61,37,24,41,64],halting_problem:41,automat:[13,14,28,55],weather:37,fancier:54,stabal:[12,54],pitfal:59,mere:19,merg:13,val:37,pictur:[5,21],vab:[61,31,5,17,54],transfer:19,remotetech:[13,16],trigger:32,"var":30,log10:35,maneuvernod:[52,33],"function":[61,17,55,50],north:[14,1,38,12,28,64],aircraft:45,brand:12,mlfile:20,nametag:[61,17,5,37],argumentofperiapsi:43,neutral:[28,40,42],gain:[19,45],inlin:65,bug:[34,43,54],suppli:49,made:[46,63,0,15,33,61,3,8,54,64],temp:34,whether:[46,31,33,16,36,37,59,62,43,12],wish:[54,28,42],smooth:[41,54],displai:[10,61],troubl:48,record:41,below:[31,1,2,15,16,18,61,39,58,24,8,25,41,54,64,65,45],limit:[13,31,15,19,0,8,54,58,45],indefinit:49,kerbomachinelanguag:2,otherwis:[31,61,60,25,41,28],problem:[46,19,41,54,64,45],reliabl:64,evalu:[58,6,39,49,45],dure:[31,49,61,5,58,7,41,65],pid:[27,19,41],meaningless:38,layth:44,euphem:[20,33],implement:[17,16,6,39,41,28,45],probabl:[61,0,4,54],tick:32,srfretrograd:1,detail:[46,14,49,35,5,58,6,17,41,42,12,28],virtual:58,arctan:35,asaparagu:54,other:[0,1,2,4,55,6,7,8,10,12,13,14,19,24,25,28,30,31,37,38,39,41,54,59,48,61,5,17,57,58,20,64,65],bool:[18,31],futur:[0,1,33,16,55,37,38,6,31,54,43],rememb:[59,1,19,61,40,64,28],varieti:54,deadli:61,nonblank:37,pilotmainthrottl:[28,40],stat:46,"1km":[19,45],fulli:[51,41,37],calul:12,hasev:31,singleton:39,stai:[46,61,57,54,28,45],experienc:[34,59,65,45,54],sphinx:3,myvec:64,myvel:6,inset:45,lift:54,partli:54},objtypes:{"0":"ks:attribute","1":"ks:structure","2":"ks:function","3":"ks:global","4":"ks:method"},objnames:{"0":["ks","attribute","KerboScript attribure"],"1":["ks","structure","KerboScript structure"],"2":["ks","function","KerboScript function"],"3":["ks","global","KerboScript global"],"4":["ks","method","KerboScript method"]},filenames:["general/volumes","structures/orbits/orbitable","structures/misc/fileinfo","contribute","structures/vessels/part","general/nametag","language/features","general/cpu_vessel","language/syntax","structures/misc","general/applauncher_panel","commands/flight/warp","bindings","index","commands/flight/cooked","structures/vessels/engine","general/comm_range","commands/parts","structures/celestial_bodies/atmosphere","tutorials/designpatterns","general/compiling","structures/misc/vecdraw","structures/misc/rgba","structures/vessels","math/geocoordinates","commands/list","structures/maneuvering","tutorials","commands/flight","math","structures/misc/list","structures/vessels/partmodule","general","structures/vessels/node","structures/vessels/vesselsensors","math/basic","structures/orbits/orbitablevelocity","structures/vessels/vessel","math/ref_frame","language/variables","commands/flight/pilot","general/cpu_hardware","commands/flight/raw","structures/orbits/orbit","structures/celestial_bodies/body","tutorials/pidloops","structures/misc/config","commands","math/vector","language/flow","language","structures/vessels/sensor","structures","structures/orbits","tutorials/quickstart","commands/prediction","structures/vessels/resource","commands/flight/systems","commands/files","structures/misc/time","structures/misc/iterator","general/parts_and_partmodules","commands/terminal","about","math/direction","structures/vessels/dockingport","structures/celestial_bodies"],titles:["Files and Volumes","Orbitable (Vessels and Bodies)","File Information","Contribute","Part","The Name Tag System","General Features of the KerboScript Language","CPU Vessel (SHIP)","KerboScript Syntax Specification","Configurations and Miscellany","kOS Control Panel","Time Warping","Catalog of Bound Variable Names","Welcome to the kOS Documentation Website!","Cooked Control","Engine","Communication Range For Remote Updates","Querying a vessel’s parts","Atmosphere","Design Patterns and Considerations with kOS","KerboScript Machine Code","Drawing Vectors on the Screen","Colors","Vessels and Parts","Geographic Coordinates","LIST Command","Orbits and Maneuver Nodes","Tutorials","Flight Control","Mathematics and Basic Geometry","List","PartModule","General Topics","Maneuver Node","VesselSensors","Fundamental Constants","OrbitableVelocity","Vessel","Reference Frames","Variables & Statements","Pilot Input","The kOS CPU hardware","Raw Control","Orbit","Body","PID Loops in kOS","Configuration of kOS","Command Reference","Vectors","Flow Control","The KerboScript Language","Sensor","Structure Reference","Orbits","Quick Start Tutorial","Predictions of Flight Path","Resource","Ship Systems","File I/O","Time Span","Iterator","Ship Parts and PartModules","Terminal and game environment","About kOS and KerboScript","Directions","DockingPort","Celestial Bodies"],objects:{"":{ENGINE:[15,1,1,""],"CONFIG:STAT":[46,0,1,""],ATMOSPHERE:[18,1,1,""],"PART:NAME":[4,0,1,""],"SENSOR:TOGGLE":[51,4,1,""],BRAKES:[57,3,1,""],"ORBITABLE:NAME":[1,0,1,""],"PARTMODULE:SETFIELD":[31,4,1,""],"ORBITABLE:LONGITUDE":[1,0,1,""],V:[48,2,1,""],"ATMOSPHERE:SCALE":[18,0,1,""],"LIST:LENGTH":[30,0,1,""],"PARTMODULE:ALLFIELDS":[31,0,1,""],"ORBIT:APOAPSIS":[43,0,1,""],PART:[4,1,1,""],"FILEINFO:NAME":[2,0,1,""],"GEOCOORDINATES:LAT":[24,0,1,""],"PARTMODULE:ALLEVENTS":[31,0,1,""],HEADING:[64,2,1,""],"DIRECTION:PITCH":[64,0,1,""],TAN:[35,2,1,""],DIRECTION:[64,1,1,""],VECDRAW:[21,2,1,""],"ORBITABLE:POSITION":[1,0,1,""],"PARTMODULE:DOEVENT":[31,4,1,""],"ORBITABLE:NORTH":[1,0,1,""],MIN:[35,2,1,""],"ITERATOR:ATEND":[60,0,1,""],"VESSEL:LOADED":[37,0,1,""],"ORBITABLEVELOCITY:ORBIT":[36,0,1,""],"VECDRAW:LABEL":[21,0,1,""],SAS:[57,3,1,""],"ORBIT:PERIOD":[43,0,1,""],"ORBIT:LAN":[43,0,1,""],"TIMESPAN:SECONDS":[59,0,1,""],MANEUVERNODE:[33,1,1,""],"GEOCOORDINATES:DISTANCE":[24,0,1,""],BLUE:[22,3,1,""],RGBA:[22,2,1,""],"RESOURCE:NAME":[56,0,1,""],FLOOR:[35,2,1,""],"LIST:SUBLIST":[30,4,1,""],"ORBIT:VELOCITY":[43,0,1,""],"PART:MODULES":[4,0,1,""],VECTORCROSSPRODUCT:[48,2,1,""],ORBIT:[43,1,1,""],"FILEINFO:MODIFIED":[2,0,1,""],"ATMOSPHERE:BODY":[18,0,1,""],"VECDRAW:VEC":[21,0,1,""],"ORBIT:BODY":[43,0,1,""],"TIMESPAN:HOUR":[59,0,1,""],"ENGINE:ISP":[15,0,1,""],"PARTMODULE:HASACTION":[31,4,1,""],"ATMOSPHERE:HEIGHT":[18,0,1,""],"PART:HASPARENT":[4,0,1,""],"VESSEL:VERTICALSPEED":[37,0,1,""],"VESSELSENSORS:PRES":[34,0,1,""],"CONFIG:SAFE":[46,0,1,""],MAX:[35,2,1,""],"VESSEL:MAXTHRUST":[37,0,1,""],"GEOCOORDINATES:TERRAINHEIGHT":[24,0,1,""],"ORBITABLE:VELOCITY":[1,0,1,""],VXCL:[48,2,1,""],"VECDRAW:START":[21,0,1,""],PARTMODULE:[31,1,1,""],"DOCKINGPORT:STATE":[65,0,1,""],"LIST:CLEAR":[30,0,1,""],"VECTOR:Z":[48,0,1,""],GEOCOORDINATES:[24,1,1,""],"VECTOR:X":[48,0,1,""],"PART:ROTATION":[4,0,1,""],"PARTMODULE:ALLACTIONS":[31,0,1,""],"PARTMODULE:PART":[31,0,1,""],"PART:CONTROLFROM":[4,0,1,""],"VESSEL:PARTSDUBBED":[37,4,1,""],"BODY:MU":[44,0,1,""],"LIST:CONTAINS":[30,4,1,""],"VESSEL:AIRSPEED":[37,0,1,""],"PARTMODULE:HASFIELD":[31,4,1,""],"PART:STAGE":[4,0,1,""],"PARTMODULE:GETFIELD":[31,4,1,""],"VESSEL:TERMVELOCITY":[37,0,1,""],RGB:[22,2,1,""],"PART:FACING":[4,0,1,""],"SENSOR:TYPE":[51,0,1,""],"VECTOR:DIRECTION":[48,0,1,""],"VESSEL:VESSELNAME":[37,0,1,""],"ITERATOR:RESET":[60,4,1,""],ROUND:[35,2,1,""],"PART:UID":[4,0,1,""],"CONFIG:VERBOSE":[46,0,1,""],"DOCKINGPORT:PORTFACING":[65,0,1,""],"MANEUVERNODE:PROGRADE":[33,0,1,""],"TIMESPAN:CALENDAR":[59,0,1,""],"PART:GETMODULE":[4,4,1,""],NEXTNODE:[33,3,1,""],"BODY:DESCRIPTION":[44,0,1,""],"PARTMODULE:NAME":[31,0,1,""],SIN:[35,2,1,""],"PART:RESOURCES":[4,0,1,""],"VECTOR:Y":[48,0,1,""],"CONFIG:IPU":[46,0,1,""],"PART:SHIP":[4,0,1,""],"ITERATOR:NEXT":[60,4,1,""],"ORBITABLE:OBT":[1,0,1,""],PI:[35,3,1,""],SENSOR:[51,1,1,""],"ORBIT:NAME":[43,0,1,""],"ENGINE:FLAMEOUT":[15,0,1,""],"ORBITABLE:PERIAPSIS":[1,0,1,""],"VECTOR:VEC":[48,0,1,""],DOCKINGPORT:[65,1,1,""],G:[35,3,1,""],VECTOREXCLUDE:[48,2,1,""],"VESSEL:ANGULARVEL":[37,0,1,""],VESSELSENSORS:[34,1,1,""],ARCTAN2:[35,2,1,""],"DOCKINGPORT:AQUIREFORCE":[65,0,1,""],"ORBITABLE:GEOPOSITION":[1,0,1,""],"VESSEL:MODULESINGROUP":[37,4,1,""],VANG:[48,2,1,""],VESSEL:[37,1,1,""],"DIRECTION:FOREVECTOR":[64,0,1,""],"LIST:DUMP":[30,0,1,""],ANGLEAXIS:[64,2,1,""],"VESSEL:PARTSNAMED":[37,4,1,""],"VESSEL:PARTSINGROUP":[37,4,1,""],"ATMOSPHERE:OXYGEN":[18,0,1,""],ORBITABLEVELOCITY:[36,1,1,""],"ORBITABLE:PATCHES":[1,0,1,""],"VECTOR:SQRMAGNITUDE":[48,0,1,""],"PART:CHILDREN":[4,0,1,""],"PARTMODULE:DOACTION":[31,4,1,""],CLEARSCREEN:[62,3,1,""],"VECDRAW:COLOR":[21,0,1,""],"SENSOR:ACTIVE":[51,0,1,""],"VESSEL:PATCHES":[37,0,1,""],"ORBIT:ARGUMENTOFPERIAPSIS":[43,0,1,""],REMOVE:[33,3,1,""],ARCTAN:[35,2,1,""],LIGHTS:[57,3,1,""],"BODY:ATM":[44,0,1,""],"VESSEL:SENSORS":[37,0,1,""],"ORBITABLE:DISTANCE":[1,0,1,""],"ORBITABLE:ALTITUDE":[1,0,1,""],TIME:[59,3,1,""],"LIST:ADD":[30,4,1,""],CONFIG:[46,1,1,""],"BODY:ROTATIONPERIOD":[44,0,1,""],MOD:[35,2,1,""],COS:[35,2,1,""],"TIMESPAN:CLOCK":[59,0,1,""],"FILEINFO:CREATED":[2,0,1,""],"TIMESPAN:YEAR":[59,0,1,""],"ATMOSPHERE:EXISTS":[18,0,1,""],"VESSEL:MODULESNAMED":[37,4,1,""],"ORBIT:SEMIMAJORAXIS":[43,0,1,""],"ORBITABLE:RETROGRADE":[1,0,1,""],"BODY:ALTITUDE":[44,0,1,""],"FILEINFO:SIZE":[2,0,1,""],"DIRECTION:TOPVECTOR":[64,0,1,""],"ORBITABLE:BODY":[1,0,1,""],ORBITAT:[55,2,1,""],CYAN:[22,3,1,""],FILEINFO:[2,1,1,""],ADD:[33,3,1,""],LOG10:[35,2,1,""],"GEOCOORDINATES:LNG":[24,0,1,""],RED:[22,3,1,""],"DOCKINGPORT:AQUIRETORQUE":[65,0,1,""],"PART:TAG":[4,0,1,""],"CONFIG:RT2":[46,0,1,""],"VESSEL:FACING":[37,0,1,""],"DOCKINGPORT:AQUIRERANGE":[65,0,1,""],"MANEUVERNODE:NORMAL":[33,0,1,""],"ORBITABLE:APOAPSIS":[1,0,1,""],"ENGINE:IGNITION":[15,0,1,""],"ORBIT:TRUEANOMALY":[43,0,1,""],"ORBITABLE:UP":[1,0,1,""],"LIST:EMPTY":[30,0,1,""],"VESSEL:PARTSTAGGED":[37,4,1,""],"CONFIG:UCP":[46,0,1,""],"ORBIT:PATCHES":[43,0,1,""],"GEOCOORDINATES:HEADING":[24,0,1,""],"TIMESPAN:SECOND":[59,0,1,""],"ENGINE:MAXTHRUST":[15,0,1,""],VECTORANGLE:[48,2,1,""],MAPVIEW:[62,3,1,""],"ENGINE:THRUST":[15,0,1,""],"BODY:NAME":[44,0,1,""],"BODY:ANGULARVEL":[44,0,1,""],"MANEUVERNODE:BURNVECTOR":[33,0,1,""],"VESSEL:ROOTPART":[37,0,1,""],"THE :GLOBAL:`WARP` GLOBAL VARIABLE CAN BE SET TO CHANGE THE GAME WARP TO A VALUE BETWEEN 0 AND 7::":[11,3,1,""],"RESOURCE:CAPACITY":[56,0,1,""],"ORBIT:PERIAPSIS":[43,0,1,""],"DOCKINGPORT:REENGAGEDDISTANCE":[65,0,1,""],VDOT:[48,2,1,""],ARCSIN:[35,2,1,""],ORBITABLE:[1,1,1,""],"ORBITABLE:SRFPROGRADE":[1,0,1,""],"VECTOR:MAG":[48,0,1,""],"DIRECTION:STARVECTOR":[64,0,1,""],VECTORDOTPRODUCT:[48,2,1,""],YELLOW:[22,3,1,""],"LIST:ITERATOR":[30,0,1,""],"VESSEL:MASS":[37,0,1,""],"TIMESPAN:MINUTE":[59,0,1,""],"ATMOSPHERE:SEALEVELPRESSURE":[18,0,1,""],"VESSELSENSORS:ACC":[34,0,1,""],"LIST:COPY":[30,0,1,""],"VESSEL:SURFACESPEED":[37,0,1,""],"PART:ALLMODULES":[4,0,1,""],"PART:POSITION":[4,0,1,""],TARGET:[57,3,1,""],"LIST:INSERT":[30,4,1,""],"PART:TITLE":[4,0,1,""],LATLNG:[24,2,1,""],LIST:[30,1,1,""],"LIST:REMOVE":[30,4,1,""],VELOCITYAT:[55,2,1,""],"GEOCOORDINATES:BEARING":[24,0,1,""],VECTOR:[48,1,1,""],"VESSEL:HEADING":[37,0,1,""],"VESSELSENSORS:LIGHT":[34,0,1,""],ARCCOS:[35,2,1,""],"DIRECTION:ROLL":[64,0,1,""],BLACK:[22,3,1,""],POSITIONAT:[55,2,1,""],"ORBIT:MEANANOMALYATEPOCH":[43,0,1,""],"BODY:MASS":[44,0,1,""],"ORBIT:TRANSITION":[43,0,1,""],BODY:[44,1,1,""],"ORBITABLE:DIRECTION":[1,0,1,""],"ENGINE:ACTIVATE":[15,4,1,""],"RESOURCE:AMOUNT":[56,0,1,""],"CONFIG:ARCH":[46,0,1,""],"VESSEL:CONTROL":[37,0,1,""],TIMESPAN:[59,1,1,""],"ENGINE:ALLOWRESTART":[15,0,1,""],"VESSEL:ANGULARMOMENTUM":[37,0,1,""],RCS:[57,3,1,""],"VESSEL:ALLPARTSTAGGED":[37,4,1,""],PRINT:[62,3,1,""],"TIMESPAN:DAY":[59,0,1,""],GREEN:[22,3,1,""],"ORBITABLE:PROGRADE":[1,0,1,""],SHUTDOWN:[62,3,1,""],"ORBITABLE:LATITUDE":[1,0,1,""],"ENGINE:SHUTDOWN":[15,4,1,""],R:[64,2,1,""],"ORBITABLE:SRFRETROGRADE":[1,0,1,""],"PART:PARENT":[4,0,1,""],"DIRECTION:VECTOR":[64,0,1,""],"DOCKINGPORT:UNDOCK":[65,4,1,""],CONTROL:[40,1,1,""],RESOURCE:[56,1,1,""],"ORBIT:POSITION":[43,0,1,""],"PART:TARGETABLE":[4,0,1,""],PURPLE:[22,3,1,""],"ORBIT:SEMIMINORAXIS":[43,0,1,""],"BODY:RADIUS":[44,0,1,""],"ORBIT:LONGITUDEOFASCENDINGNODE":[43,0,1,""],"ORBIT:ECCENTRICITY":[43,0,1,""],"VESSEL:BEARING":[37,0,1,""],"ENGINE:THROTTLELOCK":[15,0,1,""],"MANEUVERNODE:ETA":[33,0,1,""],"ITERATOR:VALUE":[60,0,1,""],ROTATEFROMTO:[64,2,1,""],"ENGINE:THRUSTLIMIT":[15,0,1,""],"PARTMODULE:HASEVENT":[31,4,1,""],"ENGINE:ALLOWSHUTDOWN":[15,0,1,""],"VESSEL:PARTS":[37,0,1,""],"ORBIT:NEXTPATCH":[43,0,1,""],NODE:[33,2,1,""],"ORBIT:INCLINATION":[43,0,1,""],LN:[35,2,1,""],E:[35,3,1,""],"DOCKINGPORT:TARGETABLE":[65,0,1,""],"FILEINFO:FILETYPE":[2,0,1,""],"MANEUVERNODE:RADIALOUT":[33,0,1,""],ITERATOR:[60,1,1,""],WARP:[11,3,1,""],"DOCKINGPORT:DOCKEDSHIPNAME":[65,0,1,""],Q:[64,2,1,""],"VECDRAW:SHOW":[21,0,1,""],"VESSEL:PARTSTITLED":[37,4,1,""],ABS:[35,2,1,""],AT:[62,2,1,""],"MANEUVERNODE:DELTAV":[33,0,1,""],WHITE:[22,3,1,""],"VESSELSENSORS:TEMP":[34,0,1,""],"SENSOR:READOUT":[51,0,1,""],CEILING:[35,2,1,""],"ENGINE:FUELFLOW":[15,0,1,""],VCRS:[48,2,1,""],"VECDRAW:SCALE":[21,0,1,""],"MANEUVERNODE:ORBIT":[33,0,1,""],"ORBIT:HASNEXTPATCH":[43,0,1,""],"VECDRAW:COLOUR":[21,0,1,""],"ITERATOR:INDEX":[60,0,1,""],"ORBITABLEVELOCITY:SURFACE":[36,0,1,""],LOOKDIRUP:[64,2,1,""],REBOOT:[62,3,1,""],SQRT:[35,2,1,""],"VECTOR:NORMALIZED":[48,0,1,""],"DIRECTION:YAW":[64,0,1,""],VECDRAWARGS:[21,2,1,""],"VESSELSENSORS:GRAV":[34,0,1,""],MAGENTA:[22,3,1,""],"SENSOR:POWERCONSUMPTION":[51,0,1,""]}},titleterms:{oper:[64,48,49],all:[46,19],code:20,consider:19,"boolean":[12,49],text:58,rang:16,syntax:8,bring:19,settabl:46,file:[58,20,0,25,2],vesselsensor:34,alt:12,find:61,dynam:61,paramet:39,access:[30,61],onli:54,now:54,dockingport:65,advantag:[14,28,42],partmodul:[61,31],menu:61,fix:41,configur:[46,9],solut:41,except:58,shortcut:[12,61],better:[41,54],kspevent:[61,31],program:[58,19,54],queri:17,ksm:20,input:[28,40],introduct:13,transit:43,real:[2,54],environ:62,contribut:3,variou:61,read:20,timestamp:2,express:6,scene:0,"break":49,game:[12,62,54],trigonometr:35,volum:[58,0],kerboscript:[13,63,50,6,20,8],"new":54,cook:[14,28],world:[2,54],bit:20,tick:[59,41],"switch":58,mod:61,span:59,somewher:54,name:[0,61,5,20,8,43,12],specif:8,filenam:58,edit:[58,3],list:[30,61,25],geograph:24,iter:60,maneuv:[26,33],remot:16,stuff:61,mode:54,pilot:[28,40],quick:54,updat:[59,41,16],where:[5,54],why:[20,41],mean:61,compil:[58,20],encount:12,set:39,kspaction:[61,31],frame:38,creation:[24,48,64,33],resourc:[12,56],direct:64,touch:45,unlock:[49,14,28,42],member:[30,46,31,2,15,34,36,4,21,60,33,43,48],design:19,disadvantag:[14,28,42],happen:54,event:61,special:[59,8],integr:45,variabl:[59,12,8,39],what:[61,8,54],insensit:6,give:5,preserv:49,pattern:19,someth:54,abl:61,calcul:16,yet:8,content:[19,24,8,54,43,64,48,45],delet:58,state:12,vector:[64,48,21],languag:[6,50],hardwar:41,"import":58,modulemanag:61,sensor:51,method:[48,6,64,8],math:18,refer:[38,52,47,28,42],machin:20,run:58,deriv:45,screen:21,usag:24,volumenumb:58,like:[61,54],bodi:[12,66,1,41,44],step:54,compiledprogram:58,path:55,launchpad:54,lock:[12,49,39],listabl:25,convert:38,actual:54,commun:16,put:54,simul:59,exampl:[24,5,54],turn:54,eta:12,perman:54,logic:54,geometri:29,chang:[61,41],bai:54,block:19,first:54,origin:38,orbitableveloc:36,major:19,suffix:[43,8],celesti:[66,44],vehicl:54,color:22,intermedi:27,arrai:30,number:6,system:[61,5,57,25,12,28],deprec:[43,16],smaller:61,"long":41,symmetri:5,vessel:[0,1,23,37,7,17,25,54,12],instal:13,storag:0,predefin:44,bound:12,avail:25,doe:[8,41],from:58,log:58,convent:20,script:[61,0,19,54],make:54,interact:54,univers:[25,41],add:54,been:59,downsid:20,websit:13,start:54,trigger:[19,41],physic:[59,41],statement:39,basic:29,termin:[62,54],wait:[49,41],type:12,"final":45,store:54,more:[20,41,54],"function":[8,35],field:[12,61],flight:[12,28,55,42],behind:0,copi:58,great:54,warp:[28,11],idea:54,warn:61,coordin:24,part:[23,61,17,5,4],name2:58,togeth:19,atmospher:18,name1:58,programfil:58,orienat:38,renam:58,must:12,"case":6,care:20,save:[5,54],keyword:25,frozen:41,alia:12,eleg:41,tree:61,second:54,structur:[30,33,6,24,43,64,48,52],until:49,project:3,matter:41,invok:54,tag:5,toggl:[12,39],behavior:61,fundament:35,posit:38,about:63,loop:[19,25,45,41],control:[54,14,49,19,42,10,28,12],feedback:45,featur:6,constant:35,have:59,individu:30,timespan:59,predict:55,can:[61,54],orbit:[43,26,53,1],pid:45,argument:58,indic:13,repres:59,topic:32,raw:[38,28,42],"default":20,archiv:0,right:61,explor:61,tabl:13,fiddl:20,exist:8,proport:45,ship:[7,61,28,12,57],string:6,assembl:54,multipl:0,steer:54,want:41,minim:19,check:19,sequenti:19,when:[59,19,49],off:39,click:61,note:31,how:[54,3,20,16],tutori:[27,61,54],stage:54,mathemat:[35,29],kspfield:[61,31],instead:54,you:54,document:[13,3],config:12,stock:61,gettabl:46,even:41,draw:21,gener:[6,8,19,32],node:[26,33],see:54,clone:5,panel:10,multidimension:30,action:61,catalog:12,detect:59,okai:54,engin:15,introductori:27,tune:45,welcom:13,your:20,voumenumb:58,don:54,els:49,miscellani:9,condit:19,flow:49,spent:19,rule:[58,8],element:30,thought:45,inform:2,sandbox:54,declar:39,command:[47,25,54],thi:[3,41,54],time:[59,28,19,11,41],built:8,cpu:[7,41],guidelin:19,hello:54,usual:58}}) \ No newline at end of file diff --git a/structures.html b/structures.html deleted file mode 100644 index dcac00874..000000000 --- a/structures.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - Structure Reference — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - -
      - -
      -
      -

      Previous topic

      -

      Terminal and game environment

      -

      Next topic

      -

      Orbits

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/celestial_bodies.html b/structures/celestial_bodies.html deleted file mode 100644 index e5b19a94f..000000000 --- a/structures/celestial_bodies.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - Celestial Bodies — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Celestial Bodies

      -
      - -
      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      OrbitableVelocity

      -

      Next topic

      -

      Atmosphere

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/celestial_bodies/atmosphere.html b/structures/celestial_bodies/atmosphere.html deleted file mode 100644 index cdde7efc2..000000000 --- a/structures/celestial_bodies/atmosphere.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - Atmosphere — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Atmosphere

      -

      A Structure closely tied to Body A variable of type Atmosphere usually is obtained by the :ATM suffix of a Body. ALL The following values are read-only. You can’t change the value of a body’s atmosphere.

      -
      -
      -structure Atmosphere
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      BODYstringName of the celestial body
      EXISTSboolTrue if this body has an atmosphere
      OXYGENboolTrue if oxygen is present
      SCALEscalarUsed to find atmospheric density
      SEALEVELPRESSUREscalar (atm)pressure at sea level
      HEIGHTscalar (m)advertised atmospheric height
      -
      - -
      -
      -Atmosphere:BODY
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      The Body that this atmosphere is around - as a STRING NAME, not a Body object.

      -
      - -
      -
      -Atmosphere:EXISTS
      -
      --- - - - - - -
      Type:bool
      Access:Get only
      -

      True if this atmosphere is “real” and not just a dummy placeholder.

      -
      - -
      -
      -Atmosphere:OXYGEN
      -
      --- - - - - - -
      Type:bool
      Access:Get only
      -

      True if the air has oxygen and could therefore be used by a jet engine’s intake.

      -
      - -
      -
      -Atmosphere:SCALE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      A math constant plugged into a formula to find atmosphere density (see below).

      -
      - -
      -
      -Atmosphere:SEALEVELPRESSURE
      -
      --- - - - - - -
      Type:scalar (atm)
      Access:Get only
      -

      Number of Atm’s at planet’s sea level 1.0 Atm’s = same as Kerbin.

      -
      - -
      -
      -Atmosphere:HEIGHT
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      The altitude at which the atmosphere is “officially” advertised as ending. (actual ending value differs, see below).

      -
      - -
      -

      Atmospheric Math

      -

      The atmospheric effects of a planet’s air need to be calculated using some formulas. First off, be aware that atmosphere can be measured three different ways:

      -
      -
      Atm
      -
      A multiple of the pressure at Kerbin sea level. An atmosphere of 0.5 is half as much air pressure as at Kerbin’s sea level. This is the measure used by :SEALEVELPRESSURE
      -
      pressure
      -
      A measure of the force the air pushes on a surface with. In SI units, it’s Newtons per Square Meter. This value is almost never used directly in any calculation. Instead you just calculate everything in terms of multiples of Atm’s.
      -
      density
      -
      A measure of how much mass of air there is in a volume of space. In SI units, it’s Kilograms per Cubic Meter.
      -
      -
      -

      Note

      -

      The following only applies to the STOCK KSP atmosphere.

      -

      If you have installed a mod such as FAR, that changes the atmosphere, then much of what is said below will not apply.

      -
      -

      The level of atmosphere can be calculated for any altitude as follows:

      -
        -
      • Number of Atm’s = (Atm’s at sea level) * ( e ^ ( - -sea_level_alt / scale ) )
      • -
      -

      The TRUE maximum height of the atmosphere is NOT the value returned by :HEIGHT, but rather it’s the altitude at which the number of Atm’s returned by the above formula is 0.000001. :HEIGHT is just the value as advertised by the game to the user. On some worlds it can be quite a ways off.

      -

      And once you have that number, then density can be calculated from it with this conversion factor:

      -
        -
      • air density = Number of Atm’s * 1.2230948554874.
      • -
      -

      Further information about the math formulas that Kerbal Space Program uses to calculate the atmosphere can be found here.

      -

      Examples:

      -
      IF SHIP:ORBIT:BODY:ATM:EXISTS {
      -    SET thisAtmo TO SHIP:ORBIT:BODY:ATM.
      -    PRINT "The planet you are orbiting has an atmosphere.".
      -    PRINT "It's scale is " + thisAtmo:SCALE.
      -    PRINT "It's height is " + thisAtmo:HEIGHT.
      -    SET atmos TO thisAtmo:SEALEVELPRESSURE + ( CONSTANT():E ^ ( - SHIP:ALTITUDE / thisAtmo:SCALE ) ).
      -    PRINT "At this altitude the atmosphere is " + atmos + " Atm's.".
      -} ELSE {
      -    PRINT "The planet you are orbiting has no atmosphere.".
      -}.
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Celestial Bodies

      -

      Next topic

      -

      Body

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/celestial_bodies/body.html b/structures/celestial_bodies/body.html deleted file mode 100644 index 6e12b183e..000000000 --- a/structures/celestial_bodies/body.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - Body — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Body

      -

      This is any sort of planet or moon. To get a variable referring to a Body, you can do this:

      -
      // "name" is the name of the body,
      -// like "Mun" for example.
      -SET MY_VAR TO BODY("name").
      -
      -
      -

      Also, all bodies have hard-coded variable names as well. You can use the variable Mun to mean the same thing as BODY("Mun").

      -
      -

      Note

      -
      -

      Changed in version 0.13: A Celestial Body is now also an Orbitable, and can use all the terms described for these objects too.

      -
      -
      -
      -

      Predefined Celestial Bodies

      -

      All of the main celestial bodies in the game are reserved variable names. The following two lines do the exactly the same thing:

      -
      SET the_mun TO Mun.
      -SET the_mun TO Body("Mun").
      -
      -
      -
        -
      • Sun

        -
      • -
      • Moho

        -
      • -
      • -
        Eve
        -
          -
        • Gilly
        • -
        -
        -
        -
      • -
      • -
        Kerbin
        -
          -
        • Mun
        • -
        • Minmus
        • -
        -
        -
        -
      • -
      • -
        Duna
        -
          -
        • Ike
        • -
        -
        -
        -
      • -
      • -
        Jool
        -
          -
        • Laythe
        • -
        • Vall
        • -
        • Tylo
        • -
        • Bop
        • -
        • Pol
        • -
        -
        -
        -
      • -
      • Eeloo

        -
      • -
      -
      -
      -structure Body
      -
      ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType (units)
      Every Suffix of Orbitable
      NAMEstring
      DESCRIPTIONstring
      MASSscalar (kg)
      ALTITUDEscalar (m)
      ROTATIONPERIODscalar (s)
      RADIUSscalar (m)
      MUscalar (\(m^3 s^{−2}\))
      ATMAtmosphere
      ANGULARVELDirection in SHIP-RAW
      -
      - -
      -
      -Body:NAME
      -

      The name of the body. Example: “Mun”.

      -
      - -
      -
      -Body:DESCRIPTION
      -

      Longer description of the body, often just a duplicate of the name.

      -
      - -
      -
      -Body:MASS
      -

      The mass of the body in kilograms.

      -
      - -
      -
      -Body:ALTITUDE
      -

      The altitude of this body above the sea level surface of its parent body. I.e. the altitude of Mun above Kerbin.

      -
      - -
      -
      -Body:ROTATIONPERIOD
      -

      The length of the body’s day in seconds. I.e. how long it takes for it to make one rotation.

      -
      - -
      -
      -Body:RADIUS
      -

      The radius from the body’s center to its sea level.

      -
      - -
      -
      -Body:MU
      -

      The Gravitational Parameter of the body.

      -
      - -
      -
      -Body:ATM
      -

      A variable that describes the atmosphere of this body.

      -
      - -
      -
      -Body:ANGULARVEL
      -

      Despite the name, this is technically not a velocity. It only tells you the axis of rotation, not the speed of rotation around that axis.

      -
      - -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Atmosphere

      -

      Next topic

      -

      Vessels and Parts

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/maneuvering.html b/structures/maneuvering.html deleted file mode 100644 index d1e991576..000000000 --- a/structures/maneuvering.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - Orbits and Maneuver Nodes — kOS 0.15.3 documentation - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Orbits and Maneuver Nodes

      -
      -
        -
      -
      -
      - - -
      -
      -
      -
      -
      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc.html b/structures/misc.html deleted file mode 100644 index f280730b4..000000000 --- a/structures/misc.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - Configurations and Miscellany — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - - - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      VesselSensors

      -

      Next topic

      -

      Configuration of kOS

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/config.html b/structures/misc/config.html deleted file mode 100644 index 52db1c58e..000000000 --- a/structures/misc/config.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - Configuration of kOS — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Configuration of kOS

      -
      -
      -structure Config
      -

      Config is a special structure that allows your kerboscript programs to set or get the values stored in the kOS plugin’s config file.

      -

      The options here can also be set by using the user interface panel shown here. This control panel is part of the App Control Panel

      -

      In either case, whether the setting is changed via the GUI panel, or via script code, these are settings that affect the kOS mod in all saved games as soon as the change is made. It’s identical to editing the config file in the kOS installation directory, and in fact will actually change that file the next time the game saves its state.

      - - ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members (all Gettable and Settable)
      SuffixTypeDefaultDescription
      IPUinteger Instructions per update
      UCPbooleanFalseUse compressed persistence
      STATbooleanFalsePrint statistics to screen
      RT2booleanFalseEnable RemoteTech2 integration
      ARCHbooleanFalseStart on archive (instead of volume 1)
      SAFEbooleanFalseEnable safe mode
      VERBOSEbooleanFalseEnable verbose exceptions
      -
      - -
      -
      -Config:IPU
      -
      --- - - - - - -
      Access:Get/Set
      Type:integer. range = [50,2000]
      -

      Configures the InstructionsPerUpdate setting.

      -

      This is the number of kRISC psuedo-machine-langauge instructions that each kOS CPU will attempt to execute from the main program per physics update tick.

      -

      This value is constrained to stay within the range [50..2000]. If you set it to a value outside that range, it will reset itself to remain in that range.

      -
      - -
      -
      -Config:UCP
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the UseCompressedPersistence setting.

      -

      If true, then the contents of the kOS local volume ‘files’ stored inside the campaign save’s persistence file will be stored using a compression algorithm that has the advantage of making them take less space, but at the cost of making the data impossible to decipher with the naked human eye when looking at the persistence file.

      -
      - -
      -
      -Config:STAT
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the ShowStatistics setting.

      -

      If true, then executing a program will log numbers to the screen showing execution speed statistics.

      -
      - -
      -
      -Config:RT2
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the EnableRT2Integration setting.

      -

      If true, then the kOS mod will attempt to interact with the Remote Tech 2 mod, letting RT2 make decisions about whether or not a vessel is within communications range rather than having kOS use its own more primitive algorithm for it.

      -

      Due to a long stall in the development of the RT2 mod, this setting should still be considered experimental at this point.

      -
      - -
      -
      -Config:ARCH
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the StartOnArchive setting.

      -

      If true, then when a vessel is first loaded onto the launchpad or runway, the initial default volume will be set to volume 0, the archive, instead of volume 1, the local drive.

      -
      - -
      -
      -Config:SAFE
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the EnableSafeMode setting.

      -

      If true, then it enables the following error messages:

      -
      Tried to push NaN into the stack.
      -Tried to push Infinity into the stack.
      -
      -
      -

      They will be triggered any time any mathematical operation would result in something that is not a real number, such as dividing by zero, or trying to take the square root of a negative number, or the arccos of a number larger than 1. Performing such an operation will immediately terminate the program with one of the error messages shown above.

      -

      If false, then these operations are permitted, but the result may lead to code that does not function correctly if you are not careful about how you use it. Using a value that is not a real number may result in freezing Kerbal Space Program itself if that value is used in a variable that is passed into Kerbal Space Program’s API routines. KSP’s own API interface does not seem to have any protective checks in place and will faithfully try to use whatever values its given.

      -
      - -
      -
      -Config:VERBOSE
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Configures the VerboseExceptions setting.

      -

      If true, then it enables a mode in which errors coming from kOS are very long and verbose, trying to explain every detail of the problem.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Configurations and Miscellany

      -

      Next topic

      -

      File Information

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/fileinfo.html b/structures/misc/fileinfo.html deleted file mode 100644 index 841a5b502..000000000 --- a/structures/misc/fileinfo.html +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - File Information — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      File Information

      -

      File name and size information. You can obtain a list of values of type FileInfo using the LIST FILES command.

      -
      -
      -structure FileInfo
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      NAMEstringName of the file including extension
      FILETYPEstringType of the file
      SIZEinteger (bytes)Size of the file
      MODIFIEDstringThe date the file was last modified
      CREATEDstringThe date the file was first created
      -
      - -
      -
      -FileInfo:NAME
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      name of the file, including its file extension.

      -
      - -
      -
      -FileInfo:FILETYPE
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      Type of the file as a string. Can be one of the following:

      -
      -
      ASCII
      -
      A file containing ASCII text, like the result of a LOG command.
      -
      KERBOSCRIPT
      -
      (unimplemented) A type of ASCII file containing Kerboscript ascii code. At the moment this type does not ever get returned. You will always get files of type ASCII instead.
      -
      KSM
      -
      A type of file containing KerboMachineLanguage compiled code, that was created from the COMPILE command.
      -
      UNKNOWN
      -
      Any other type of file.
      -
      -
      - -
      -
      -FileInfo:SIZE
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      size of the file, in bytes.

      -
      - -
      -
      -FileInfo:MODIFIED
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      The date the file was last modified, in Real World Timestamp format, described below.

      -
      - -
      -
      -FileInfo:CREATED
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      The date the file was first created, in Real World Timestamp format, described below.

      -
      - -
      -

      Real World Timestamp

      -

      These timestamps are NOT in Kerbal Space Program’s simulated clock, but are in real world time. This is for a good reason: the files exist outside of any one saved game and are global to all saved games you have. The format of the real-world timestamps is as follows:

      -
      YYYY-MM-DDThh:mm:ss.sssssZ
      -
      -
      -

      Where:

      -
      -
      YYYY
      -
      The Four-digit year.
      -
      MM
      -
      The Two-digit month, padded with zeroes (i.e. September is ‘09’ rather than ‘9’.)
      -
      DD
      -
      The Two-digit day of month, padded with zeroes (i.e. the 5th of the month is ‘05’ rather than ‘5’.)
      -
      T
      -
      Always a hardcoded capital letter “T”.
      -
      hh
      -
      The 24-hour clock time (5 AM is 05, 5 PM is 18).
      -
      mm
      -
      The Two-digit minute-hand, padded with zeroes.
      -
      ss.ssss
      -
      The seconds-hand, padded with zeroes to at least 2 digits before the decimal point, and a varying number of digits after that. It can store fractional parts of the second.
      -
      Z
      -
      Always a hardcoded capital letter “Z”, meaning its the local timezone-less timestamp.
      -
      -

      This string format should be possible to sort on directly. This example checks if a file exists on the current volume:

      -
      DECLARE PARAMETER searchFile.
      -LIST FILES IN fileList.
      -SET exists to FALSE.
      -
      -FOR file IN fileList {
      -    IF file:NAME = searchFile {
      -        set exists to TRUE.
      -    }
      -}
      -
      -IF exists {
      -    PRINT searchFile + " exists".
      -} ELSE {
      -    PRINT searchFile + " does not exist".
      -}
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Configuration of kOS

      -

      Next topic

      -

      Iterator

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/iterator.html b/structures/misc/iterator.html deleted file mode 100644 index 68009fa71..000000000 --- a/structures/misc/iterator.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - Iterator — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Iterator

      -

      An iterator can be obtained from List:ITERATOR. Once a List has given you an Iterator object, you can use it to access elements inside the List. An ITERATOR is a generic computer programming concept. In the general case it’s a variable type that allows you to get the value at a position in some collection, as well as increment to the next item in the collection in order to operate on all objects in the collection one at a time. In kOS it operates on Lists.

      -

      A loop using an Iterator on a List might look like this:

      -
      // Starting with a list that was built like this
      -SET MyList To LIST().
      -MyList:ADD( "Hello" ).
      -MyList:ADD( "Aloha" ).
      -MyList:ADD( "Bonjour" ).
      -
      -// It could be looped over like this
      -SET MyCurrent TO MyList:ITERATOR.
      -MyCurrent:RESET().
      -PRINT "After reset, position = " + MyCurrent:INDEX.
      -UNTIL NOT MyCurrent:NEXT {
      -    PRINT "Item at position " + MyIter:INDEX + " is [" + MyIter:VALUE + "].".
      -}
      -
      -
      -

      Which would result in this output:

      -
      After reset, position = -1.
      -Item at position 0 is [Hello].
      -Item at position 1 is [Aloha].
      -Item at position 2 is [Bonjour].
      -
      -
      -
      -
      -structure Iterator
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      RESET Rewind to the just before the beginning
      NEXTbooleanMove iterator to the next item
      ATENDbooleanCheck if iterator is at the end of the list
      INDEXintegerCurrent index starting from zero
      VALUEvariesThe object currently being pointed to
      -
      - -
      -
      -Iterator:RESET()
      -

      Call this to rewind the iterator to just before the beginning of the list. After a call to Iterator:RESET, the iterator must be moved with Iterator:NEXT before it gets to the first value in the list.

      -
      - -
      -
      -Iterator:NEXT()
      -
      --- - - - -
      Returns:boolean
      -

      Call this to move the iterator to the next item in the list. Returns true if there is such an item, or false if no such item exists because it’s already at the end of the list.

      -
      - -
      -
      -Iterator:ATEND
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Returns true if the iterator is at the end of the list and therefore cannot be “NEXTed”, false otherwise.

      -
      - -
      -
      -Iterator:INDEX
      -
      --- - - - - - -
      Access:Get only
      Type:integer
      -

      Returns the numerical index of how far you are into the list, starting the counting at 0 for the first item in the list. The last item in the list is numbered N-1, where N is the number of items in the list.

      -
      -

      Note

      -

      If you have just used Iterator:RESET or have just created the ITERATOR, then the value of Iterator:INDEX is -1. It only becomes 0 after the first call to Iterator:NEXT.

      -
      -
      - -
      -
      -Iterator:VALUE
      -
      --- - - - - - -
      Access:Get only
      Type:varies
      -

      Returns the thing stored at the current position in the list.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      File Information

      -

      Next topic

      -

      List

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/list.html b/structures/misc/list.html deleted file mode 100644 index d4d1285b1..000000000 --- a/structures/misc/list.html +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - - - List — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      List

      -

      A List is a collection of any type in kOS. Many places throughout the system return variables of the List type, and you can create your own List variables as well. One of the places you are likely to find that kOS gives you a List is when you use the LIST command to list some query into one of your variables.

      -
      -

      Structure

      -
      -
      -structure List
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      ADD(item)Noneappend an item
      INSERT(index,item)Noneinsert item at index
      REMOVE(index)Noneremove item by index
      CLEARNoneremove all elements
      LENGTHintegernumber of elements in list
      ITERATORIteratorfor iterating over the list
      COPYLista new copy of this list
      CONTAINS(item)booleancheck if list contains an item
      SUBLIST(index,length)Listnew list of given length starting with index
      EMPTYbooleancheck if list if empty
      DUMPstringverbose dump of all contained elements
      -
      - -
      -
      -List:ADD(item)
      -
      --- - - - -
      Parameters:
        -
      • item – (any type) item to be added
      • -
      -
      -

      Appends the new value given to the end of the list.

      -
      - -
      -
      -List:INSERT(index,item)
      -
      --- - - - -
      Parameters:
        -
      • index – (integer) position in list (starting from zero)
      • -
      • item – (any type) item to be added
      • -
      -
      -

      Inserts a new value at the position given, pushing all the other values in the list (if any) one spot to the right.

      -
      - -
      -
      -List:REMOVE(index)
      -
      --- - - - -
      Parameters:
        -
      • index – (integer) position in list (starting from zero)
      • -
      -
      -

      Remove the item from the list at the numeric index given, with counting starting at the first item being item zero

      -
      - -
      -
      -List:CLEAR
      -

      Use this for its side-effect. Whenever myList:CLEAR exists in an expression, myList will be zeroed out, regardless of what you do with the value of the expression:

      -
      SET dummy TO myList:CLEAR.
      -
      -
      -
      - -
      -
      -List:LENGTH
      -
      --- - - - - - -
      Type:integer
      Access:Get only
      -

      Returns the number of elements in the list.

      -
      - -
      -
      -List:ITERATOR
      -
      --- - - - - - -
      Type:Iterator
      Access:Get only
      -

      An alternate means of iterating over a list. See: Iterator.

      -
      - -
      -
      -List:COPY
      -
      --- - - - - - -
      Type:List
      Access:Get only
      -

      Returns a new list that contains the same thing as the old list.

      -
      - -
      -
      -List:CONTAINS(item)
      -
      --- - - - - - -
      Parameters:
        -
      • index – (integer) starting index (from zero)
      • -
      -
      Returns:

      boolean

      -
      -

      Returns true if the list contains an item equal to the one passed as an argument

      -
      - -
      -
      -List:SUBLIST(index,length)
      -
      --- - - - - - -
      Parameters:
        -
      • index – (integer) starting index (from zero)
      • -
      • length – (integer) resulting length of returned List
      • -
      -
      Returns:

      List

      -
      -

      Returns a new list that contains a subset of this list starting at the given index number, and running for the given length of items.

      -
      - -
      -
      -List:EMPTY
      -
      --- - - - - - -
      Type:boolean
      Access:Get only
      -

      Returns true if the list has zero items in it.

      -
      - -
      -
      -List:DUMP
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      Returns a string containing a verbose dump of the list’s contents.

      -
      - -
      -
      -

      Access to Individual Elements

      -

      All list indexes start counting at zero. (The list elements are numbered from 0 to N-1 rather than from 1 to N.)

      -
      -
      list[expression]
      -
      operator: another syntax to access the element at position ‘expression’. Works for get or set. Any arbitrary complex expression may be used with this syntax, not just a number or variable name. This syntax is preferred over the older “#” syntax, which is kept only for backward compatibility.
      -
      FOR VAR IN LIST { ... }.
      -
      A type of loop in which var iterates over all the items of list from item 0 to item LENGTH-1.
      -
      ITERATOR
      -
      An alternate means of iterating over a list. See Iterator.
      -
      list#x (deprecated)
      -
      operator: access the element at postion x. Works for get or set. X must be a hardcoded number or a variable name. This is here for backward compatibility. The syntax in the next bullet point is preferred over this.
      -
      -

      Examples:

      -
      SET FOO TO LIST().       // Creates a new empty list in FOO variable
      -FOO:ADD(5).              // Adds a new element to the end of the list
      -FOO:ADD( ALTITUDE ).     // Adds current altitude number to the end of the list
      -FOO:ADD(ETA:APOAPSIS).   // Adds current seconds to apoapsis to the end of the list
      -
      -// As a reminder, at this point your list, if you did all the above
      -// steps in order, would look like this now:
      -//
      -//  FOO[0] = 5.
      -//  FOO[1] = 99999. // or whatever your altitude was when you added it.
      -//  FOO[2] = 99. // or whatever your ETA:APOAPSIS was when you added it.
      -
      -PRINT FOO:LENGTH.        // Prints 3
      -PRINT FOO:LENGTH().      // Also prints 3.  LENGTH is a method that, because it takes zero arguments, can omit the parentheses.
      -PRINT FOO#0.             // Prints 5, using deprecated old '#' syntax.
      -PRINT FOO[0].            // Prints 5, using newer preferred '[]' syntax.
      -PRINT FOO[1].            // Prints altitude number.
      -PRINT FOO[2].            // Prints eta:apoapsis number.
      -SET x TO 2. PRINT FOO#x. // Prints the same thing as FOO[2], using deprecated old '#' syntax.
      -SET x TO 2. PRINT FOO[x].// Prints the same thing as FOO[2].
      -SET y to 3. PRINT FOO[ y/3 + 1 ].
      -                         // Prints the same thing as FOO#2, using a mathematical expression as the index.
      -SET FOO#0 to 4.          // Replace the 5 at position 0 with a 4.
      -FOO:INSERT(0,"skipper 1"). // Inserts the string "skipper 1" to the start of the list, pushing the rest of the contents right.
      -FOO:INSERT(2,"skipper 2"). // Inserts the string "skipper 2" at position 2 of the list, pushing the rest of the contents right.
      -
      -// As a reminder, at this point your list, if you did all the above
      -// steps in order, would look like this now:
      -//
      -//  FOO[0] = "skipper 1".
      -//  FOO[1] = 5.
      -//  FOO[2] = "skipper 2".
      -//  FOO[3] = 99999. // or whatever your altitude was when you added it.
      -//  FOO[4] = 99. // or whatever your ETA:APOAPSIS was when you added it.
      -
      -FOO:REMOVE( 1).              // Removes the element at index 1 from the list, moving everything else back one.
      -FOO:REMOVE(FOO:LENGTH - 1).  // Removes whatever element happens to be at the end of the list, at position length-1.
      -
      -// As a reminder, at this point your list, if you did all the above
      -// steps in order, would look like this now:
      -//
      -//  FOO[0] = "skipper 1".
      -//  FOO[1] = "skipper 2".
      -//  FOO[2] = 99999. // or whatever your altitude was when you added it.
      -
      -SET BAR TO FOO:COPY.     // Makes a copy of the FOO list
      -FOO:CLEAR.               // Removes all elements from the FOO list.
      -FOO:CLEAR().             // Also removes all elements from the FOO list.  The parentheses are optional because the method takes zero arguments.
      -FOR var in BAR {         // --.
      -  print var.             //   |-- Print all the contents of FOO.
      -}.                       // --'
      -
      -
      -
      -
      -

      Multidimensional Arrays

      -

      A 2-D array is a List who’s elements are themselves also Lists. A 3-D array is a List of Lists of Lists. Any number of dimensions is possible.

      -
      -
      list[x][y] (or list#x#y)
      -
      Access the element at position x,y of the 2-D array (list of lists). The use of the ‘#’ syntax is deprecated and exists for backward compatibility only. The newer ‘[]’ square-bracket syntax is preferred.
      -
      -
        -
      • The elements of the array need not be uniform (any mix of strings, numbers, structures is allowed).

        -
      • -
      • The dimensions of the array need not be uniform (row 1 might have 3 columns while row 2 has 5 columns):

        -
        SET FOO TO LIST(). // Empty list.
        -FOO:ADD( LIST() ). // Element 0 is now itself a list.
        -FOO[0]:ADD( "A" ). // Element 0,0 is now "A".
        -FOO[0]:ADD( "B" ). // Element 0,1 is now "B".
        -FOO:ADD(LIST()).   // Element 1 is now itself a list.
        -FOO[1]:ADD(10).    // Element 1,0 is now 10.
        -FOO[1]:ADD(20).    // Element 1,1 is now 20.
        -FOO:ADD(LIST()).   // Element 2 is now itself a list.
        -
        -FOO[ FOO:LENGTH -1 ]:ADD(3.14159).
        -    // Element 2,0 is now 3.1519, using a more complex
        -    //     expression to dynamically obtain the current
        -    //     maximum index of '2'.
        -
        -FOO[ FOO:LENGTH -1 ]:ADD(7).
        -    // Element 2,1 is now 7, using a more complex
        -    //     expression to dynamically obtain the current
        -    //     maximum index of '2'.
        -
        -// FOO is now a 2x3 matrix looking like this:
        -//    A         B
        -//    10        20
        -//    3.14159   7
        -
        -// or like this, depending on how you want
        -// to visualize it as a row-first or column-first table:
        -//    A    10     3.14159
        -//    B    20     7
        -
        -PRINT FOO[0][0]. // Prints A.
        -PRINT FOO[0][1]. // Prints B.
        -PRINT FOO[1][0]. // Prints 10.
        -PRINT FOO[1][1]. // Prints 20.
        -PRINT FOO[2][0]. // Prints 3.14159.
        -PRINT FOO[2][1]. // Prints 7.
        -
        -PRINT FOO#2#0.   // Prints 3.14159, using deprecated syntax.
        -
        -
        -
      • -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Iterator

      -

      Next topic

      -

      Colors

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/rgba.html b/structures/misc/rgba.html deleted file mode 100644 index 1d86f8a07..000000000 --- a/structures/misc/rgba.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - Colors — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Colors

      -

      Any place you need to specify a color in the game (at the moment this is -just with VECDRAW.) You do so with a -rgba color structure defined as follows:

      -

      Method 1: Use one of these pre-arranged named colors:

      -
        -
      • -
        -RED
        -
        - -
      • -
      • -
        -GREEN
        -
        - -
      • -
      • -
        -BLUE
        -
        - -
      • -
      • -
        -YELLOW
        -
        - -
      • -
      • -
        -CYAN
        -
        - -
      • -
      • -
        -MAGENTA
        -
        -
        - -
      • -
      • -
        -WHITE
        -
        - -
      • -
      • -
        -BLACK
        -
        - -
      • -
      -
      -
      -RGB(r,g,b)
      -

      This global function creates a color from red green and blue values:

      -
      SET myColor TO RGB(r,g,b).
      -
      -
      -

      where:

      -
      -
      r
      -
      A floating point number from 0.0 to 1.0 for the red component.
      -
      g
      -
      A floating point number from 0.0 to 1.0 for the green component.
      -
      b
      -
      A floating point number from 0.0 to 1.0 for the blue component.
      -
      -
      - -
      -
      -RGBA(r,g,b,a)
      -

      Same as RGB() but with an alpha (transparency) channel:

      -
      SET myColor TO RGBA(r,g,b,a).
      -
      -
      -

      r, g, b are the same as above.

      -
      -
      a
      -
      A floating point number from 0.0 to 1.0 for the alpha component. (1.0 means opaque, 0.0 means invisibly transparent).
      -
      -
      - -

      Examples:

      -
      SET myarrow TO VECDRAW.
      -SET myarrow:VEC to V(10,10,10).
      -SET myarrow:COLOR to YELLOW.
      -SET mycolor TO YELLOW.
      -SET myarrow:COLOR to mycolor.
      -SET myarrow:COLOR to RGB(1.0,1.0,0.0).
      -
      -// COLOUR spelling works too
      -SET myarrow:COLOUR to RGB(1.0,1.0,0.0).
      -
      -// half transparent yellow.
      -SET myarrow:COLOR to RGBA(1.0,1.0,0.0,0.5).
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      List

      -

      Next topic

      -

      Time Span

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/time.html b/structures/misc/time.html deleted file mode 100644 index 9f4a71499..000000000 --- a/structures/misc/time.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - Time Span — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Time Span

      -

      In several places the game uses a TimeSpan format. This is a strucure that gives the time in various formats. It also allows you to peform arithmetic on the time.

      -
      -

      TimeSpan represents SIMULATED time

      -

      When you are examining a TimeSpan you are looking the “in character” simulated time, not the “out of character” real world time. This is very important distinction to remember, as the following points illustrate:

      -
        -
      • A TimeSpan does not count the time that was passing while the game was paused.
      • -
      • If you turn off your computer and don’t play the game for several days, the TimeSpan does not count this time.
      • -
      • If your game lags and stutters such that the simulation is taking 2 seconds of real time to calculate 1 second of game time, then the number of seconds that have passed according to a TimeSpan will be fewer than the number of seconds that have passed in the real world.
      • -
      -

      This allows you to use a TimeSpan such as is returned by the TIME special variable to make correct physics calculations.

      -
      -
      -

      Special variable TIME

      -
      -
      -TIME
      -
      --- - - - - - -
      Access:Get only
      Type:integer
      -

      The special variable TIME is used to get the current time.

      -

      Any time you perform arithmetic on TIME you get a result back that is also a TimeSpan. In other words, TIME is a TimeSpan, but TIME + 100 is also a TimeSpan.

      -

      Note that Kerbals do not have the concept of “months”:

      -
      TIME                // Gets the current universal time
      -TIME:CLOCK          // Universal time in H:M:S format(1:50:26)
      -TIME:CALENDAR       // Year 1, day 134
      -TIME:YEAR           // 1
      -TIME:DAY            // 134
      -TIME:HOUR           // 1
      -TIME:MINUTE         // 50
      -TIME:SECOND         // 26
      -TIME:SECONDS        // Total Seconds since campaign began
      -
      -
      -
      - -
      -

      Using TIME to detect when the physics have been updated ‘one tick’

      -

      kOS programs run however fast your computer’s animation rate will allow, which can flow and change from one moment to the next depending on load. However, the physics of the universe get updated at a fixed rate according to your game settings (the default, as of KSP 0.25, is 25 physics updates per second)

      -

      You can use the TIME special variable to detect whether or not a real physics ‘tic’ has occurred yet, which can be important for scripts that need to take measurements from the simulated universe. If no physics tic has occurred, then TIME will still be exactly the same value.

      -
      -

      Warning

      -

      Please be aware that the kind of calendar TimeSpan‘s use will depend on your KSP settings. The main KSP game supports both Kerbin time and Earth time and changing that setting will affect how TimeSpan works in kOS.

      -

      The difference is whether 1 day = 6 hours or 1 day = 24 hours.

      -
      -
      -

      Warning

      -

      Beware the pitfall of confuising the TimeSpan:SECOND (singular) suffix with the TimeSpan:SECONDS (plural) suffix.

      -

      TimeSpan:SECOND

      -
      -
      This is the number of remainder seconds leftover after all whole-number minutes, hours, days, and years have been subtracted out, and it’s never outside the range [0..60). It’s essentially the ‘seconds hand’ on a clock.
      -

      TimeSpan:SECONDS

      -
      -

      This is the number of seconds total if you want to represent time as just a simple flat number without all the components. It’s the total count of the number of seconds since the beginning of time (Epoch). Because it’s a floating point number, it can store times less than 1 second. Note this is a measure of how much simulated Kerbal time has passed since the game began. People experienced at programming will be familiar with this concept. It’s the Kerbal’s version of “unix time”.

      -

      The epoch (time zero) in the KSP game is the time at which you first started the new campaign. All campaign games begin with the planets in precisely the same position and the clock set to zero years, zero days, zero hours, and so on.

      -
      -
      -
      -

      Warning

      -

      Beware that the times returned from FileInfo for the time a file was modified or created are NOT in this TimeSpan structure but instead are just raw strings. That is because they represent the time the file was affected in the real world and NOT times taken from the KSP simulation clock. That is a necessity because your files in the Archive exist globally across all multiple saved games. Different saved games won’t have synchronized calendars with each other.

      -
      -
      -
      -structure TimeSpan
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      CLOCKstring“HH:MM:SS”
      CALENDARstring“Year YYYY, day DDD”
      SECONDinteger (0-59)Second-hand number
      MINUTEinteger (0-59)Minute-hand number
      HOURinteger (0-5)Hour-hand number
      DAYinteger (1-426)Day-hand number
      YEARintegerYear-hand number
      SECONDSintegerTotal Seconds since Epoch
      -
      - -
      -
      -TimeSpan:CLOCK
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      Time in (HH:MM:SS) format.

      -
      - -
      -
      -TimeSpan:CALENDAR
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      Day in “Year YYYY, day DDD” format. (Kerbals don’t have ‘months’.)

      -
      - -
      -
      -TimeSpan:SECOND
      -
      --- - - - - - -
      Access:Get only
      Type:integer (0-59)
      -

      Second-hand number.

      -
      - -
      -
      -TimeSpan:MINUTE
      -
      --- - - - - - -
      Access:Get only
      Type:integer (0-59)
      -

      Minute-hand number

      -
      - -
      -
      -TimeSpan:HOUR
      -
      --- - - - - - -
      Access:Get only
      Type:integer (0-5) or (0-23)
      -

      Hour-hand number. Kerbin has six hours in its day.

      -
      - -
      -
      -TimeSpan:DAY
      -
      --- - - - - - -
      Access:Get only
      Type:integer (1-426) or (1-356)
      -

      Day-hand number. Kerbin has 426 days in its year.

      -
      - -
      -
      -TimeSpan:YEAR
      -
      --- - - - - - -
      Access:Get only
      Type:integer
      -

      Year-hand number

      -
      - -
      -
      -TimeSpan:SECONDS
      -
      --- - - - - - -
      Access:Get only
      Type:integer
      -

      Total Seconds since Epoch.

      -
      - -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Colors

      -

      Next topic

      -

      Drawing Vectors on the Screen

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/misc/vecdraw.html b/structures/misc/vecdraw.html deleted file mode 100644 index b30ad2070..000000000 --- a/structures/misc/vecdraw.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - Drawing Vectors on the Screen — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Drawing Vectors on the Screen

      -
      -
      -VECDRAW()
      -

      Build the suffix fields one at a time using the VecDraw empty construction function. This creates an empty VecDraw with nothing populated yet. You have to follow it up with calls to the suffixes as shown here:

      -
      SET anArrow TO VECDRAW().
      -SET anArrow:VEC TO V(a,b,c).
      -SET anArrow:SHOW TO true.
      -// At this point you have done the minimal necessary to make the arrow appear
      -// and it shows up on the scren immediately.
      -
      -// Further options can also be set:
      -SET anArrow:START TO V(0,0,0).
      -SET anArrow:COLOR TO RGB(1,0,0).
      -SET anArrow:LABEL TO "See the arrow?".
      -SET anArrow:SCALE TO 5.0.
      -
      -
      -
      - -
      -
      -VECDRAWARGS(start, vec, color, label, scale, show)
      -

      This builds the VecDraw all at once with the VECDRAWARGS() construction function. VECDRAWARGS() lets you specify all of the attributes in a list of arguments at once:

      -
      SET anArrow TO VECDRAWARGS(
      -    V(0,0,0),
      -    V(a,b,c),
      -    RGB(1,0,0),
      -    "See the arrow?",
      -    5.0,
      -    TRUE                  ).
      -
      -
      -
      - -

      The above two examples make the same thing. The arrow should be visible on both the map view and the in-flight view, but on the map view it will have to be a long arrow to be visible. VecDraw‘s do not auto-update for changes in the vector like a LOCK would, but if you repeatedly SET the :VEC suffix in a loop, it will adjust the arrow picture to match as you do so:

      -
      set xAxis to VECDRAWARGS( V(0,0,0), V(1,0,0), RGB(1.0,0.5,0.5), "X axis", 5, TRUE ).
      -set yAxis to VECDRAWARGS( V(0,0,0), V(0,1,0), RGB(0.5,1.0,0.5), "Y axis", 5, TRUE ).
      -set zAxis to VECDRAWARGS( V(0,0,0), V(0,0,1), RGB(0.5,0.5,1.0), "Z axis", 5, TRUE ).
      -
      -
      -

      To make a VecDraw disappear, you can either set its VecDraw:SHOW to false or just UNSET the variable, or re-assign it. An example using VecDraw can be seen in the documentation for POSITIONAT().

      -
      -
      -structure VecDraw
      -

      This is a structure that allows you to make a drawing of a vector on the screen in map view or in flight view.

      - - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      STARTVectorStart position of the vector
      VECVectorThe vector to draw
      COLORColorColor of the vector
      COLOUR Same as COLOR
      LABELstringText to show next to vector
      SCALEintegerScale START and VEC
      SHOWbooleanDraw vector to screen
      -
      - -
      -
      -VecDraw:START
      -
      --- - - - - - -
      Access:Get/Set
      Type:Vector
      -

      Optional, defaults to V(0,0,0) - position of the tail of the vector to draw in SHIP-RAW coords. V(0,0,0) means the ship Center of Mass.

      -
      - -
      -
      -VecDraw:VEC
      -
      --- - - - - - -
      Access:Get/Set
      Type:Vector
      -

      Mandatory - The vector to draw, SHIP-RAW Coords.

      -
      - -
      -
      -VecDraw:COLOR
      -
      --- - - - - - -
      Access:Get/Set
      Type:Color
      -

      Optional, defaults to white. This is the color to draw the vector. There is a hard-coded fade effect where the tail is a bit more transparent than the head.

      -
      - -
      -
      -VecDraw:COLOUR
      -
      --- - - - - - -
      Access:Get/Set
      Type:Color
      -

      Alias for VecDraw:COLOR

      -
      - -
      -
      -VecDraw:LABEL
      -
      --- - - - - - -
      Access:Get/Set
      Type:string
      -

      Optional, defaults to “”. Text to show on-screen at the midpoint of the vector.

      -
      - -
      -
      -VecDraw:SCALE
      -
      --- - - - - - -
      Access:Get/Set
      Type:integer
      -

      Optional, defauls to 1. Scalar to multiply by both the START and the VEC

      -
      - -
      -
      -VecDraw:SHOW
      -
      --- - - - - - -
      Access:Get/Set
      Type:boolean
      -

      Set to true to make the arrow appear, false to hide it. Defaults to false until you’re ready to set it to true.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Time Span

      -

      Next topic

      -

      Contribute

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/orbits.html b/structures/orbits.html deleted file mode 100644 index 89176df2c..000000000 --- a/structures/orbits.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - Orbits — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      - -
      -
      -
      -
      -

      Previous topic

      -

      Structure Reference

      -

      Next topic

      -

      Orbit

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/orbits/orbit.html b/structures/orbits/orbit.html deleted file mode 100644 index d094a715e..000000000 --- a/structures/orbits/orbit.html +++ /dev/null @@ -1,568 +0,0 @@ - - - - - - - - Orbit — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Orbit

      - -

      Variables of type Orbit hold descriptive information about the elliptical shape of a predicted orbit. Whenever there are multiple patches of orbit ellipses strung together, for example, when an encounter with a body is expected to alter the path, or when a maneuver node is planned, then each individual patch of the path is represented by one Orbit object.

      -

      Each Orbitable item such as a Vessel or celestial Body has an :ORBIT suffix that can be used to obtain its current Orbit.

      -

      Whenever you get the Orbit of a Vessel, be aware that its just the current Orbit patch that doesn’t take into account any planetary encounters (slingshots) or maneuver nodes that may occur. For example, your vessel might never reach SHIP:ORBIT:APOAPSIS if you’re going to intersect the Mun and be flung by it into a new orbit.

      -
      -

      Warning

      -

      Some of the parameters listed here come directly from KSP’s API and there is a bit of inconsistency with whether it uses radians or degrees for angles. As much as possible we have tried to present everything in kOS as degrees for consistency, but some of these may have slipped through. If you see any of these being reported in radians, please make a bug report.

      -
      -
      -

      Structure

      -
      -
      -structure Orbit
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixType (units)Description
      NAMEstringname of this orbit
      APOAPSISscalar (m)Maximum altitude
      PERIAPSISscalar (m)Minimum altitude
      BODYBodyFocal body of orbit
      PERIODscalar (s)orbital period
      INCLINATIONscalar (deg)orbital inclination
      ECCENTRICITYscalarorbital eccentricity
      SEMIMAJORAXISscalar (m)semi-major axis
      SEMIMINORAXISscalar (m)semi-minor axis
      LANscalar (deg)Same as LONGITUDEOFASCENDINGNODE
      LONGITUDEOFASCENDINGNODEscalar (deg)Longitude of the ascending node
      ARGUMENTOFPERIAPSISscalarargument of periapsis
      TRUEANOMALYscalartrue anomaly
      MEANANOMALYATEPOCHscalarmean anomaly
      TRANSITIONstringTransition from this orbit
      POSITIONVectorThe current position
      VELOCITYVectorThe current velocity
      NEXTPATCHOrbitNext Orbit
      HASNEXTPATCHbooleanHas a next Orbit
      -
      - -
      -
      -Orbit:NAME
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      a name for this orbit.

      -
      - -
      -
      -Orbit:APOAPSIS
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      The max altitude expected to be reached.

      -
      - -
      -
      -Orbit:PERIAPSIS
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      The min altitude expected to be reached.

      -
      - -
      -
      -Orbit:BODY
      -
      --- - - - - - -
      Type:Body
      Access:Get only
      -

      The celestial body this orbit is orbiting.

      -
      - -
      -
      -Orbit:PERIOD
      -
      --- - - - - - -
      Type:scalar (seconds)
      Access:Get only
      -

      orbital period

      -
      - -
      -
      -Orbit:INCLINATION
      -
      --- - - - - - -
      Type:scalar (degree)
      Access:Get only
      -

      `orbital_inclination`_

      -
      - -
      -
      -Orbit:ECCENTRICITY
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      orbital eccentricity

      -
      - -
      -
      -Orbit:SEMIMAJORAXIS
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      semi-major axis

      -
      - -
      -
      -Orbit:SEMIMINORAXIS
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      semi-minor axis

      -
      - -
      -
      -Orbit:LAN
      -

      Same as Orbit:LONGITUDEOFASCENDINGNODE.

      -
      - -
      -
      -Orbit:LONGITUDEOFASCENDINGNODE
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      Longitude of the ascending node. It’s unclear what the basis line the game uses for this is, though. The real-world basis is the constellation Ares, which of course doesn’t exist in the Kerbal universe.

      -
      - -
      -
      -Orbit:ARGUMENTOFPERIAPSIS
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      argument of periapsis

      -
      - -
      -
      -Orbit:TRUEANOMALY
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      true anomaly

      -
      - -
      -
      -Orbit:MEANANOMALYATEPOCH
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      mean anomaly

      -
      - -
      -
      -Orbit:TRANSITION
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      Describes the way in which this orbit will end and become a different orbit, with a value taken from this list.

      -
      - -
      -
      -Orbit:POSITION
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      The current position of whatever the object is that is in this orbit.

      -
      - -
      -
      -Orbit:VELOCITY
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      The current velocity of whatever the object is that is in this orbit.

      -
      - -
      -
      -Orbit:NEXTPATCH
      -
      --- - - - - - -
      Type:Orbit
      Access:Get only
      -

      When this orbit has a transition to another orbit coming up, this suffix returns the next Orbit patch after this one. For example, when escaping from a Mun orbit into a Kerbin orbit from which you will escape and hit a Solar orbit, then the current orbit’s :NEXTPATCH will show the Kerbin orbit, and :NEXTPATCH:NEXTPATCH will show the solar orbit. The number of patches into the future that you can peek depends on your conic patches setting in your Kerbal Space Program Settings.cfg file.

      -
      - -
      -
      -Orbit:HASNEXTPATCH
      -

      boolean -:access: Get only

      -

      If :NEXTPATCH will return a valid patch, this is true. If :NEXTPATCH will not return a valid patch because there are no transitions occurring in the future, then HASNEXTPATCH will be false.

      -
      - -

      Orbit:NEXTPATCH and Orbit:HASNEXTPATCH both only operate on the current momentum of the object, and do not take into account any potential changes planned with maneuver nodes. To see the possible new path you would have if a maneuver node gets executed exactly as planned, you need to first get the orbit that follows the manuever node, by looking at the :ref:`maneuver node’s :ORBIT suffix <node>`_, and then look at it’s Orbit:NEXTPATCH and Orbit:HASNEXTPATCH.

      -
      -
      -

      Deprecated Suffix

      -
      -
      -Orbit:PATCHES
      -
      --- - - - - - -
      Type:List of Orbit Objects
      Access:Get only
      -
      -

      Note

      -
      -

      Deprecated since version 0.15: To get the same functionality, you must use Vessel:PATCHES which is a suffix of the Vessel itself.

      -
      -
      -
      - -
      -
      -

      Transition Names

      -
      -
      INITIAL
      -
      Refers to the pure of a new orbit, which is a value you will never see from the Orbit:TRANSITION suffix (it refers to the start of the orbit patch, and Orbit:TRANSITION only refers to the end of the patch.
      -
      FINAL
      -
      Means that no transition to a new orbit is expected. It this orbit is the orbit that will remain forever.
      -
      ENCOUNTER
      -
      Means that this orbit will enter a new SOI of another orbital body that is smaller in scope and is “inside” the current one. (example: currently in Sun orbit, will enter Duna Orbit.)
      -
      ESCAPE
      -
      Means that this orbit will enter a new SOI of another orbital body that is larger in scope and is “outside” the current one. (example: currently in Kerbin orbit, will enter Sun Orbit.)
      -
      MANEUVER
      -
      Means that this orbit will end due to a manuever node that starts a new orbit?
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Orbits

      -

      Next topic

      -

      Orbitable (Vessels and Bodies)

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/orbits/orbitable.html b/structures/orbits/orbitable.html deleted file mode 100644 index deee529c2..000000000 --- a/structures/orbits/orbitable.html +++ /dev/null @@ -1,528 +0,0 @@ - - - - - - - - Orbitable (Vessels and Bodies) — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Orbitable (Vessels and Bodies)

      -

      All objects that can move in orbit around other objects share some similar structure. To help keep things as consistent as possible, that similar structure is defined here. Everything you see here works for both Vessels and Bodies.

      -
      -

      Note

      -

      SOI Body

      -

      Every where you see the term SOI Body in the descriptions below, it refers to the body at the center of the orbit of this object - the body in who’s sphere of influence this object is located. It is important to make the distinction that if this object is itself a Body, the SOI body is the body being orbited, not the body doing the orbiting. I.e. When talking about the Mun, the SOI body means “Kerbin”. When talking about Kerbin, the SOI body means “Sun”.

      -
      -
      -
      -structure Orbitable
      -

      These terms are all read-only.

      - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixType (units)
      NAMEstring
      BODYBody
      OBTOrbit
      UPDirection
      NORTHDirection
      PROGRADEDirection
      SRFPROGRADEDirection
      RETROGRADEDirection
      SRFRETROGRADEDirection
      POSITIONVector
      VELOCITYOrbitableVelocity
      DISTANCEscalar (m)
      DIRECTIONDirection
      LATITUDEscalar (deg)
      LONGITUDEscalar (deg)
      ALTITUDEscalar (m)
      GEOPOSITIONGeoCoordinates
      PATCHESList of Orbits
      The Following are deprecated (use OBT)
      APOAPSISscalar (m)
      PERIAPSISscalar (m)
      -
      - -
      -
      -Orbitable:NAME
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      Name of this vessel or body.

      -
      - -
      -
      -Orbitable:BODY
      -
      --- - - - - - -
      Type:Body
      Access:Get only
      -

      The Body that this object is orbiting. I.e. Mun:BODY returns Kerbin.

      -
      - -
      -
      -Orbitable:OBT
      -
      --- - - - - - -
      Type:Orbit
      Access:Get only
      -

      The current single orbit “patch” that this object is on (not the future orbits it might be expected to achieve after maneuver nodes or encounter transitions, but what the current orbit would be if nothing changed and no encounters perturbed the orbit.

      -
      - -
      -
      -Orbitable:UP
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing straight up away from the SOI body.

      -
      - -
      -
      -Orbitable:NORTH
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing straight north on the SOI body, parallel to the surface of the SOI body.

      -
      - -
      -
      -Orbitable:PROGRADE
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing in the direction of this object’s orbitable-frame velocity

      -
      - -
      -
      -Orbitable:SRFPROGRADE
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing in the direction of this object’s surface-frame velocity. Note that if this Orbitable is itself a body, remember that this is relative to the surface of the SOI body, not this body.

      -
      - -
      -
      -Orbitable:RETROGRADE
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing in the opposite of the direction of this object’s orbitable-frame velocity

      -
      - -
      -
      -Orbitable:SRFRETROGRADE
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing in the opposite of the direction of this object’s surface-frame velocity. Note that this is relative to the surface of the SOI body.

      -
      - -
      -
      -Orbitable:POSITION
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      The position of this object in the SHIP-RAW reference frame

      -
      - -
      -
      -Orbitable:VELOCITY
      -
      --- - - - - - -
      Type:OrbitableVelocity
      Access:Get only
      -

      The orbitable velocity of this object in the SHIP-RAW reference frame

      -
      - -
      -
      -Orbitable:DISTANCE
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      The scalar distance between this object and the center of SHIP.

      -
      - -
      -
      -Orbitable:DIRECTION
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      pointing in the direction of this object from SHIP.

      -
      - -
      -
      -Orbitable:LATITUDE
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      The latitude in degrees of the spot on the surface of the SOI body directly under this object.

      -
      - -
      -
      -Orbitable:LONGITUDE
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -

      The longitude in degrees of the spot on the surface of the SOI body directly under this object. Longitude returned will always be normalized to be in the range [-180,180].

      -
      - -
      -
      -Orbitable:ALTITUDE
      -
      --- - - - - - -
      Type:scalar (m)
      Access:Get only
      -

      The altitude in meters above the sea level surface of the SOI body (not the center of the SOI body. To get the true radius of the orbit for proper math calculations remember to add altitude to the SOI body’s radius.)

      -
      - -
      -
      -Orbitable:GEOPOSITION
      -
      --- - - - - - -
      Type:GeoCoordinates
      Access:Get only
      -

      A combined structure of the latitude and longitude numbers.

      -
      - -
      -
      -Orbitable:PATCHES
      -
      --- - - - - - -
      Type:List of Orbit “patches”
      Access:Get only
      -

      The list of all the orbit patches that this object will transition to, not taking into account maneuver nodes. The zero-th patch of the list is the current orbit.

      -
      - -
      -
      -Orbitable:APOAPSIS
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -
      -

      Deprecated since version 0.15: Use OBT:APOAPSIS instead.

      -
      -
      - -
      -
      -Orbitable:PERIAPSIS
      -
      --- - - - - - -
      Type:scalar (deg)
      Access:Get only
      -
      -

      Deprecated since version 0.15: Use OBT:PERIAPSIS instead.

      -
      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Orbit

      -

      Next topic

      -

      OrbitableVelocity

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/orbits/orbitablevelocity.html b/structures/orbits/orbitablevelocity.html deleted file mode 100644 index a76c8a051..000000000 --- a/structures/orbits/orbitablevelocity.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - OrbitableVelocity — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      OrbitableVelocity

      -

      When any Orbitable object returns its VELOCITY suffix, it returns it as a structure containing a pair of both its orbit-frame velocity and its surface-frame velocity at the same instant of time. To obtain its velocity as a vector you must pick whether you want the oribtal or surface velocities by giving a further suffix:

      -
      -
      -structure OrbitableVelocity
      -
      - ---- - - - - - - - - - - - - - -
      Members
      SuffixType
      ORBITVector
      SURFACEVector
      -
      - -
      -
      -OrbitableVelocity:ORBIT
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      Returns the orbital velocity.

      -
      - -
      -
      -OrbitableVelocity:SURFACE
      -
      --- - - - - - -
      Type:Vector
      Access:Get only
      -

      Returns the surface-frame velocity. Note that this is the surface velocity relative to the surface of the SOI body, not the orbiting object itself. (i.e. Mun:VELOCITY:SURFACE returns the Mun’s velocity relative to the surface of its SOI body, Kerbin).

      -
      - -

      Examples:

      -
      SET VORB TO SHIP:VELOCITY:ORBIT
      -SET VSRF TO SHIP:VELOCITY:SURFACE
      -SET MUNORB TO MUN:VELOCITY:ORBIT
      -SET MUNSRF TO MUN:VELOCITY:SURFACE
      -
      -
      -
      -

      Note

      -

      At first glance it may seem that Mun:VELOCITY:SURFACE is wrong because it creates a vector in the opposite direction from Mun:VELOCITY:ORBIT, but this is actually correct. Kerbin’s surface rotates once every 6 hours, and the Mun takes a lot longer than 6 hours to orbit Kerbin. Therefore, relative to Kerbin’s surface, the Mun is going backward.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Orbitable (Vessels and Bodies)

      -

      Next topic

      -

      Celestial Bodies

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels.html b/structures/vessels.html deleted file mode 100644 index 7fd5a558d..000000000 --- a/structures/vessels.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - Vessels and Parts — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - - - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Body

      -

      Next topic

      -

      DockingPort

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/dockingport.html b/structures/vessels/dockingport.html deleted file mode 100644 index f3ac2b41b..000000000 --- a/structures/vessels/dockingport.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - DockingPort — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      DockingPort

      -

      Some of the Parts returned by LIST PARTS will be of type DockingPort.

      -
      -
      -structure DockingPort
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      All suffixes of Part A DockingPort is a kind of Part
      AQUIRERANGEscalaractive range of the port
      AQUIREFORCEscalarforce experienced when docking
      AQUIRETORQUEscalartorque experienced when docking
      REENGAGEDDISTANCEscalardistance at which the port is reset
      DOCKEDSHIPNAMEstringname of vessel the port is docked to
      PORTFACINGDirectionfacing of the port
      STATEstringcurrent state of the port
      UNDOCK callable to release the dock
      TARGETABLEbooleancheck if this port can be targeted
      -
      - -
      -

      Note

      -

      DockingPort is a type of Part, and therefore can use all the suffixes of Part. Shown below are only the suffixes that are unique to DockingPort.

      -
      -
      -
      -DockingPort:AQUIRERANGE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      gets the range at which the port will “notice” another port and pull on it.

      -
      - -
      -
      -DockingPort:AQUIREFORCE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      gets the force with which the port pulls on another port.

      -
      - -
      -
      -DockingPort:AQUIRETORQUE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      gets the rotational force with which the port pulls on another port.

      -
      - -
      -
      -DockingPort:REENGAGEDDISTANCE
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      how far the port has to get away after undocking in order to re-enable docking.

      -
      - -
      -
      -DockingPort:DOCKEDSHIPNAME
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      name of vessel on the other side of the docking port.

      -
      - -
      -
      -DockingPort:PORTFACING
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      Gets the facing of this docking port which may differ from the facing of the part itself if the docking port is aimed out the side of the part, as in the case of the inline shielded docking port.

      -
      - -
      -
      -DockingPort:STATE
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      One of the following string values:

      -
      -
      Ready
      -
      Docking port is not yet attached and will attach if it touches another.
      -
      Docked (docker)
      -
      One port in the joined pair is called the docker, and has this state
      -
      Docked (dockee)
      -
      One port in the joined pair is called the dockee, and has this state
      -
      Docked (same vessel)
      -
      Sometimes KSP says this instead. It’s unclear what it means.
      -
      Disabled
      -
      Docking port will refuse to dock if it bumps another docking port.
      -
      PreAttached
      -
      Temporary state during the “wobbling” while two ports are magnetically touching but not yet docked solidly. During this state the two vessels are still tracked as separate vessels and haven’t become one yet.
      -
      -
      - -
      -
      -DockingPort:UNDOCK()
      -

      Call this to cause the docking port to detach.

      -
      - -
      -
      -DockingPort:TARGETABLE
      -
      --- - - - - - -
      Type:boolean
      Access:Get only
      -

      True if this part can be picked with SET TARGET TO.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Vessels and Parts

      -

      Next topic

      -

      Engine

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/engine.html b/structures/vessels/engine.html deleted file mode 100644 index c5b436746..000000000 --- a/structures/vessels/engine.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - Engine — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Engine

      -

      Some of the Parts returned by LIST PARTS will be of type Engine. It is also possible to get just the Engine parts by executing LIST ENGINES, for example:

      -
      LIST ENGINES IN myVariable.
      -FOR eng IN myVariable {
      -    print "An engine exists with ISP = " + eng:ISP.
      -}.
      -
      -
      -
      -
      -structure Engine
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixType (units)Description
      All suffixes of Part  
      ACTIVATE Turn engine on
      SHUTDOWN Turn engine off
      THRUSTLIMITscalar (%)Tweaked thrust limit
      MAXTHRUSTscalar (kN)Untweaked thrust limit
      THRUSTscalar (kN)Current thrust
      FUELFLOWscalar (l/s maybe)Rate of fuel burn
      ISPscalarSpecific impulse
      FLAMEOUTbooleanCheck if no more fuel
      IGNITIONbooleanCheck if engine is active
      ALLOWRESTARTbooleanCheck if engine can be reactivated
      ALLOWSHUTDOWNbooleanCheck if engine can be shutdown
      THROTTLELOCKbooleanCheck if throttle can not be changed
      -
      - -
      -

      Note

      -

      Engine is a type of Part, and therefore can use all the suffixes of Part. Shown below are only the suffixes that are unique to Engine.

      -
      -
      -
      -Engine:ACTIVATE()
      -

      Call to make the engine turn on.

      -
      - -
      -
      -Engine:SHUTDOWN()
      -

      Call to make the engine turn off.

      -
      - -
      -
      -Engine:THRUSTLIMIT
      -
      --- - - - - - -
      Access:Get only
      Type:scalar (%)
      -

      If this an engine with a thrust limiter (tweakable) enabled, what percentage is it limited to?

      -
      - -
      -
      -Engine:MAXTHRUST
      -
      --- - - - - - -
      Access:Get only
      Type:scalar (kN)
      -

      How much thrust would this engine give if the throttle was max and conditions were ideal.

      -
      - -
      -
      -Engine:THRUST
      -
      --- - - - - - -
      Access:Get only
      Type:scalar (kN)
      -

      How much thrust is this engine giving at this very moment.

      -
      - -
      -
      -Engine:FUELFLOW
      -
      --- - - - - - -
      Access:Get only
      Type:scalar (Liters/s? maybe)
      -

      Rate at which fuel is being burned. Not sure what the units are.

      -
      - -
      -
      -Engine:ISP
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      Specific impulse

      -
      - -
      -
      -Engine:FLAMEOUT
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Is this engine failed because it is starved of a resource (liquidfuel, oxidizer, oxygen)?

      -
      - -
      -
      -Engine:IGNITION
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Has this engine been ignited? If both Engine:IGNITION and Engine:FLAMEOUT are true, that means the engine could start up again immediately if more resources were made available to it.

      -
      - -
      -
      -Engine:ALLOWRESTART
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Is this an engine that can be started again? Usually True, but false for solid boosters.

      -
      - -
      -
      -Engine:ALLOWSHUTDOWN
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Is this an engine that can be shut off once started? Usually True, but false for solid boosters.

      -
      - -
      -
      -Engine:THROTTLELOCK
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Is this an engine that is stuck at a fixed throttle? (i.e. solid boosters)

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      DockingPort

      -

      Next topic

      -

      Maneuver Node

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/node.html b/structures/vessels/node.html deleted file mode 100644 index 2d4d22217..000000000 --- a/structures/vessels/node.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - - Maneuver Node — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Maneuver Node

      -

      Contents

      -
      -
      -

      A planned velocity change along an orbit. These are the nodes that you can set in the KSP user interface. Setting one through kOS will make it appear on the in-game map view, and creating one manually on the in-game map view will cause it to be visible to kOS.

      -
      -

      Creation

      -
      -
      -NODE(utime, radial, normal, prograde)
      -
      --- - - - - - -
      Parameters:
        -
      • utime – (sec) Time of this maneuver
      • -
      • radial – (m/s) Delta-V in radial-out direction
      • -
      • normal – (m/s) Delta-V normal to orbital plane
      • -
      • prograde – (m/s) Delta-V in prograde direction
      • -
      -
      Returns:

      ManeuverNode

      -
      -

      You can make a maneuver node in a variable using the NODE function:

      -
      SET myNode to NODE( TIME:SECONDS+200, 0, 50, 10 ).
      -
      -
      -

      Once you have a maneuver node in a variable, you use the ADD and REMOVE commands to attach it to your vessel’s flight plan. A kOS CPU can only manipulate the flight plan of its CPU vessel.

      -
      -

      Warning

      -

      When constructing a new node using the NODE function call, you use the universal time (you must add the ETA time to the current time to arrive at the value to pass in), but when using the suffix ManeuverNode:ETA, you do NOT use universal time, instead just giving the number of seconds from now.

      -
      -

      Once you have created a node, it’s just a hypothetical node that hasn’t -been attached to anything yet. To attach a node to the flight path, you must use the command ADD to attach it to the ship.

      -
      - -
      -
      -ADD
      -

      To put a maneuver node into the flight plan of the current CPU vessel (i.e. SHIP), just ADD it like so:

      -
      SET myNode to NODE( TIME:SECONDS+200, 0, 50, 10 ).
      -ADD myNode.
      -
      -
      -

      You should immediately see it appear on the map view when you do this. The ADD command can add nodes anywhere within the flight plan. To insert a node earlier in the flight than an existing node, simply give it a smaller ETA time and then ADD it.

      -
      - -
      -
      -REMOVE
      -

      To remove a maneuver node from the flight path of the cur:rent CPU vessel (i.e. SHIP), just REMOVE it like so:

      -
      REMOVE myNode.
      -
      -
      -
      - -
      -
      -NEXTNODE
      -

      NEXTNODE is a built-in variable that always refers to the next upcoming node that has been added to your flight plan:

      -
      SET MyNode to :global:`NEXTNODE`.
      -PRINT :global:`NEXTNODE`:PROGRADE.
      -REMOVE :global:`NEXTNODE`.
      -
      -
      -

      Currently, if you attempt to query NEXTNODE and there is no node on your flight plan, it produces a run-time error. (This needs to be fixed in a future release so it is possible to query whether or not you have a next node).

      -

      If you need to query whether or not you have a NEXTNODE, the following has been suggested as a workaround in the meantime: Set a node really far into the future, beyond any reasonable amount of time. Add it to your flight plan. Then check NEXTNODE to see if it returns THAT node, or an earlier one. If it returns an earlier one, then that earlier one was there all along and is the real NEXTNODE. If it returns the fake far-future node you made instead, then there were no nodes before that point. In either case, remove the far-future node after you perform the test.

      -

      The special identifier NEXTNODE is a euphemism for “whichever node is coming up soonest on my flight path”. Therefore you can remove a node even if you no longer have the maneuver node variable around, by doing this:

      -
      REMOVE :global:`NEXTNODE`.
      -
      -
      -
      - -
      -
      -

      Structure

      -
      -
      -structure ManeuverNode
      -

      Here are some examples of accessing the suffixes of a ManeuverNode:

      -
      // creates a node 60 seconds from now with
      -// prograde = 100 m/s
      -SET X TO NODE(TIME:SECONDS+60, 0, 0, 100).
      -
      -ADD X.            // adds maneuver to flight plan
      -
      -PRINT X:PROGRADE. // prints 100.
      -PRINT X:ETA.      // prints seconds till maneuver
      -PRINT X:DELTAV    // prints delta-v vector
      -
      -REMOVE X.         // remove node from flight plan
      -
      -// Create a blank node
      -SET X TO NODE(0, 0, 0, 0).
      -
      -ADD X.                 // add Node to flight plan
      -SET X:PROGRADE to 500. // set prograde dV to 500 m/s
      -SET X:ETA to 30.       // Set to 30 sec from now
      -
      -PRINT X:ORBIT:APOAPSIS.  // apoapsis after maneuver
      -PRINT X:ORBIT:PERIAPSIS. // periapsis after maneuver
      -
      -
      - - ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixType (units)AccessDescription
      DELTAVVector (m/s)Get onlyThe burn vector with magnitude equal to delta-V
      BURNVECTORVector (m/s)Get onlyAlias for DELTAV
      ETAscalar (s)Get/SetTime until this maneuver
      PROGRADEscalar (m/s)Get/SetDelta-V along prograde
      RADIALOUTscalar (m/s)Get/SetDelta-V along radial to orbited Body
      NORMALscalar (m/s)Get/SetDelta-V along normal to the Vessel‘s Orbit
      ORBITOrbitGet onlyExpected Orbit after this maneuver
      -
      - -
      -
      -ManeuverNode:DELTAV
      -
      --- - - - - - -
      Access:Get only
      Type:Vector
      -

      The vector giving the total burn of the node. The vector can be used to steer with, and its magnitude is the delta V of the burn.

      -
      - -
      -
      -ManeuverNode:BURNVECTOR
      -

      Alias for ManeuverNode:DELTAV.

      -
      - -
      -
      -ManeuverNode:ETA
      -
      --- - - - - - -
      Access:Get/Set
      Type:scalar
      -

      The number of seconds until the expected burn time. If you SET this, it will actually move the maneuver node along the path in the map view, identically to grabbing the maneuver node and dragging it.

      -
      - -
      -
      -ManeuverNode:PROGRADE
      -
      --- - - - - - -
      Access:Get/Set
      Type:scalar
      -

      The delta V in (meters/s) along just the prograde direction (the yellow and green ‘knobs’ of the maneuver node). A positive value is a prograde burn and a negative value is a retrograde burn.

      -
      - -
      -
      -ManeuverNode:RADIALOUT
      -
      --- - - - - - -
      Access:Get/Set
      Type:scalar
      -

      The delta V in (meters/s) along just the radial direction (the cyan knobs’ of the maneuver node). A positive value is a radial out burn and a negative value is a radial in burn.

      -
      - -
      -
      -ManeuverNode:NORMAL
      -
      --- - - - - - -
      Access:Get/Set
      Type:scalar
      -

      The delta V in (meters/s) along just the normal direction (the purple knobs’ of the maneuver node). A positive value is a normal burn and a negative value is an anti-normal burn.

      -
      - -
      -
      -ManeuverNode:ORBIT
      -
      --- - - - - - -
      Access:Get only
      Type:Orbit
      -

      The new orbit patch that will begin starting with the burn of this node, under the assumption that the burn will occur exactly as planned.

      -
      - -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Engine

      -

      Next topic

      -

      Part

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/part.html b/structures/vessels/part.html deleted file mode 100644 index 027f5c32e..000000000 --- a/structures/vessels/part.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - - - Part — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Part

      -

      These are the generic properties every PART has. You can obtain a list of values of type Part using the LIST PARTS command.

      -
      -
      -structure Part
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      NAMEstringName of this part
      TITLEstringTitle as it appears in KSP
      TAGstringName-tag if assigned by the player
      CONTROLFROMbooleanSet control-from to this part
      STAGEscalarThe stage this is associated with
      UIDscalarUnique identifying number
      ROTATIONDirectionThe rotation of this part’s \(x\)-axis
      POSITIONVectorThe location of this part in the universe
      FACINGDirectionthe direction that this part is facing
      RESOURCESListlist of the Resource in this part
      TARGETABLEbooleantrue if this part can be selected as a target
      SHIPVesselthe vessel that contains this part
      GETMODULE(name)PartModuleGet one of the PartModules by name
      MODULESListNames (string) of all PartModules
      ALLMODULESListSame as MODULES
      PARENTPartAdjacent Part on this Vessel.
      HASPARENTbooleanCheck if this part has a parent Part
      CHILDRENListList of attached Parts
      -
      - -
      -
      -Part:NAME
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      Name of part as it is used behind the scenes in the game’s API code.

      -

      A part’s name is the name it is given behind the scenes in KSP. It never appears in the normal GUI for the user to see, but it is used in places like Part.cfg files, the saved game persistence file, the ModuleManager mod, and so on.

      -
      - -
      -
      -Part:TITLE
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      The title of the part as it appears on-screen in the gui.

      -

      A part’s title is the name it has inside the GUI interface on the screen that you see as the user.

      -
      - -
      -
      -Part:TAG
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      The name tag value that may exist on this part if you have given the part a name via the name-tag system.

      -

      A part’s tag is whatever custom name you have given it using the name-tag system described here. This is probably the best naming convention to use because it lets you make up whatever name you like for the part and use it to pick the parts you want to deal with in your script.

      -

      This example assumes you have a target vessel picked, and that the target vessel is loaded into full-physics range and not “on rails”. vessels that are “on rails” do not have their full list of parts entirely populated at the moment:

      -
      LIST PARTS FROM TARGET IN tParts.
      -
      -PRINT "The target vessel has a".
      -PRINT "partcount of " + tParts:LENGTH.
      -
      -SET totTargetable to 0.
      -FOR part in tParts {
      -    IF part:TARGETABLE {
      -        SET totTargetable TO totTargetable + 1.
      -    }
      -}
      -
      -PRINT "...and " + totTargetable.
      -PRINT " of them are targetable parts.".
      -
      -
      -
      - -
      -
      -Part:CONTROLFROM
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      Set to TRUE to cause the game to do the same thing as when you right-click a part on a vessel and select “control from here” on the menu. It rotates the control orientation so that fore/aft/left/right/up/down now match the orientation of this part. NOTE that this will not work for every type of part. It only works for those parts that KSP itself allows this for (control cores and docking ports).

      -
      - -
      -
      -Part:STAGE
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      the stage this part is part of.

      -
      - -
      -
      -Part:UID
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      All parts have a unique ID number. Test if two parts are the same part by seeing if this is the same between them.

      -
      - -
      -
      -Part:ROTATION
      -
      --- - - - - - -
      Access:Get only
      Type:Direction
      -

      The rotation of this part’s X-axis, which points out of its side and is probably not what you want. You probably want the Part:FACING suffix instead.

      -
      - -
      -
      -Part:POSITION
      -
      --- - - - - - -
      Access:Get only
      Type:Vector
      -

      The location of this part in the universe. It is expressed in the same frame of reference as all the other positions in kOS, and thus can be used to help do things like navigate toward the position of a docking port.

      -
      - -
      -
      -Part:FACING
      -
      --- - - - - - -
      Access:Get only
      Type:Direction
      -

      the direction that this part is facing.

      -
      - -
      -
      -Part:RESOURCES
      -
      --- - - - - - -
      Access:Get only
      Type:List
      -

      list of the Resource in this part.

      -
      - -
      -
      -Part:TARGETABLE
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      true if this part can be selected by KSP as a target.

      -
      - -
      -
      -Part:SHIP
      -
      --- - - - - - -
      Access:Get only
      Type:Vessel
      -

      the vessel that contains this part.

      -
      - -
      -
      -Part:GETMODULE(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the part module
      • -
      -
      Returns:

      PartModule

      -
      -

      Get one of the PartModules attached to this part, given the name of the module. (See Part:MODULES for a list of all the names available).

      -
      - -
      -
      -Part:MODULES
      -
      --- - - - - - -
      Access:Get only
      Type:List of strings
      -

      list of the names of PartModules enabled for this part.

      -
      - -
      -
      -Part:ALLMODULES
      -

      Same as Part:MODULES

      -
      - -
      -
      -Part:PARENT
      -
      --- - - - - - -
      Access:Get only
      Type:Part
      -

      When walking the tree of parts, this is the part that this part is attached to on the way “up” toward the root part.

      -
      - -
      -
      -Part:HASPARENT
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      When walking the tree of parts, this is true as long as there is a parent part to this part, and is false if this part has no parent (which can only happen on the root part).

      -
      - -
      -
      -Part:CHILDREN
      -
      --- - - - - - -
      Access:Get only
      Type:List of Parts
      -

      When walking the tree of parts, this is all the parts that are attached as children of this part. It returns a list of zero length when this part is a “leaf” of the parts tree.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Maneuver Node

      -

      Next topic

      -

      PartModule

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/partmodule.html b/structures/vessels/partmodule.html deleted file mode 100644 index e9dbb49eb..000000000 --- a/structures/vessels/partmodule.html +++ /dev/null @@ -1,481 +0,0 @@ - - - - - - - - PartModule — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      PartModule

      -

      Almost everything done with at right-click menus and action group action can be accessed via the PartModule objects that are attached to Parts of a Vessel.

      -

      The exact arrangement of PartModule to Parts to Vessels, and how to make use of a PartModule is a complex enough topic to warrant its own separate subject, described on the Ship parts and Modules page. If you have not read that page, it is recommended that you do so before using PartModules. The page you are reading now is meant as just a reference summary, not a tutorial.

      -

      Once you have a PartModule, you can use it to invoke the behaviors that are connected to its right-click menu and to its action groups.

      -
      -
      -structure PartModule
      -
      - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      NAMEstringName of this part module
      PARTPartPart attached to
      ALLFIELDSList of stringsAccessible fields
      ALLEVENTSList of stringsTriggerable events
      ALLACTIONSList of stringsTriggerable actions
      GETFIELD(name) Get value of a field by name
      SETFIELD(name,value) Set value of a field by name
      DOEVENT(name) Trigger an event button
      DOACTION(name,bool) Activate action by name with True or False
      HASFIELD(name)booleanCheck if field exists
      HASEVENT(name)booleanCheck if event exists
      HASACTION(name)booleanCheck if action exists
      -
      - -
      -
      -PartModule:NAME
      -
      --- - - - - - -
      Access:Get only
      Test:string
      -

      Get the name of the module. Note that it’s the same as the name given in the MODULE section of the Part.cfg file for the part.

      -
      - -
      -
      -PartModule:PART
      -
      --- - - - - - -
      Access:Get only
      Test:Part
      -

      Get the Part that this PartModule is attached to.

      -
      - -
      -
      -PartModule:ALLFIELDS
      -
      --- - - - - - -
      Access:Get only
      Test:List of strings
      -

      Get a list of all the names of KSPFields on this PartModule that the kos script is CURRENTLY allowed to get or set with :GETFIELD or :SETFIELD. Note the Security access comments below. This list can become obsolete as the game continues running depending on what the PartModule chooses to do.

      -
      - -
      -
      -PartModule:ALLEVENTS
      -
      --- - - - - - -
      Access:Get only
      Test:List of strings
      -

      Get a list of all the names of KSPEvents on this PartModule that the kos script is CURRENTLY allowed to trigger with :DOEVENT. Note the Security access comments below. This list can become obsolete as the game continues running depending on what the PartModule chooses to do.

      -
      - -
      -
      -PartModule:ALLACTIONS
      -
      --- - - - - - -
      Access:Get only
      Test:List of strings
      -

      Get a list of all the names of KSPActions on this PartModule that the kos script is CURRENTLY allowed to trigger with :DOACTION. Note the Security access comments below.

      -
      - -
      -
      -PartModule:GETFIELD(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the field
      • -
      -
      Returns:

      varies

      -
      -

      Get the value of one of the fields that this PartModule has placed onto the rightclick menu for the part. Note the Security comments below.

      -
      - -
      -
      -PartModule:SETFIELD(name,value)
      -
      --- - - - -
      Parameters:
        -
      • name – (string) Name of the field
      • -
      -
      -

      Set the value of one of the fields that this PartModule has placed onto the rightclick menu for the part. Note the Security comments below.

      -
      - -
      -
      -PartModule:DOEVENT(name)
      -
      --- - - - -
      Parameters:
        -
      • name – (string) Name of the event
      • -
      -
      -

      Trigger an “event button” that is on the rightclick part menu at the moment. Note the Security comments below.

      -
      - -
      -
      -PartModule:DOACTION(name,bool)
      -
      --- - - - -
      Parameters:
        -
      • name – (string) Name of the action
      • -
      • bool – (boolean) Value to set: True or False
      • -
      -
      -

      Activate one of this PartModule’s action-group-able actions, bypassing the action group system entirely by just activating it for this one part directly. The boolean value decides whether you are toggling the action ON or toggling it OFF. Note the Security comments below.

      -
      - -
      -
      -PartModule:HASFIELD(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the field
      • -
      -
      Returns:

      boolean

      -
      -

      Return true if the given field name is currently available for use with :GETFIELD or :SETFIELD on this PartModule, false otherwise.

      -
      - -
      -
      -PartModule:HASEVENT(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the event
      • -
      -
      Returns:

      boolean

      -
      -

      Return true if the given event name is currently available for use with :DOEVENT on this PartModule, false otherwise.

      -
      - -
      -
      -PartModule:HASACTION(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the action
      • -
      -
      Returns:

      boolean

      -
      -

      Return true if the given action name is currently available for use with :DOACTION on this PartModule, false otherwise.

      -
      - -
      -

      Notes

      -

      In all the above cases where there is a name being passed in to :GETFIELD, :SETFIELD, :DOEVENT, or :DOACTION, the name is meant to be the name that is seen by you, the user, in the GUI screen, and NOT necessarily the actual name of the variable that the programmer of that PartModule chose to call the value behind the scenes. This is so that you can view the GUI rightclick menu to see what to call things in your script.

      -
      -

      Note

      -

      Security and Respecting other Mod Authors

      -

      There are often a lot more fields and events and actions that a partmodule can do than are usable via kOS. In designing kOS, the kOS developers have deliberately chosen NOT to expose any “hidden” fields of a partmodule that are not normally shown to the user, without the express permission of a mod’s author to do so.

      -
      -

      The access rules that kOS uses are as follows:

      -
      -

      KSPFields

      -

      Is this a value that the user can normally see on the right-click context menu for a part? If so, then let kOS scripts GET the value. Is this a value that the user can normally manipulate via “tweakable” adjustments on the right-click context menu for a part, AND, is that tweakable a CURRENTLY enabled one? If so, then let KOS scripts SET the value, BUT they must set it to one of the values that the GUI would normally allow, according to the following rules.

      -
        -
      • -
        If the KSPField is boolean:
        -
          -
        • The value must be true, false, or 0 or 1.
        • -
        -
        -
        -
      • -
      • -
        If the KSPField is an integer:
        -
          -
        • The value must be a whole number.
        • -
        -
        -
        -
      • -
      • -
        If the KSPField is a floating point sliding number:
        -
          -
        • The GUI for this field will be defined as a slider with a min value, a max value, with a fixed increment interval where the detents are. When setting such a value, you will be constrained to the limits of this slider. For example: If a slider is defined to have a minimum value of 2.0, a maximum value of 5.0, and a minimum allowed delta increment of 0.1:
        • -
        • If you try to set it to 0, it will instead become 2, the minimum allowed value. If you try to set it to 9, it will instead become 5, the maximum allowed value. If you try to set it to 3.14159, it will instead become 3.1, because that’s rounding to the nearest increment step the slider supports.
        • -
        -
        -
        -
      • -
      • -
        If the KSPField is a string:
        -
          -
        • There is currently no way to set these because kOS uses the existence of a gui tweakable as “proof” that it’s okay to modify the field, and in the stock game there are no gui tweakables for string fields. This may change in the future if mods that extend the tweakables system are taken into account.
        • -
        -
        -
        -
      • -
      -
      -
      -

      KSPEvents

      -

      Is this an event that has a GUI button associated with it that is currently visible on the right-click menu? If the answer is yes, then it will also be triggerable by kOSScripts, otherwise it won’t.

      -
      -
      -

      KSPActions

      -

      Is this an action that the KSP user would have been allowed to set as part of an action group during building in the VAB or SPH? If so, then allow a kOS script to use it, EVEN IF it has never actually been added to an action group for this vessel.

      -
      -

      Note

      -

      If a KSPField, KSPEvent, or KSPAction has been disallowed, often in kOS it won’t even appear to be a field of the PartModule at all.

      -

      This is necessary because for some modules, the number of fields you can use are far outnumberd by the number of fields that exist but are normally hidden from view. It would become unworkable if all of the unusable ones were exposed to kOS scripts to see as fields.

      -
      -
      -

      Note

      -

      Which KSPFields, KSPEvents, and KSPActions exist on a PartModule can change during runtime!

      -

      A PartModule is allowed to change the look and feel of its rightclick menu fields on the fly as the game runs. Therefore a field that didn’t exist the last time you looked might now exist, and might not exist again next time. The list of what fields exist is context dependant. For example, a docking port may have an event button on it called “Undock Node”, that only exists when that port is connected to another port. If it’s not connected, the button may be gone. Similarly, a PartModule might toggle something by using a pair of two events that swap in and out depending on the current state. For example, many of the stock lights in the game have a “Turn on” button that after it’s been clicked, gets replaced with a “Turn off” button until it’s clicked again. A boolean toggle with a KSPFIeld would be simpler, but until “tweakables” existed in the main game, that wasn’t an option so a lot of older Partmodules still do things the old way with two KSPEvents that swap in and out.

      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Part

      -

      Next topic

      -

      Resource

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/resource.html b/structures/vessels/resource.html deleted file mode 100644 index e3bc33da3..000000000 --- a/structures/vessels/resource.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - Resource — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Resource

      -

      A single resource value a thing holds (i.e. fuel, electric charge, etc). This is the type returned as the elements of the list in LIST RESOURCES -IN MyList:

      -
      PRINT "THESE ARE ALL THE RESOURCES ON THE SHIP:".
      -LIST RESOURCES IN RESLIST.
      -FOR RES IN RESLIST {
      -    PRINT "Resource " + RES:NAME.
      -    PRINT "    value = " + AMOUNT.
      -    PRINT "    which is "
      -          + ROUND(100*RES:AMOUNT/RES:CAPACITY)
      -          + "% full.".
      -}.
      -
      -
      -
      -
      -structure Resource
      -
      ----- - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      NAMEstringResource name
      AMOUNTscalarAmount of this resource left
      CAPACITYscalarMaximum amount of this resource
      -
      - -
      -
      -Resource:NAME
      -
      --- - - - - - -
      Access:Get only
      Type:string
      -

      The name of the resource, i.e. “LIQUIDFUEL”, “ELECTRICCHARGE”, “MONOPROP”.

      -
      - -
      -
      -Resource:AMOUNT
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      The value of how much resource is left.

      -
      - -
      -
      -Resource:CAPACITY
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      What AMOUNT would be if the resource was filled to the top.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      PartModule

      -

      Next topic

      -

      Sensor

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/sensor.html b/structures/vessels/sensor.html deleted file mode 100644 index 983b42e0a..000000000 --- a/structures/vessels/sensor.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - Sensor — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Sensor

      -

      The type of structures returned by LIST SENSORS IN SOMEVARIABLE. This is not fully understood because the type of PartModule in the KSP API called ModuleEnviroSensor, which all Sensors are a kind of, is not well documented. Here is an example of using Sensor:

      -
      PRINT "Full Sensor Dump:".
      -LIST SENSORS IN SENSELIST.
      -
      -// TURN EVERY SINGLE SENSOR ON
      -FOR S IN SENSELIST {
      -  PRINT "SENSOR: " + S:TYPE.
      -  PRINT "VALUE:  " + S:READOUT.
      -  IF S:ACTIVE {
      -    PRINT "     SENSOR IS ALREADY ON.".
      -  } ELSE {
      -    PRINT "     SENSOR WAS OFF.  TURNING IT ON.".
      -    S:TOGGLE().
      -  }
      -}
      -
      -
      -
      -
      -structure Sensor
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      All suffixes of Part Sensor objects are a type of Part
      ACTIVEbooleanCheck if this sensor is active
      TYPE  
      READOUTvariesValue of the readout
      POWERCONSUMPTIONscalarRate of required electric charge
      TOGGLE() Call to activate/deactivate
      -
      - -
      -

      Note

      -

      A Sensor is a type of Part, and therefore can use all the suffixes of Part.

      -
      -
      -
      -Sensor:ACTIVE
      -
      --- - - - - - -
      Access:Get only
      Type:boolean
      -

      True of the sensor is enabled. Can SET to cause the sensor to activate or de-activate.

      -
      - -
      -
      -Sensor:TYPE
      -
      --- - - - -
      Access:Get only
      -
      - -
      -
      -Sensor:READOUT
      -
      --- - - - - - -
      Access:Get only
      Type:varies (usually scalar)
      -

      The value of the sensor’s readout, usually a double.

      -
      - -
      -
      -Sensor:POWERCONSUMPTION
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      The rate at which this sensor drains ElectricCharge.

      -
      - -
      -
      -Sensor:TOGGLE()
      -

      Call this method to cause the sensor to switch between active and deactivated or visa versa.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Resource

      -

      Next topic

      -

      Vessel

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/vessel.html b/structures/vessels/vessel.html deleted file mode 100644 index 3a1057851..000000000 --- a/structures/vessels/vessel.html +++ /dev/null @@ -1,705 +0,0 @@ - - - - - - - - Vessel — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Vessel

      -

      All vessels share a structure. To get a variable referring to any vessel you can do this:

      -
      // Get a vessel by it's name.
      -// The name is Case Sensitive.
      -SET MY_VESS TO VESSEL("Some Ship Name").
      -
      -// Save the current vessel in a variable,
      -// in case the current vessel changes.
      -SET MY_VESS TO SHIP.
      -
      -// Save the target vessel in a variable,
      -// in case the target vessel changes.
      -SET MY_VESS TO TARGET.
      -
      -
      -
      -

      Note

      -
      -

      New in version 0.13: A vessel is now a type of Orbitable. Much of what a Vessel can do can now by done by any orbitable object. The documentation for those abilities has been moved to the orbitable page.

      -
      -
      -
      -
      -structure Vessel
      -
      ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SuffixTypeDescription
      Every suffix of Orbitable
      CONTROLControlRaw flight controls
      BEARINGscalar (deg)relative heading to this vessel
      HEADINGscalar (deg)Absolute heading to this vessel
      MAXTHRUSTscalarSum of active maximum thrusts
      FACINGDirectionThe way the vessel is pointed
      MASSscalar (metric tons)Mass of the ship
      VERTICALSPEEDscalar (m/s)How fast the ship is moving “up”
      SURFACESPEEDscalar (m/s)How fast the ship is moving “horizontally”
      AIRSPEEDscalar (m/s)How fast the ship is moving relative to the air
      TERMVELOCITYscalar (m/s)terminal velocity of the vessel
      VESSELNAMEstringThe name of the vessel
      ANGULARMOMENTUMVectorIn SHIP_RAW
      ANGULARVELVectorIn SHIP_RAW
      SENSORSVesselSensorsSensor data
      LOADEDBooleanloaded into KSP physics engine or “on rails”
      PATCHESListOrbit patches
      ROOTPARTPartRoot Part of this vessel
      PARTSListall Parts
      PARTSNAMED(name)ListParts by NAME
      PARTSTITLED(title)ListParts by TITLE
      PARTSTAGGED(tag)ListParts by TAG
      PARTSDUBBED(name)ListParts by NAME, TITLE or TAG
      MODULESNAMED(name)ListPartModules by NAME
      PARTSINGROUP(group)ListParts by action group
      MODULESINGROUP(group)ListPartModules by action group
      ALLPARTSTAGGED()ListParts that have non-blank nametags
      -
      - -
      -
      -Vessel:CONTROL
      -
      --- - - - - - -
      Type:Control
      Access:Get only
      -

      The structure representing the raw flight controls for the vessel.

      -
      - -
      -
      -Vessel:BEARING
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      relative compass heading (degrees) to this vessel from the CPU Vessel, taking into account the CPU Vessel’s own heading.

      -
      - -
      -
      -Vessel:HEADING
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      absolute compass heading (degrees) to this vessel from the CPU Vessel

      -
      - -
      -
      -Vessel:MAXTHRUST
      -
      --- - - - - - -
      Type:scalar
      Access:Get only
      -

      Sum of all the Max thrust of all the currently active engines In Kilonewtons.

      -
      - -
      -
      -Vessel:FACING
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      The way the vessel is pointed.

      -
      - -
      -
      -Vessel:MASS
      -
      --- - - - - - -
      Type:scalar (metric tons)
      Access:Get only
      -

      The mass of the ship

      -
      - -
      -
      -Vessel:VERTICALSPEED
      -
      --- - - - - - -
      Type:scalar (m/s)
      Access:Get only
      -

      How fast the ship is moving. in the “up” direction relative to the SOI Body’s sea level surface.

      -
      - -
      -
      -Vessel:SURFACESPEED
      -
      --- - - - - - -
      Type:scalar (m/s)
      Access:Get only
      -

      How fast the ship is moving in the plane horizontal to the SOI body’s sea level surface.

      -
      - -
      -
      -Vessel:AIRSPEED
      -
      --- - - - - - -
      Type:scalar (m/s)
      Access:Get only
      -

      How fast the ship is moving relative to the air. KSP models atmosphere as simply a solid block of air “glued” to the planet surface (the weather on Kerbin is boring and there’s no wind). Therefore airspeed is generally the same thing as as the magnitude of the surface velocity.

      -
      - -
      -
      -Vessel:TERMVELOCITY
      -
      --- - - - - - -
      Type:scalar (m/s)
      Access:Get only
      -

      terminal velocity of the vessel in freefall through atmosphere, based on the vessel’s current altitude above sea level, and its drag properties. Warning, can cause values of Infinity if used in a vacuum, and kOS sometimes does not let you store Infinity in a variable.

      -
      - -
      -
      -Vessel:VESSELNAME
      -
      --- - - - - - -
      Type:string
      Access:Get only
      -

      The name of the vessel as it appears in the tracking station.

      -
      - -
      -
      -Vessel:ANGULARMOMENTUM
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      Given in SHIP_RAW reference frame. As of kOS 0.15.4 this has been changed to a vector, as it should have been all along. The vector represents the axis of the rotation, and its magnitude is the angular momentum of the rotation, which varies not only with the speed of the rotation, but also with the angular inertia of the vessel.

      -
      - -
      -
      -Vessel:ANGULARVEL
      -
      --- - - - - - -
      Type:Direction
      Access:Get only
      -

      Given in SHIP_RAW reference frame. As of kOS 0.15.4 this has been changed to a vector, as it should have been all along. The vector represents the axis of the rotation, and its magnitude is the speed of that rotation (Presumably in degrees per second? This is not documented in the KSP API and may take some experimentation to discover if it’s radians or degrees).

      -
      - -
      -
      -Vessel:SENSORS
      -
      --- - - - - - -
      Type:VesselSensors
      Access:Get only
      -

      Structure holding summary information of sensor data for the vessel

      -
      - -
      -
      -Vessel:LOADED
      -
      --- - - - - - -
      Type:Boolean
      Access:Get only
      -

      true if the vessel is fully loaded into the complete KSP physics engine (false if it’s “on rails”).

      -
      - -
      -
      -Vessel:PATCHES
      -
      --- - - - - - -
      Type:List
      Access:Get only
      -

      The list of orbit patches that describe this vessel’s current travel path based on momentum alone with no thrusting changes. If the current path has no transitions to other bodies, then this will be a list of only one orbit. If the current path intersects other bodies, then this will be a list describing the transitions into and out of the intersecting body’s sphere of influence. SHIP:PATCHES[0] is always exactly the same as SHIP:OBT, SHIP:PATCHES[1] is the same as SHIP:OBT:NEXTPATCH, SHIP:PATCHES[2] is the same as SHIP:OBT:NEXTPATCH:NEXTPATCH, and so on. Note that you will only see as far into the future as your KSP settings allow. (See the setting CONIC_PATCH_LIMIT in your settings.cfg file)

      -
      - -
      -
      -Vessel:ROOTPART
      -
      --- - - - - - -
      Type:Part
      Access:Get only
      -

      The first part that was used to begin the ship design - the command core. Vessels in KSP are built in a tree-structure, and the first part that was placed is the root of that tree.

      -
      - -
      -
      -Vessel:PARTS
      -
      --- - - - - - -
      Type:List of Part objects
      Access:Get only
      -

      A List of all the parts on the vessel. SET FOO TO SHIP:PARTS has exactly the same effect as LIST PARTS IN FOO. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:PARTSNAMED(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the parts
      • -
      -
      Returns:

      List of Part objects

      -
      -

      Part:NAME. The matching is done case-insensitively. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:PARTSTITLED(title)
      -
      --- - - - - - -
      Parameters:
        -
      • title – (string) Title of the parts
      • -
      -
      Returns:

      List of Part objects

      -
      -

      Part:TITLE. The matching is done case-insensitively. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:PARTSTAGGED(tag)
      -
      --- - - - - - -
      Parameters:
        -
      • tag – (string) Tag of the parts
      • -
      -
      Returns:

      List of Part objects

      -
      -

      Part:TAG value. The matching is done case-insensitively. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:PARTSDUBBED(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) name, title or tag of the parts
      • -
      -
      Returns:

      List of Part objects

      -
      -

      name regardless of whether that name is the Part:Name, the Part:Tag, or the Part:Title. It is effectively the distinct union of :PARTSNAMED(val), :PARTSTITLED(val), :PARTSTAGGED(val). The matching is done case-insensitively. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:MODULESNAMED(name)
      -
      --- - - - - - -
      Parameters:
        -
      • name – (string) Name of the part modules
      • -
      -
      Returns:

      List of PartModule objects

      -
      -

      match the given name. The matching is done case-insensitively. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:PARTSINGROUP(group)
      -
      --- - - - - - -
      Parameters:
        -
      • group – (integer) the action group number
      • -
      -
      Returns:

      List of Part objects

      -
      -

      one action triggered by the given action group. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:MODULESINGROUP(group)
      -
      --- - - - - - -
      Parameters:
        -
      • group – (integer) the action group number
      • -
      -
      Returns:

      List of PartModule objects

      -
      -

      have at least one action triggered by the given action group. For more information, see ship parts and modules

      -
      - -
      -
      -Vessel:ALLPARTSTAGGED()
      -
      --- - - - -
      Returns:List of Part objects
      -

      nametag on them of any sort that is nonblank. For more information, see ship parts and modules

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Sensor

      -

      Next topic

      -

      VesselSensors

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/structures/vessels/vesselsensors.html b/structures/vessels/vesselsensors.html deleted file mode 100644 index b9039d372..000000000 --- a/structures/vessels/vesselsensors.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - VesselSensors — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      VesselSensors

      -

      When you ask a Vessel to tell you its Vessel:SENSORS suffix, it returns an object of this type. It is a snapshot of sensor data taken at the moment the sensor reading was requested.

      -
      -

      Note

      -

      These values are only enabled if you have the proper type of sensor on board the vessel. If you don’t have a thermometer, for example, then the :TEMP suffix will always read zero.

      -
      -

      If you store this in a variable and wait, the numbers are frozen in time and won’t change as the vessel’s condition changes.

      -
      -
      -structure VesselSensors
      -
      -

      Warning

      -

      BUG

      -

      This information is currenlty being read from the Active Vessel even when the Active Vessel is not the CPU Vessel. This comment will be removed when that bug is fixed.

      -
      - - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Members
      SuffixTypeDescription
      ACCVectorAcceleration experienced by the Vessel
      PRESscalarAtmospheric Pressure outside this Vessel
      TEMPscalarTemperature outside this Vessel
      GRAVVector (g’s)Gravitational acceleration
      LIGHTscalarSun exposure on the solar panels of this Vessel
      -
      - -
      -
      -VesselSensors:ACC
      -
      --- - - - - - -
      Access:Get only
      Type:Vector
      -

      Accelleration the vessel is undergoing. A combination of both the gravitational pull and the engine thrust.

      -
      - -
      -
      -VesselSensors:PRES
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      The current pressure of this ship.

      -
      - -
      -
      -VesselSensors:TEMP
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      The current temperature.

      -
      - -
      -
      -VesselSensors:GRAV
      -
      --- - - - - - -
      Access:Get only
      Type:Vector
      -

      Magnitude and direction of gravity acceleration where the vessel currently is. Magnitude is expressed in “G“‘s (multiples of 9.802 m/s^2).

      -
      - -
      -
      -VesselSensors:LIGHT
      -
      --- - - - - - -
      Access:Get only
      Type:scalar
      -

      The total amount of sun exposure that exists here - only readable if there are solar panels on the vessel.

      -
      - -
      - - -
      -
      -
      -
      -
      -

      Previous topic

      -

      Vessel

      -

      Next topic

      -

      Configurations and Miscellany

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/tutorials.html b/tutorials.html deleted file mode 100644 index 5327bc02a..000000000 --- a/tutorials.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - Tutorials — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Tutorials

      -

      If you prefer the tutorial style of explanation, please see the following examples that walk you through examples:

      -
      -
      -
      -

      Introductory

      -
      -
      Quick Start Tutorial
      -
      Walks you through the beginnings of making a beginner’s ship launcher script.
      -
      -
      -
      -

      Intermediate

      -
      -
      Design Patterns Tutorial
      -
      Discusses some general aspects of kOS flow control and optimizations.
      -
      PID Loop Tutorial
      -
      Starts with a basic proportional feedback loop and develops, in stages, a complete PID-loop to control the throttle of a simple rocket design.
      -
      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Welcome to the kOS Documentation Website!

      -

      Next topic

      -

      Quick Start Tutorial

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/tutorials/designpatterns.html b/tutorials/designpatterns.html deleted file mode 100644 index dc6e22eb7..000000000 --- a/tutorials/designpatterns.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - Design Patterns and Considerations with kOS — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Design Patterns and Considerations with kOS

      -

      There are many ways one can write a control program for a given scenario. The goal of this section is to help a novice kOS programmer, after having finished the Quick Start Tutorial, to develop a sense of elegance and capability when writing his or her own kOS scripts. All of the examples in this tutorial may be tested by the reader using a rocket design similar to the following. Notice it carries an accelerometer and the negative gravioli detector which are used in the second section. Don’t forget the kOS module as well!

      -
      -../_images/designpatterns_rocket.png -
      - -
      -

      The Major Design Patterns of kOS Control Programs

      -

      The design of a program is usually determined by the flow-control statements used. I.e., the WHEN/THEN, ON, WAIT, UNTIL, IF and FOR constructs. Here is a list of the major styles of control programs that can be written in kOS:

      -
        -
      1. Sequential
      2. -
      3. Loops with Condition Checking
      4. -
      5. Loops with Triggers
      6. -
      -

      Of course, one style does not fit all scenarios and the programmer will typically want to use a combination of these all at once. Also, there may be other design patterns not listed here which can be perfectly valid, but this is a start.

      -
      -

      1. Sequential Programs

      -

      These are programs that rely almost exclusively on WAIT UNTIL statements to go from one phase to the next.

      -
      LOCK STEERING TO HEADING(0,90).
      -LOCK THROTTLE TO 1.
      -STAGE.
      -WAIT UNTIL SHIP:ALTITUDE > 10000.
      -LOCK STEERING TO HEADING(0,90) + R(0,-45,0).
      -WAIT UNTIL STAGE:LIQUIDFUEL < 0.1.
      -STAGE.
      -WAIT UNTIL SHIP:ALTITUDE > 20000.
      -LOCK THROTTLE TO 0.
      -WAIT UNTIL FALSE. // CTRL+C to break out
      -
      -
      -

      This example will take a two stage rocket up to 20km. The immediate thing to notice is that the programmer must have known that the first stage would cutoff between 10km and 20km. This is fine for a specific rocket but not too general and could end in disaster if the first stage cutoff occurs at say 5km. Certainly, one can write a program using this technique to take a specific rocket, put it into orbit and even perform a lot of fancy maneuvers, but adapting the code to different rockets may get complicated quickly.

      -
      -
      -

      2. Loops with Condition Checking

      -

      Here, we introduce IF/ELSE logic into UNTIL loops:

      -
      LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -LOCK THROTTLE TO 1.
      -STAGE.
      -UNTIL SHIP:ALTITUDE > 20000 {
      -    IF SHIP:ALTITUDE > 10000 {
      -        LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
      -    }
      -    IF STAGE:LIQUIDFUEL < 0.1 {
      -        STAGE.
      -    }
      -}
      -LOCK THROTTLE TO 0.
      -WAIT UNTIL FALSE.
      -
      -
      -

      This does the same thing as the previous example, but now it’s checking for a staging condition from the launch pad all the way to 20km. More than that, it will stage as many times as needed.

      -

      One can imagine that these types of UNTIL loops can become very complex with many layers of IF/ELSE blocks. Once this happens it is usually good to reduce the frequency of the loop by adding a WAIT statement at the end of the loop. This wait could be anywhere from 0.001 (every physics tick), to 60 (every minute) or even longer for inter-planetary transfers if desired.

      -
      -
      -

      3. Loops with Triggers

      -

      In the above example, once the rocket reaches 10km, the steering is constantly being re-locked to HEADING(90,45). This works, but it only needs to be locked once. A possible improvement is to set up a trigger using a WHEN/THEN statement:

      -
      LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -LOCK THROTTLE TO 1.
      -STAGE.
      -WHEN SHIP:ALTITUDE > 10000 THEN {
      -    LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
      -}
      -UNTIL SHIP:ALTITUDE > 20000 {
      -    IF STAGE:LIQUIDFUEL < 0.1 {
      -        STAGE.
      -    }
      -}
      -LOCK THROTTLE TO 0.
      -WAIT UNTIL FALSE.
      -
      -
      -

      Now, when the rocket reaches 10km, the steering is set once and the trigger is removed from the active list of triggers. The staging condition can also be promoted to a trigger, keeping the trigger active after every stage using the PRESERVE keyword:

      -
      WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -    STAGE.
      -    PRESERVE.
      -}
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -LOCK THROTTLE TO 1.
      -STAGE.
      -WHEN SHIP:ALTITUDE > 10000 THEN {
      -    LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
      -}
      -WAIT UNTIL SHIP:ALTITUDE > 20000.
      -LOCK THROTTLE TO 0.
      -WAIT UNTIL FALSE.
      -
      -
      -

      Notice that the UNTIL loop was changed to a WAIT UNTIL statement since the program is small and all the logic of the triggers can be handled in a reasonable amount of time - there will be more on this topic later.

      -
      -
      -

      Bringing It All Together

      -

      Typically, the programmer will find all of these constructs are useful at the same time and kOS scripts will naturally contain some sequential parts in combination with long-term and short-term triggers which can modify states in complex loops of varying frequency. If you didn’t follow that bit of gobbledygook, don’t worry. The next section will discuss a few recommendations for beginning kOS programmers to follow when setting up any program.

      -
      -
      -
      -

      General Guidelines for kOS Scripts

      -

      This section discusses two general guidelines to follow when starting out with more complicated kOS scripts. These are not meant to be absolute and there will certainly be cases when they can be stretched, though one should never totally ignore them.

      -
      -

      1. Minimize Time Spent in WHEN/THEN Blocks

      -

      Remember that WAIT statements are ignored when inside WHEN/THEN blocks. It is OK to loop over small lists (engines for example), but don’t let it get out of hand. The WHEN/THEN construct was designed to accommodate quick bits of code. Consider this bit of (non-working) code which tries to adjust the throttle based on the g-force as measured by a combination of the accelerometer and the negative gravioli detector:

      -
      SET thrott TO 1.
      -LOCK THROTTLE TO thrott.
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -STAGE.
      -WHEN SHIP:ALTITUDE > 1000 THEN {
      -    SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -    LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -    LOCK gforce TO accvec:MAG / g.
      -    LOCK dthrott TO 0.05 * (1.2 - gforce).
      -
      -    UNTIL SHIP:ALTITUDE > 40000 {
      -        WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -            STAGE.
      -            PRESERVE.
      -        }
      -        SET thrott to thrott + dthrott.
      -        WAIT 0.1.
      -    }
      -}
      -
      -
      -

      This looks reasonable. The throttle is set to maximum until 1km is reached at which point the throttle is adjusted every 0.1 seconds. If the gforce is off from the value of 1.2, then the throttle is either increased or decreased by a small amount. Running this on a test rocket merely produce the message “Program ended.”

      -

      Understanding why this does not work is important. Everything in a WHEN/THEN block is expected to complete in the current physics tick, but here we have a loop that is supposed to last until the ship reaches 40km. This example can be reworked by separating the triggers from the loop. The staging trigger was separated from the UNTIL loop as well - not strictly necessary, but recommended form:

      -
      WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -    STAGE.
      -    PRESERVE.
      -}
      -SET thrott TO 1.
      -SET dthrott TO 0.
      -LOCK THROTTLE TO thrott.
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -STAGE.
      -WHEN SHIP:ALTITUDE > 1000 THEN {
      -    SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -    LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -    LOCK gforce TO accvec:MAG / g.
      -    LOCK dthrott TO 0.05 * (1.2 - gforce).
      -}
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET thrott to thrott + dthrott.
      -    WAIT 0.1.
      -}
      -
      -
      -

      Now this program should work. The variable dthrott had to be set to 0 in the beginning so that the throttle is kept at maximum until 1km, the UNTIL loop operates every 0.1 seconds, and the WHEN/THEN triggers are run only once when the condition is met. The take-away from this example is to keep WHEN/THEN blocks separate from UNTIL loops. Specifically, never put an UNTIL loop inside a WHEN/THEN block and it should be extremely rare to put a WHEN/THEN statement inside an UNTIL loop.

      -

      Finally, as a bit of foreshadowing, this bit of code is actually a “proportional feedback loop.” From an altitude of 1km up to 40km, the total g-force exerted on the ship is kept near 1.2 by constantly adjusting the throttle. The value of 1.2 is called the “setpoint,” the measured g-force is called the “process variable,” and the mystical 0.05 is called the “proportional gain.” Please take a look at the PID Loop Tutorial which takes this script as a starting point and develops a full PID-loop in kOS.

      -
      -
      -

      2. Minimize Trigger Conditions

      -

      There is a lot of power in developing multi-level LOCK variables in combination with WHEN/THEN triggers. However, it can be easy to hit kOS’s hard limit in the number of operations allowed for trigger checking. This will happen when several WHEN/THEN triggers are dependent on the same complex LOCK variable. This results in the LOCK variable being calculated multiple times every update. If the LOCK is deep enough, the calculations become too expensive to do and kOS stops executing and complains.

      -

      With this in mind, consider an extension of the example script in the previous section. This time, the g-force setpoint changes as the rocket climbs through 10km, 20km and 30km:

      -
      WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -    STAGE.
      -    PRESERVE.
      -}
      -SET thrott TO 1.
      -SET dthrott TO 0.
      -LOCK THROTTLE TO thrott.
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -STAGE.
      -WHEN SHIP:ALTITUDE > 1000 THEN {
      -    SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -    LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -    LOCK gforce TO accvec:MAG / g.
      -    LOCK dthrott TO 0.05 * (1.2 - gforce).
      -}
      -WHEN SHIP:ALTITUDE > 10000 THEN {
      -    LOCK dthrott TO 0.05 * (2.0 - gforce).
      -}
      -WHEN SHIP:ALTITUDE > 20000 THEN {
      -    LOCK dthrott TO 0.05 * (4.0 - gforce).
      -}
      -WHEN SHIP:ALTITUDE > 30000 THEN {
      -    LOCK dthrott TO 0.05 * (5.0 - gforce).
      -}
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET thrott to thrott + dthrott.
      -    WAIT 0.1.
      -}
      -
      -
      -

      This example does what is expected of it without problems. But the ship’s altitude is being checked at least five times for every update, including the UNTIL loop check. Certaintly, the kOS CPU can keep up with this, however, one can imagine a whole series of WHEN/THEN statements which make use of complicated calculations based on atmospheric data or orbital mechanics. One way to minimize the trigger condition checking is to take strictly-sequential triggers and nest them:

      -
      WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -    STAGE.
      -    PRESERVE.
      -}
      -SET thrott TO 1.
      -SET dthrott TO 0.
      -LOCK THROTTLE TO thrott.
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -STAGE.
      -WHEN SHIP:ALTITUDE > 1000 THEN {
      -    SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -    LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -    LOCK gforce TO accvec:MAG / g.
      -    LOCK dthrott TO 0.05 * (1.2 - gforce).
      -
      -    WHEN SHIP:ALTITUDE > 10000 THEN {
      -        LOCK dthrott TO 0.05 * (2.0 - gforce).
      -
      -        WHEN SHIP:ALTITUDE > 20000 THEN {
      -            LOCK dthrott TO 0.05 * (4.0 - gforce).
      -
      -            WHEN SHIP:ALTITUDE > 30000 THEN {
      -                LOCK dthrott TO 0.05 * (5.0 - gforce).
      -            }
      -        }
      -    }
      -}
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET thrott to thrott + dthrott.
      -    WAIT 0.1.
      -}
      -
      -
      -

      Now this is quite elegant! The number of triggers have been reduced to two per update for the entire running of this script. The trigger at 1km sets up the next trigger which will happen at 10km which sets up then next at 20km and so on. This can save a lot of processing time for triggers that will happen sequentially. As a general rule, one should try to nest WHEN/THEN statements whenever possible. Again, both examples above will work, but when scripts start to have deep and complicated triggers, this nested construct can save it from the dreaded kOS trigger limit.

      -
      -
      -
      - - -
      -
      -
      - -
      -
      - - - - \ No newline at end of file diff --git a/tutorials/pidloops.html b/tutorials/pidloops.html deleted file mode 100644 index 32d967dbe..000000000 --- a/tutorials/pidloops.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - PID Loops in kOS — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      PID Loops in kOS

      -

      This tutorial covers how one can implement a PID loop using kOS. A P-loop, or “proportional feedback loop” was already introduced in the second section of the Design Patterns Tutorial, and that will serve as our starting point. After some code rearrangement, the integral and derivative terms will be added and discussed in turn. Next, a couple extra features will be added to the full PID-loop. Lastly, we’ll show a case-study in tuning a full PID loop using the Ziegler-Nichols method. We’ll use the LOG method to dump telemetry from KSP into a file and our favorite graphing software to visualize the data.

      -

      The code examples in this tutorial can be tested with a similar rocket design as shown. Do not forget the accelerometer, gravioli detector or the kOS CPU module. The engine is purposefully overpowered to demonstrate the feedback in action.

      -
      -../_images/pidtune_rocket_design_maxtwr8.png -
      -

      Those fuel-tank adapters are from the Modular Rocket Systems (MRS) addon, but stock tanks will work just fine. The design goal of this rocket is to have a TWR of 8 on the launchpad and enough fuel to make it past 30km when throttled for optimal atmospheric efficiency.

      - -
      -

      Proportional Feedback Loop (P-loop)

      -

      The example code from the Design Patterns Tutorial, with some slight modifications looks like the following:

      -
      // staging, throttle, steering, go
      -WHEN STAGE:LIQUIDFUEL < 0.1 THEN {
      -    STAGE.
      -    PRESERVE.
      -}
      -LOCK THROTTLE TO 1.
      -LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
      -STAGE.
      -WAIT UNTIL SHIP:ALTITUDE > 1000.
      -
      -// P-loop setup
      -SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -LOCK gforce TO accvec:MAG / g.
      -LOCK dthrott TO 0.05 * (1.2 - gforce).
      -
      -SET thrott TO 1.
      -LOCK THROTTLE to thrott.
      -
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET thrott to thrott + dthrott.
      -    WAIT 0.1.
      -}
      -
      -
      -

      The first several lines sets up a simple staging condition, puts the throttle to maximum, steers the rocket straight up and launches. The rocket is assumed to use only liquid fuel engines. After the rocket hits 1km, the script sets up the LOCK used in the P-loop which is updated every 0.1 seconds in the UNTIL loop. The use of LOCK variables makes this code fairly clean. When the script comes up to the first line in the UNTIL loop, i.e. “SET thrott TO thrott + dthrott.”, the variable dthrott is evaluated which causes the LOCK on gforce to be evaluated which in-turn causes accvec to be evaluated.

      -

      The input to this feedback loop is the acceleration experienced by the ship (gforce) in terms of Kerbin’s gravitational acceleration at sea level (g). The variable accvec is the total acceleration vector and is obtained by the accelerometer and gravioli detectors, both of which must be on the ship for this to work. The variable dthrott is the change in throttle that should be applied in a single iteration of the feedback loop.

      -

      In terms of a PID loop, the factor 1.2 is called the setpoint, gforce is the process variable and 0.05 is called the proportional gain. The setpoint and gain factors can be promoted to their own variables with names. Also, the code up to and including the “WAIT UNTIL SHIP:ALTITUDE > 1000.” will be implied for the next few examples of code:

      -
      // P-loop
      -SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -LOCK gforce TO accvec:MAG / g.
      -
      -SET gforce_setpoint TO 1.2.
      -SET Kp TO 0.05.
      -LOCK dthrott TO Kp * (gforce_setpoint - gforce).
      -
      -SET thrott TO 1.
      -LOCK THROTTLE to thrott.
      -
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET thrott to thrott + dthrott.
      -    WAIT 0.1.
      -}
      -
      -
      -

      This is not a big change, but it will set us up to include the integral and derivative terms in the next section.

      -
      -
      -

      Proportional-Integral Feedback Loop (PI-loop)

      -

      Adding the integral term requires us to keep track of time. This is done by introducing a variable (t0) to store the time of the last iteration. Now, the throttle is changed only on iterations where some time has elapsed so the WAIT time in the UNTIL can be brought to 0.001. The offset of the gforce has been set to the variable P, and the integral gain to Ki.

      -
      // PI-loop
      -SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -LOCK gforce TO accvec:MAG / g.
      -
      -SET gforce_setpoint TO 1.2.
      -
      -LOCK P TO gforce_setpoint - gforce.
      -SET I TO 0.
      -
      -SET Kp TO 0.01.
      -SET Ki TO 0.006.
      -
      -LOCK dthrott TO Kp * P + Ki * I.
      -
      -SET thrott TO 1.
      -LOCK THROTTLE to thrott.
      -
      -SET t0 TO TIME:SECONDS.
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET dt TO TIME:SECONDS - t0.
      -    IF dt > 0 {
      -        SET I TO I + P * dt.
      -        SET thrott to thrott + dthrott.
      -        SET t0 TO TIME:SECONDS.
      -    }
      -    WAIT 0.001.
      -}
      -
      -
      -

      Adding the integral term has the general effect of stabilizing the feedback loop, making it less prone to oscillating due to rapid changes in the process variable (gforce, in this case). This is usually at the expense of a longer settling time.

      -
      -
      -

      Proportional-Integral-Derivative Feedback Loop (PID-loop)

      -

      Incorporating the derivative term (D) and derivative gain (Kd) requires an additional variable (P0) to keep track of the previous value of the proportional term (P).

      -
      // PID-loop
      -SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -LOCK gforce TO accvec:MAG / g.
      -
      -SET gforce_setpoint TO 1.2.
      -
      -LOCK P TO gforce_setpoint - gforce.
      -SET I TO 0.
      -SET D TO 0.
      -SET P0 TO P.
      -
      -SET Kp TO 0.01.
      -SET Ki TO 0.006.
      -SET Kd TO 0.006.
      -
      -LOCK dthrott TO Kp * P + Ki * I + Kd * D.
      -
      -SET thrott TO 1.
      -LOCK THROTTLE to thrott.
      -
      -SET t0 TO TIME:SECONDS.
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET dt TO TIME:SECONDS - t0.
      -    IF dt > 0 {
      -        SET I TO I + P * dt.
      -        SET D TO (P - P0) / dt.
      -        SET thrott to thrott + dthrott.
      -        SET P0 TO P.
      -        SET t0 TO TIME:SECONDS.
      -    }
      -    WAIT 0.001.
      -}
      -
      -
      -

      When tuned properly, the derivative term will cause the PID-loop to act quickly without causing problematic oscillations. Later in this tutorial, we will cover a way to tune a PID-loop using only the proportional term called the Zieger-Nichols method.

      -
      -
      -

      Final Touches

      -

      There are a few modifications that can make PID loops very robust. The following code example adds three range limits:

      -
        -
      1. bounds on the Integral term which addresses possible integral windup
      2. -
      3. bounds on the throttle since it must stay in the range 0 to 1
      4. -
      5. a deadband to avoid changing the throttle due to small fluctuations
      6. -
      -

      Of course, KSP is a simulator and small fluctuations are not observed in this particular loop. Indeed, the P-loop is sufficient in this example, but all these features are included here for illustration purposes and they could become useful for unstable aircraft or untested scenarios.

      -
      // PID-loop
      -SET g TO KERBIN:MU / KERBIN:RADIUS^2.
      -LOCK accvec TO SHIP:SENSORS:ACC - SHIP:SENSORS:GRAV.
      -LOCK gforce TO accvec:MAG / g.
      -
      -SET gforce_setpoint TO 1.2.
      -
      -LOCK P TO gforce_setpoint - gforce.
      -SET I TO 0.
      -SET D TO 0.
      -SET P0 TO P.
      -
      -LOCK in_deadband TO ABS(P) < 0.01.
      -
      -SET Kp TO 0.01.
      -SET Ki TO 0.006.
      -SET Kd TO 0.006.
      -
      -LOCK dthrott TO Kp * P + Ki * I + Kd * D.
      -
      -SET thrott TO 1.
      -LOCK THROTTLE to thrott.
      -
      -SET t0 TO TIME:SECONDS.
      -UNTIL SHIP:ALTITUDE > 40000 {
      -    SET dt TO TIME:SECONDS - t0.
      -    IF dt > 0 {
      -        IF NOT in_deadband {
      -            SET I TO I + P * dt.
      -            SET D TO (P - P0) / dt.
      -
      -            // If Ki is non-zero, then limit Ki*I to [-1,1]
      -            IF Ki > 0 {
      -                SET I TO MIN(1.0/Ki, MAX(-1.0/Ki, I)).
      -            }
      -
      -            // set throttle but keep in range [0,1]
      -            SET thrott to MIN(1, MAX(0, thrott + dthrott)).
      -
      -            SET P0 TO P.
      -            SET t0 TO TIME:SECONDS.
      -        }
      -    }
      -    WAIT 0.001.
      -}
      -
      -
      -
      -
      -

      Tuning a PID-loop

      -

      We are going to start with the same rocket design we have been using so far and actually tune the PID-loop using the Ziegler-Nichols method. This is where we turn off the integral and derivative terms in the loop and bring the proportional gain (Kp) up from zero to the point where the loop causes a steady oscillation with a measured period (Tu). At this point, the proportional gain is called the “ultimate gain” (Ku) and the actual gains (Kp, Ki and Kd) are set according to this table taken from wikipedia:

      - ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Control TypeKpKiKd
      P0.5 Ku  
      PI0.45 Ku1.2 Kp / Tu 
      PD0.8 Ku Kp Tu / 8
      classic PID0.6 Ku2 Kp / TuKp Tu / 8
      Pessen Integral Rule0.7 Ku0.4 Kp / Tu0.15 Kp Tu
      some overshoot0.33 Ku2 Kp / TuKp Tu / 3
      no overshoot0.2 Ku2 Kp / TuKp Tu / 3
      -

      An immediate problem to overcome with this method is that it assumes a steady state can be achieved. With rockets, there is never a steady state: fuel is being consumed, altitude and therefore gravity and atmosphere is changing, staging can cause major upsets in the feedback loop. So, this tuning method will be some approximation which should come as no surprise since it will come from experimental observation. All we need is enough of a steady state that we can measure the oscillations - both the change in amplitude and the period.

      -

      The script we’ll use to tune the highly overpowered rocket shown will launch the rocket straight up (using SAS) and will log data to an output file until it reaches 30km at which point the log file will be copied to the archive and the program will terminate. Also, this time the feedback loop will be based on the more realistic “atmospheric efficiency.” The log file will contain three columns: time since launch, offset of atmospheric efficiency from the ideal (in this case, 1.0) and the ship’s maximum thrust. The maximum thrust will increase monotonically with time (this rocket has only one stage) and we’ll use both as the x-axis when plotting the offset on the y-axis.

      -
      DECLARE PARAMETER Kp.
      -
      -LOCK g TO SHIP:BODY:MU / (SHIP:BODY:RADIUS + SHIP:ALTITUDE)^2.
      -LOCK maxtwr TO SHIP:MAXTHRUST / (g * SHIP:MASS).
      -
      -// feedback based on atmospheric efficiency
      -LOCK surfspeed TO SHIP:VELOCITY:SURFACE:MAG.
      -LOCK atmoeff TO surfspeed / SHIP:TERMVELOCITY.
      -LOCK P TO 1.0 - atmoeff.
      -
      -SET t0 TO TIME:SECONDS.
      -LOCK dthrott TO Kp*P.
      -SET start_time TO t0.
      -
      -LOG "# Throttle PID Tuning" TO throttle_log.
      -LOG "# Kp: " + Kp TO throttle_log.
      -LOG "# t P maxtwr" TO throttle_log.
      -
      -LOCK logline TO (TIME:SECONDS - start_time)
      -        + " " + P
      -        + " " + maxtwr.
      -
      -SET thrott TO 1.
      -LOCK THROTTLE TO thrott.
      -SAS ON.
      -STAGE.
      -WAIT 3.
      -
      -UNTIL SHIP:ALTITUDE > 30000 {
      -    SET dt TO TIME:SECONDS - t0.
      -    IF dt > 0 {
      -        SET thrott TO MIN(1,MAX(0,thrott + dthrott)).
      -        SET t0 TO TIME:SECONDS.
      -        LOG logline TO throttle_log.
      -    }
      -    WAIT 0.001.
      -}
      -COPY throttle_log TO 0.
      -
      -
      -

      Give this script a short name, something like “tune.txt” so that running is simple:

      -
      copy tune from 0.
      -run tune(0.5).
      -
      -
      -

      After every launch completes, you’ll have to go into the archive directory and rename the output logfile. Something like “throttle_log.txt” –> “throttle.01.log” will help if you increment the index number each time. To analyze the data, plot the offset (P) as a function of time (t). Here, we show the results for three values of Kp: 0.002, 0.016 and 0.160, including the maximum TWR when Kp = 0.002 as the top x-axis. The maximum TWR dependence on time is different for the three values of Kp, but not by a lot.

      -
      -../_images/pidtune1.png -
      -

      The value of 0.002 is obviously too low. The settling time is well over 20 seconds and the loop can’t keep up with the increase in terminal velocity at the higher altitudes reached after one minute. When Kp = 0.016, the behavior is far more well behaved, and though some oscillation exists, it’s damped and slow with a period of about 10 seconds. At Kp = 0.160, the oscillations are prominent and we can start to measure the change in amplitude along with the period of the oscillations. This plot shows the data for Kp = 0.160 from 20 to 40 seconds after ignition. The peaks are found and are fit to a line.

      -
      -../_images/pidtune2.png -
      -

      This is done for each value of Kp and the slopes of the fitted lines are plotted as a function of Kp in the following plot:

      -
      -../_images/pidtune3.png -
      -

      The period of oscillation was averaged over the interval and plotted on top of the amplitude change over time. Notice the turn over that occurs when Kp reaches approximately 0.26. This will mark the “ultimate gain” and 3.1 seconds will be used as the associated period of oscillation. It is left as an exercise for the reader to implement a full PID-loop using the classic PID values (see table above): Kp = 0.156, Ki = 0.101, Kd = 0.060, producing this behavior:

      -
      -../_images/pidtune4.png -
      -

      As soon as the PID-loop was activated at 3 seconds after ignition, the throttle was cut. At approximately 7 seconds, the atmospheric efficiency dropped below 100% and the integral term started to climb back to zero. At 11 seconds, the engine was reignited and the feedback loop settled after about 20 seconds. The inset plot has the same axes as the parent and shows the long-term stability of the final PID-loop.

      -
      -
      -

      Final Thoughts

      -

      The classic PID values used above are fairly aggressive and there is some overshoot at the beginning. This can be dealt with in many ways and is discussed on the wikipedia page about PID controllers. For example, one might consider trying to implement a switch to a PD-loop when the integral term hits some limit, switching back once P crosses zero. The PID behavior should look like the following:

      -
      -../_images/pidtune5.png -
      -

      Finally, Controlling the throttle of a rocket is perhaps the easiest thing to implement as a PID loop in KSP using kOS. The steering was largely ignored and the orientation was always up. When writing an autopilot for horizontal atmospheric flight, one will have to deal with the direction the ship is traveling using SHIP:HEADING as well as it’s orientation with SHIP:FACING. Additionally, there are the SHIP:ROTATION and SHIP:TRANSLATION vectors which can tell you the rate of change of the ship’s facing and heading respectively. The controls in this case are six-dimensional using SHIP:CONTROL with YAW, PITCH, ROLL, FORE, STARBOARD, TOP and MAINTHROTTLE.

      -

      The PID gain parameters are dependent on the characteristics of the ship being controlled. The size, shape, turning capability and maximum TWR should be considered when tuning a PID loop. Turning RCS on can also have an effect and you might consider changing the PID loop’s gain parameters every time to switch them on or off.

      -
      -
      - - -
      -
      -
      -
      -
      -

      Table Of Contents

      - - -

      Previous topic

      -

      Design Patterns and Considerations with kOS

      -

      Next topic

      -

      General Topics

      -

      This Page

      - - - -
      -
      -
      -
      - - - - \ No newline at end of file diff --git a/tutorials/quickstart.html b/tutorials/quickstart.html deleted file mode 100644 index 095d31f73..000000000 --- a/tutorials/quickstart.html +++ /dev/null @@ -1,564 +0,0 @@ - - - - - - - - Quick Start Tutorial — kOS 0.15.3 documentation - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Quick Start Tutorial

      -

      This is a quick start guide for the Kerbal Operating System (kOS). It is intended for those who are just starting with using kOS. It does presume you have played Kerbal Space Program before and know the basics of how to fly a rocket under manual control. It does NOT assume you know a lot about computer programming, and it will walk you through some basic first steps.

      - -
      -

      First example: Hello World

      -

      In the grand tradition of programming tutorials, the first example will be how to make a script that does nothing more than print the words “Hello World” on the screen. The purpose of this example is to show where you should put the files, how to move them about, and how to get one to run on the vessel.

      -
      -

      Step 1: Start a new sandbox-mode game

      -

      (You can use kOS in a career mode game, but it requires a part that you have to research which isn’t available at the start of the tech tree, so this example will just use sandbox mode to keep it simple.)

      -
      -
      -

      Step 2: Make a vessel in the Vehicle Assembly Bay

      -

      Make the vessel contain any unmanned command core, a few hundred units of battery power, a means of recharging the battery such as a solar panel array, and the “Comptronix CX-4181 Scriptable Control System”. (From this point onward the CX-4181 Scriptable Control System part will be referred to by the acronym “SCS”.) The SCS part is located in the parts bin under the “Control” tab (the same place where RCS thrusters and Torque Wheels are found.)

      -
      -../_images/SCS_parts_bin.png -
      -
      -
      -

      Step 3: Put the vessel on the launchpad

      -

      Put the vessel on the launchpad. For this first example it doesn’t matter if the vessel can actually liftoff or even has engines at all.

      -
      -
      -

      Step 4: Invoke the terminal

      -

      Rightclick for the SCS part on the vessel and then click the button that says “Open Terminal”.

      -

      Note that if the terminal is semi-transparent, this means it’s not currently selected. If you click on the terminal, then your keyboard input is directed to the terminal INSTEAD of to piloting. In other words if you type W A S D, you’ll actually get the word “wasd” to appear on the terminal, rather than the W A S D keys steering the ship. To switch back to manual control of the game instead of typing into the terminal, click outside the terminal window anywhere on the background of the screen.

      -
      -
      -

      Step 5: See what an interactive command is like

      -

      You should now see an old-school looking text terminal like the one shown below. Type the line:

      -
      CLEARSCREEN. PRINT "==HELLO WORLD==".
      -
      -
      -

      into the terminal (make sure to actually type the periods (”.”) as shown) and hit ENTER. Note that you can type it in uppercase or lowercase. kOS doesn’t care.

      -
      -../_images/terminal_open_1.png -
      -

      The terminal will respond by showing you this:

      -
      -../_images/terminal_open_2.png -
      -
      -
      -

      Step 6: Okay that’s great, but how can you make that happen in a program script instead?

      -

      Like so: Enter this command:

      -
      EDIT HELLO.
      -
      -
      -

      (Don’t forget the period (”.”). All commands in kOS are ended with a period. Again, you can type it in uppercase or lowercase. kOS doesn’t care.)

      -

      You should see an editor window appear, looking something like this (without the text inside because you’re starting a blank new file):

      -
      -../_images/editor.png -
      -

      Type this text into the window:

      -
      PRINT "=========================================".
      -PRINT "      HELLO WORLD".
      -PRINT "THIS IS THE FIRST SCRIPT I WROTE IN kOS.".
      -PRINT "=========================================".
      -
      -
      -

      Click “Save” then “Exit” in the editor popup window.

      -
        -
      • Side Note: The editor font - Experienced programmers may have noticed that the editor’s font is proportional width rather than monospaced and that this is not ideal for programming work. You are right, but there is little that can be done about it for a variety of technical reasons that are too complex to go into right now.
      • -
      -

      Then on the main text terminal Enter:

      -
      RUN HELLO.
      -
      -
      -

      And you will see the program run, showing the text on the screen like so.

      -
      -../_images/hello_world1.png -
      -
      -
      -

      Step 7: Okay, but where is this program?

      -

      To see where the “HELLO” program has been saved, Issue the command LIST FILES like this:

      -
      LIST FILES.
      -
      -
      -

      (Note, that the default for the LIST command is to list FILES, so you can leave the word “FILES” off if you like.)

      -

      It should look like this, showing you the HELLO program you just wrote:

      -
      -../_images/hello_list.png -
      -

      This is a list of all the files on the currently selected VOLUME. By default, when you launch a new vessel, the currently selected VOLUME is called “1” and it’s the volume that’s stored on THAT SCS part that you are running all these commands in.

      -

      This is the local volume of that SCS part. Local volumes such at this tend to have very small limited storage, as you can see when you look at the space remaining in the list printout.

      -

      If you’re wondering where the file is stored physically on your computer, it’s represented by a section inside the persistence file for your saved game, as a piece of data associated with the SCS part. This is important because it means you can’t access the program from another vessel, and if this vessel ever crashes and the SCS part explodes, then you’ve lost the program.

      -
      -
      -

      Step 8: I don’t like the idea that the program is stored only on this vessel. Can’t I save it somewhere better? More permanent?

      -

      Yes. Yes you can.

      -

      There is another VOLUME that always exists called the Archive, which is also referred to as volume 0. (either name can be used in commands). The archive is conceptually stored somewhere back at Kerbin home base in the Space Center rather than on your vessel. It has infinite storage space, and does not disappear when your vessel is gone. ALSO, it actually exists across saved games - if you launch one saved game, put a new file in the Archive, and then later launch a different saved game, that file will be there in that game too.

      -

      To use the Archive, first we’ll have to introduce you to a new command, called SWITCH TO. The SWITCH TO command changes which VOLUME is the one that you are doing your work with.

      -

      To work with the archive, and create a second “hello world” file there, you issue these commands and see what they do:

      -
      SWITCH TO 0.
      -EDIT HELLO2. // Make a new file here that just says: PRINT "hi again".
      -LIST FILES.
      -RUN HELLO2.
      -SWITCH TO 1.
      -LIST FILES.
      -RUN HELLO.
      -
      -
      -

      But where is it stored behind the scenes? The archive is currently slightly violating the design of KSP mods that puts everything in the GameData folder. The kSP Archive is actually stored in the Ships/Script folder of your MAIN KSP home, not inside GameData.

      -

      If a file is stored inside the archive, it can actually be edited by an external text editor of your choice instead of using kOS‘s in-game editor. This is usually a much better practice once you start doing more complex things with kOS. You can also make new files in the archive folder. Just make sure that all the files end with a .ks file name suffix or kOS won’t use them.

      -

      Further reading about files and volumes:

      - -
      -
      -
      -

      Second Example: Doing something real

      -

      Okay that’s all basic setup stuff but you’re probably clamoring for a real example that actually does something nifty.

      -

      This example will show the crudest, most basic use of kOS just to get started. In this example we’ll make a program that will launch a vessel using progressively more and more complex checks. kOS can be used at any stage of a vessel’s flight - launching, circularizing, docking, landing,... and in fact launching is one of the simpler piloting tasks that you can do without much need of automation. Where kOS really shines is for writing scripts to do touchy sensitive tasks like landing or docking or hovering. These are the areas that can benefit from the faster reaction speed that a computer script can handle.

      -

      But in order to give you an example that you can start with from scratch, that’s easy to reload and retry from an initial point, we’ll use an example of launching.

      -
      -

      Step 1: Make a vessel

      -

      Make any sort of rocket that can lift you to orbit that fills the following pattern:

      -
        -
      • It uses ONLY liquid fuel rockets. The example code here will assume this is the case. kOS can deal with solid fuel boosters as well, but to keep the example simple we’ll use liquid fuel only here.
      • -
      • Make the vessel’s staging list set up in the right order for a launch. (Make sure it has no need to manually rightclick parts to stage things weirdly, and no need to use action groups to activate stages weirdly).
      • -
      • Make sure the vessel has plenty of torque power to stay steady without a lot of wobble.
      • -
      • Make the vessel have at least these parts on it:
      • -
      • battery power of at least 400 charge
      • -
      • ability to recharge equal to at least 6 solar panel sections or 1 RTG unit
      • -
      • the kOS SCS part somewhere in the stack, near the top bit where it won’t fall off due to staging.
      • -
      -
      -
      -

      Step 2: Make the start of the script

      -

      Okay, so type the lines below in an external text editor of your choice (i.e. Notepad on Windows, or TextEdit on Mac, or whatever you fancy):

      -
      // My First Launcher.
      -
      -SET countdown TO 10.
      -PRINT "Counting down:".
      -UNTIL countdown = 0 {
      -    PRINT "..." + countdown.
      -    SET countdown TO countdown - 1.
      -    WAIT 1. // pauses the script here for 1 second.
      -}
      -
      -
      -

      See those things with the two slashes (“//”)? Those are comments in the kerboscript language and they’re just ways to write things in the program that don’t do anything - they’re there for humans like you to read so you understand what’s going on. In these examples you never actually have to type in the things you see after the slashes. They’re there for your benefit when reading this document but you can leave them out if you wish.

      -

      Save the file in your Ships/Script folder of your KSP installation under the filename “hellolaunch.ks”. DO NOT save it anywhere under GameData/kOS/. Do NOT. According to the KSP standard, normally KSP mods should put their files in GameData/[mod name], but kOS puts the archive outside the GameData folder because it represents content owned by you, the player, not content owned by the kOS mod.

      -

      By saving the file in Ships/Script, you have actually put it in your archive volume of kOS. kOS will see it there immediately without delay. You do not need to restart the game. If you do:

      -
      SWITCH TO 0.
      -LIST FILES.
      -
      -
      -

      after saving the file from your external text editor program, you will see a listing of your file “hellolaunch” right away. Okay, now copy it to your local drive and give it a try running it from there:

      -
      SWITCH TO 1.
      -COPY HELLOLANCH FROM 0.
      -RUN HELLOLAUNCH.
      -
      -
      -
      -../_images/example_2_1.png -
      -

      Okay so the program doesn’t actaully DO anything yet other than just countdown from 10 to 0. A bit of a dissapointment, but we haven’t written the rest of the program yet.

      -

      You’ll note that what you’ve done is switch to the local volume (1) and then copy the program from the archive (0) to the local volume (1) and then run it from the local volume. Technically you didn’t need to do this. You could have just run it directly from the archive. For those looking at the KSP game as a bit of a role-play experience, it makes sense to never run programs directly from the archive, and instead live with the limitation that software should be copied to the craft for it to be able to run it.

      -
      -
      -

      Step 3: Make the script actually do something

      -

      Okay now go back into your text editor of choice and append a few more lines to the hellolaunch.ks file so it now looks like this:

      -
      // My First Launcher.
      -
      -SET countdown TO 10.
      -PRINT "Counting down:".
      -UNTIL countdown = 0 {
      -    PRINT "..." + countdown.
      -    SET countdown TO countdown - 1.
      -    WAIT 1. // pauses the script here for 1 second.
      -}
      -
      -PRINT "Main throttle up.  2 seconds to stabalize it.".
      -LOCK THROTTLE TO 1.0.   // 1.0 is the max, 0.0 is idle.
      -WAIT 2. // give throttle time to adjust.
      -UNTIL SHIP:MAXTHRUST > 0 {
      -    WAIT 0.5. // pause half a second between stage attempts.
      -    PRINT "Stage activated.".
      -    STAGE. // same as hitting the spacebar.
      -}
      -WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up.
      -
      -// NOTE that it is vital to not just let the script end right away
      -// here.  Once a kOS script just ends, it releases all the controls
      -// back to manual piloting so that you can fly the ship by hand again.
      -// If the pogram just ended here, then that would cause the throttle
      -// to turn back off again right away and nothing would happen.
      -
      -
      -

      Save this file to hellolaunch.ks again, and re-copy it to your vessel that should still be sitting on the launchpad, then run it, like so:

      -
      COPY HELLOLAUNCH FROM 0.
      -RUN HELLOLAUNCH.
      -
      -
      -
      -../_images/example_2_2.png -
      -

      Hey! It does something now! It fires the first stage engine and launches!

      -

      But.. but wait... It doesn’t control the steering and it just lets it go where ever it will.

      -

      Most likely you had a crash with this script because it didn’t do anything to affect the steering at all, so it probably allowed the rocket to tilt over.

      -
      -
      -

      Step 4: Make the script actually control steering

      -

      So to fix that problem, let’s add steering control to the script.

      -

      The easy way to control steering is to use the LOCK STEERING command.

      -

      Once you have mastered the basics of kOS, you should go and read the documentation on ship steering techniques, but that’s a more advanced topic for later.

      -

      The way to use the LOCK STEERING command is to set it to a thing called a Vector or a Direction. There are several Directions built-in to kOS, one of which is called “UP”. “UP” is a Direction that always aims directly toward the sky (the center of the blue part of the navball).

      -

      So to steer always UP, just do this:

      -
      LOCK STEERING TO UP.
      -
      -
      -

      So if you just add this one line to your script, you’ll get something that should keep the craft aimed straight up and not let it tip over. Add the line just after the line that sets the THROTTLE, like so:

      -
      // My First Launcher.
      -
      -SET countdown TO 10.
      -PRINT "Counting down:".
      -UNTIL countdown = 0 {
      -    PRINT "..." + countdown.
      -    SET countdown TO countdown - 1.
      -    WAIT 1. // pauses the script here for 1 second.
      -}
      -PRINT "Main throttle up.  2 seconds to stabalize it.".
      -LOCK THROTTLE TO 1.0.   // 1.0 is the max, 0.0 is idle.
      -
      -
      -LOCK STEERING TO UP.  // This is the new line to add
      -
      -
      -WAIT 2. // give throttle time to adjust.
      -UNTIL SHIP:MAXTHRUST > 0 {
      -    WAIT 0.5. // pause half a second between stage attempts.
      -    PRINT "Stage activated.".
      -    STAGE. // same as hitting the spacebar.
      -}
      -WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up.
      -
      -// NOTE that it is vital to not just let the script end right away
      -// here.  Once a kOS script just ends, it releases all the controls
      -// back to manual piloting so that you can fly the ship by hand again.
      -// If the pogram just ended here, then that would cause the throttle
      -// to turn back off again right away and nothing would happen.
      -
      -
      -

      Again, copy this and run it, like before. If your craft crashed in the previous step, which it probably did, then revert to the VAB and re-launch it. NOTE: Due to a bug sometimes reverting just to the launchpad does not work well and you need to revert all the way back to the VAB.:

      -
      SWITCH TO 1. // should be the default already, but just in case.
      -COPY HELLOLAUNCH FROM 0.
      -RUN HELLOLAUNCH.
      -
      -
      -
      -../_images/example_2_3.png -
      -

      Now you should see the same thing as before, but now your craft will stay pointed up.

      -

      But wait - it only does the first stage and then it stops without -doing the next stage? how do I fix that?

      -
      -
      -

      Step 5: Add staging logic

      -

      The logic for how and when to stage can be an interesting and fun thing to write yourself. This example will keep it very simple, and this is the part where it’s important that you are using a vessel that only contains liquidfuel engines. If your vessel has some booster engines, then it would require a more sophisticated script to launch it correctly than this tutorial gives you.

      -

      To add the logic to check when to stage, we introduce a new concept called the WHEN trigger. To see full documentation on it when you finish the tutorial, look for it on the Flow Control page

      -

      The quick and dirty explanation is that a WHEN section is a short section of code that you set up to run LATER rather than right now. It creates a check in the background that will constantly look for some condition to occur, and when it happens, it interrupts whatever else the code is doing, and it will run the body of the WHEN code before continuing from where it left off in the main script.

      -

      There are some complex dangers with writing WHEN triggers that can cause KSP itself to hang or stutter if you are not careful, but explaining them is beyond the scope of this tutorial. But when you want to start using WHEN triggers yourself, you really should read the section on WHEN in the Flow Control page before you do so.

      -

      The WHEN trigger we are going to add to the launch script looks like this:

      -
      WHEN STAGE:LIQUIDFUEL < 0.001 THEN {
      -    PRINT "No liquidfuel.  Attempting to stage.".
      -    STAGE.
      -    PRESERVE.
      -}
      -
      -
      -

      It says, “Whenever the amount of liquid fuel in the current stage is so small it may as well be zero (< 0.001), then activate the next stage.” The PRESERVE keyword says, “don’t stop checking this condition just because it’s been triggered once. It should still keep checking for it again in the future.” -The check for < 0.001 is because sometimes KSP won’t quite burn the last drop of fuel in a stage. -If this block of code is inserted into the script, then it will set up a constant background check that will always hit the next stage as soon as the current stage has no liquidfuel in it. -UNLIKE with all the previous edits this tutorial has asked you to make to the script, this time you’re going to be asked to delete something and replace it. The new WHEN section above should actually REPLACE the existing “UNTIL SHIP:MAXTHRUST > 0” loop that you had before.

      -

      Now your script should look like this:

      -
      // My First Launcher.
      -
      -SET countdown TO 10.
      -PRINT "Counting down:".
      -UNTIL countdown = 0 {
      -    PRINT "..." + countdown.
      -    SET countdown TO countdown - 1.
      -    WAIT 1. // pauses the script here for 1 second.
      -}
      -PRINT "Main throttle up.  2 seconds to stabalize it.".
      -LOCK THROTTLE TO 1.0.   // 1.0 is the max, 0.0 is idle.
      -LOCK STEERING TO UP.
      -WAIT 2. // give throttle time to adjust.
      -
      -// The section below replaces previous UNTIL loop:
      -
      -WHEN STAGE:LIQUIDFUEL < 0.001 THEN {
      -    PRINT "No liquidfuel.  Attempting to stage.".
      -    STAGE.
      -    PRESERVE.
      -}
      -WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up.
      -
      -// NOTE that it is vital to not just let the script end right away
      -// here.  Once a kOS script just ends, it releases all the controls
      -// back to manual piloting so that you can fly the ship by hand again.
      -// If the pogram just ended here, then that would cause the throttle
      -// to turn back off again right away and nothing would happen.
      -
      -
      -

      Again, relaunch the ship, copy the script as before, and run it again. This time you should see it activate your later upper stages correctly. (again, assuming you made the entire vessel with only liquidfuel engines.)

      -
      -../_images/example_2_4.png -
      -
      -
      -

      Step 6: Now to make it turn

      -

      Okay that’s fine but it still just goes straight up! What about a -gravity turn?

      -

      Well, a true and proper gravity turn is a very complex bit of math that is best left as an excercise for the reader, given that the goal of kOS is to let you write your OWN autopilot, not to write it for you. But to give some basic examples of commands, lets just make a crude gravity turn approximation that simply flies the ship like a lot of new KSP pilots learn to do it for the first time:

      -
        -
      • Fly straight up to 10000m.
      • -
      • Aim at 45 degrees down toward the east until 40000m.
      • -
      • Thrust horizontally east after that.
      • -
      -

      To make this work, we introduce a new way to make a Direction, called the HEADING function. Whenever you call the function HEADING(a,b), it makes a Direction oriented as follows on the navball:

      -
        -
      • Point at the compass heading A.
      • -
      • Pitch up a number of degrees from the horizon = to B.
      • -
      -

      So for example, HEADING(45,10) would aim northeast, 10 degrees above the horizon. Combining this with the WHEN command from before, we get this section:

      -
      WHEN SHIP:ALTITUDE > 10000 THEN {
      -    PRINT "Starting turn.  Aiming to 45 degree pitch.".
      -    LOCK STEERING TO HEADING(90,45). // east, 45 degrees pitch.
      -}
      -WHEN SHIP:ALTITUDE > 40000 THEN {
      -    PRINT "Starting flat part.  Aiming to horizon.".
      -    LOCK STEERING TO HEADING(90,0). // east, horizontal.
      -}
      -
      -
      -

      Note that these lack the command PRESERVE like the previous WHEN example had. This is because we want these to trigger just once and then never again. There’s no point in constantly telling kOS to reset the steering to the same thing over and over as the script runs.

      -

      Now, if you insert this new section to the script, we have a nice nifty example of a start of a launching script. Note that it works even if you insert it at the top of the script, because it sets up the triggers to occur LATER when the condition becomes true. They don’t execute right away:

      -
      // My First Launcher.
      -
      -WHEN SHIP:ALTITUDE > 10000 THEN {
      -    PRINT "Starting turn.  Aiming to 45 degree pitch.".
      -    LOCK STEERING TO HEADING(90,45). // east, 45 degrees pitch.
      -}
      -WHEN SHIP:ALTITUDE > 40000 THEN {
      -    PRINT "Starting flat part.  Aiming to horizon.".
      -    LOCK STEERING TO HEADING(90,0). // east, horizontal.
      -}
      -SET countdown TO 10.
      -PRINT "Counting down:".
      -UNTIL countdown = 0 {
      -    PRINT "..." + countdown.
      -    SET countdown TO countdown - 1.
      -    WAIT 1. // pauses the script here for 1 second.
      -}
      -PRINT "Main throttle up.  2 seconds to stabalize it.".
      -LOCK THROTTLE TO 1.0.   // 1.0 is the max, 0.0 is idle.
      -LOCK STEERING TO UP.
      -WAIT 2. // give throttle time to adjust.
      -
      -// The section below replaces previous UNTIL loop:
      -
      -WHEN STAGE:LIQUIDFUEL < 0.001 THEN {
      -    PRINT "No liquidfuel.  Attempting to stage.".
      -    STAGE.
      -    PRESERVE.
      -}
      -WAIT UNTIL SHIP:ALTITUDE > 70000. // pause here until ship is high up.
      -
      -// NOTE that it is vital to not just let the script end right away
      -// here.  Once a kOS script just ends, it releases all the controls
      -// back to manual piloting so that you can fly the ship by hand again.
      -// If the program just ended here, then that would cause the throttle
      -// to turn back off again right away and nothing would happen.
      -
      -
      -

      And here is it in action:

      -
      -../_images/example_2_5.png -
      -

      And toward the end:

      -
      -../_images/example_2_6.png -
      -

      If we assume you made a vessel that has enough fuel and power to get up to orbit, this script should in principle work to get you to the point of leaving the atmosphere. It will probably still fall back down, because this script makes no attempt to ensure that the craft is going fast enough to maintain the orbit.

      -

      As you can probably see, it would still have a long way to go before it would become a really GOOD launching autopilot. Think about the following features you could add yourself as you become more familiar with kOS:

      -
        -
      • You could change the steering logic to make a more smooth gravity turn by constantly adjusting the pitch in the HEADING according to some math formula. The example shown here tends to create a “too high” launch that’s a bit inefficient.
      • -
      • You could complete the launching script by making sure once the vessel breaks the atmosphere it actually makes a circular orbit rather than just stopping after 70000m and coasting.
      • -
      • This script just stupidly leaves the throttle at max the whole way. You could make it more sophisticated by adjusting the throttle as necessary to avoid too much wasted energy fighting air friction. (The way KSP‘s stock areodynamic model works, the optimal speed is terminal velocity, by the way). This is partly addressed in the PID Loop Tutorial.
      • -
      • With more sophisticated staging checks, the script could be made to work with solid fuel engines as well.
      • -
      • With even more sophisticated checks, the script could be made to work with fancy staging methods like asaparagus.
      • -
      • Using the PRINT AT command, you can make fancier status readouts in the termainl window as the script runs.
      • -
      -
      -
      -
      - - -
      -
      -
      - -
      -
      - - - - \ No newline at end of file