.. default-domain:: http .. highlight:: json Service ======= .. _http-SpaceCenter: Provides functionality to interact with Kerbal Space Program. This includes controlling the active vessel, managing its resources, planning maneuver nodes and auto-piloting. .. http:get:: /space-center/expansions The names of the installed expansions, for example ``"Serenity"`` (Breaking Ground) or ``"MakingHistory"`` (Making History). :resjson list value: .. http:get:: /space-center/science The current amount of science. :resjson float value: .. http:get:: /space-center/funds The current amount of funds. :resjson double value: .. http:get:: /space-center/reputation The current amount of reputation. :resjson float value: .. http:get:: /space-center/active-vessel The currently active vessel. :resjson SpaceCenter.Vessel? value: .. http:put:: /space-center/active-vessel The currently active vessel. :reqjson SpaceCenter.Vessel? value: The new value. .. http:get:: /space-center/vessels A list of all the vessels in the game. :resjson list value: .. http:get:: /space-center/launch-sites A list of available launch sites. :resjson list value: .. http:get:: /space-center/bodies A dictionary of all celestial bodies (planets, moons, etc.) in the game, keyed by the name of the body. :resjson dictionary value: .. http:get:: /space-center/target-body The currently targeted celestial body. :resjson SpaceCenter.CelestialBody? value: .. http:put:: /space-center/target-body The currently targeted celestial body. :reqjson SpaceCenter.CelestialBody? value: The new value. .. http:get:: /space-center/target-vessel The currently targeted vessel. :resjson SpaceCenter.Vessel? value: .. http:put:: /space-center/target-vessel The currently targeted vessel. :reqjson SpaceCenter.Vessel? value: The new value. .. http:get:: /space-center/target-docking-port The currently targeted docking port. :resjson SpaceCenter.DockingPort? value: .. http:put:: /space-center/target-docking-port The currently targeted docking port. :reqjson SpaceCenter.DockingPort? value: The new value. .. http:post:: /space-center/clear-target Clears the current target. .. http:post:: /space-center/launchable-vessels Returns a list of vessels from the given *craft_directory* that can be launched. :reqjson string craft_directory: Name of the directory in the current saves "Ships" directory. For example ``"VAB"`` or ``"SPH"``. :resjson list value: .. http:post:: /space-center/launch-vessel Launch a vessel. .. note:: The *crew* parameter controls how the craft is crewed: * If ``null``, the craft's default crew assignments are used. * If an empty list, the craft is launched with no crew. * Otherwise, the named Kerbals are placed in the craft in the order given: the first name takes the first seat, the second name the next seat, and so on, scanning the craft's parts in order. No other Kerbals are hired to fill remaining seats. Throws an exception, without launching, if a name does not match an available Kerbal or the craft has too few seats for the requested crew. Throws an exception if any of the games pre-flight checks fail. :reqjson string craft_directory: Name of the directory in the current saves "Ships" directory, that contains the craft file. For example ``"VAB"`` or ``"SPH"``. :reqjson string name: Name of the vessel to launch. This is the name of the ".craft" file in the save directory, without the ".craft" file extension. :reqjson string launch_site: Name of the launch site. For example ``"LaunchPad"`` or ``"Runway"``. :reqjson list? crew: The Kerbals to place in the craft, by name. Controls how the craft is crewed, as described in the remarks. Optional, defaults to ``null``. :reqjson bool recover: If true and there is a vessel on the launch site, recover it before launching. Optional, defaults to ``true``. :reqjson string flag_url: If not ``null``, the asset URL of the mission flag to use for the launch. Optional, defaults to ``""``. .. http:post:: /space-center/launch-vessel-from-vab Launch a new vessel from the VAB onto the launchpad. .. note:: This is equivalent to calling :http:post:`/space-center/launch-vessel` with the craft directory set to "VAB" and the launch site set to "LaunchPad". Throws an exception if any of the games pre-flight checks fail. :reqjson string name: Name of the vessel to launch. :reqjson bool recover: If true and there is a vessel on the launch pad, recover it before launching. Optional, defaults to ``true``. .. http:post:: /space-center/launch-vessel-from-sph Launch a new vessel from the SPH onto the runway. .. note:: This is equivalent to calling :http:post:`/space-center/launch-vessel` with the craft directory set to "SPH" and the launch site set to "Runway". Throws an exception if any of the games pre-flight checks fail. :reqjson string name: Name of the vessel to launch. :reqjson bool recover: If true and there is a vessel on the runway, recover it before launching. Optional, defaults to ``true``. .. http:get:: /space-center/editor The editor, for inspecting the vessel that is being constructed. :resjson SpaceCenter.Editor value: .. http:post:: /space-center/save Save the game with a given name. This will create a save file called ``name.sfs`` in the folder of the current save game. :reqjson string name: Name of the save. .. http:post:: /space-center/load Load the game with the given name. This will create a load a save file called ``name.sfs`` from the folder of the current save game. :reqjson string name: Name of the save. .. http:post:: /space-center/quicksave Save a quicksave. .. note:: This is the same as calling :http:post:`/space-center/save` with the name "quicksave". .. http:post:: /space-center/quickload Load a quicksave. .. note:: This is the same as calling :http:post:`/space-center/load` with the name "quicksave". .. http:get:: /space-center/can-save Whether the game can be saved. .. note:: The game cannot be saved in some flight states, e.g. while under acceleration or moving over the surface. Setting :http:get:`/krpc/game-scene` to leave flight saves the game only when this is true. :resjson bool value: .. http:post:: /space-center/can-revert-to-launch Whether the current flight can be reverted to launch. :resjson bool value: .. http:post:: /space-center/revert-to-launch Revert the current flight to launch. .. http:post:: /space-center/transfer-crew Transfers a crew member to a different part. :reqjson SpaceCenter.CrewMember crew_member: The crew member to transfer. :reqjson SpaceCenter.Part target_part: The part to move them to. .. http:get:: /space-center/ui-visible Whether the UI is visible. :resjson bool value: .. http:put:: /space-center/ui-visible Whether the UI is visible. :reqjson bool value: The new value. .. http:get:: /space-center/navball Whether the navball is visible. :resjson bool value: .. http:put:: /space-center/navball Whether the navball is visible. :reqjson bool value: The new value. .. http:get:: /space-center/altimeter-mode The current mode of the altimeter. :resjson SpaceCenter.AltimeterMode value: .. http:put:: /space-center/altimeter-mode The current mode of the altimeter. :reqjson SpaceCenter.AltimeterMode value: The new value. .. http:get:: /space-center/ut The current universal time in seconds. :resjson double value: .. http:get:: /space-center/g The value of the `gravitational constant `_ G in :math:`\mathrm{N(m/kg)^{2}}`. :resjson double value: .. http:get:: /space-center/buoyancy-scalar The multiplier the game applies to every buoyant force. .. note:: Stock KSP sets it to 1.2. A buoyant force is a fifth larger than `Archimedes' principle `_ alone gives. :resjson double value: .. http:get:: /space-center/warp-rate The current warp rate. This is the rate at which time is passing for either on-rails or physical time warp. For example, a value of 10 means time is passing 10x faster than normal. Returns 1 if time warp is not active. :resjson float value: .. http:get:: /space-center/warp-factor The current warp factor. This is the index of the rate at which time is passing for either regular "on-rails" or physical time warp. Returns 0 if time warp is not active. When in on-rails time warp, this is equal to :http:get:`/space-center/rails-warp-factor`, and in physics time warp, this is equal to :http:get:`/space-center/physics-warp-factor`. :resjson float value: .. http:get:: /space-center/rails-warp-factor The time warp rate, using regular "on-rails" time warp. A value between 0 and 7 inclusive. 0 means no time warp. Returns 0 if physical time warp is active. If requested time warp factor cannot be set, it will be set to the next lowest possible value. For example, if the vessel is too close to a planet. See `the KSP wiki `_ for details. .. note:: Outside the flight scene, every factor can be set. :resjson int32 value: .. http:put:: /space-center/rails-warp-factor The time warp rate, using regular "on-rails" time warp. A value between 0 and 7 inclusive. 0 means no time warp. Returns 0 if physical time warp is active. If requested time warp factor cannot be set, it will be set to the next lowest possible value. For example, if the vessel is too close to a planet. See `the KSP wiki `_ for details. .. note:: Outside the flight scene, every factor can be set. :reqjson int32 value: The new value. .. http:get:: /space-center/physics-warp-factor The physical time warp rate. A value between 0 and 3 inclusive. 0 means no time warp. Returns 0 if regular "on-rails" time warp is active. :resjson int32 value: .. http:put:: /space-center/physics-warp-factor The physical time warp rate. A value between 0 and 3 inclusive. 0 means no time warp. Returns 0 if regular "on-rails" time warp is active. :reqjson int32 value: The new value. .. http:post:: /space-center/can-rails-warp-at Returns ``true`` if regular "on-rails" time warp can be used, at the specified warp *factor*. The maximum time warp rate is limited by various things, including how close the active vessel is to a planet. See `the KSP wiki `_ for details. .. note:: Outside the flight scene, every valid factor can be used. :reqjson int32 factor: The warp factor to check. Optional, defaults to ``1``. :resjson bool value: .. http:get:: /space-center/maximum-rails-warp-factor The current maximum regular "on-rails" warp factor that can be set. A value between 0 and 7 inclusive. See `the KSP wiki `_ for details. .. note:: Outside the flight scene, this is the highest factor. :resjson int32 value: .. http:post:: /space-center/warp-to Uses time acceleration to warp forward to a time in the future, specified by universal time *ut*. This call blocks until the desired time is reached. Uses regular "on-rails" or physical time warp as appropriate. For example, physical time warp is used when the active vessel is traveling through an atmosphere. When using regular "on-rails" time warp, the warp rate is limited by *max_rails_rate*, and when using physical time warp, the warp rate is limited by *max_physics_rate*. .. note:: Outside the flight scene, only regular "on-rails" time warp is used. Throws an exception if the game scene changes during the time warp. :reqjson double ut: The universal time to warp to, in seconds. :reqjson float max_rails_rate: The maximum warp rate in regular "on-rails" time warp. Optional, defaults to ``1e+05``. :reqjson float max_physics_rate: The maximum warp rate in physical time warp. Optional, defaults to ``2.0``. .. http:post:: /space-center/transform-position Converts a position from one reference frame to another. :reqjson tuple position: Position, as a vector, in reference frame *from*. :reqjson SpaceCenter.ReferenceFrame from: The reference frame that the position is in. :reqjson SpaceCenter.ReferenceFrame to: The reference frame to covert the position to. :resjson tuple value: The corresponding position, as a vector, in reference frame *to*. .. http:post:: /space-center/transform-direction Converts a direction from one reference frame to another. :reqjson tuple direction: Direction, as a vector, in reference frame *from*. :reqjson SpaceCenter.ReferenceFrame from: The reference frame that the direction is in. :reqjson SpaceCenter.ReferenceFrame to: The reference frame to covert the direction to. :resjson tuple value: The corresponding direction, as a vector, in reference frame *to*. .. http:post:: /space-center/transform-rotation Converts a rotation from one reference frame to another. :reqjson tuple rotation: Rotation, as a quaternion of the form ``(x, y, z, w)``, in reference frame *from*. :reqjson SpaceCenter.ReferenceFrame from: The reference frame that the rotation is in. :reqjson SpaceCenter.ReferenceFrame to: The reference frame to covert the rotation to. :resjson tuple value: The corresponding rotation, as a quaternion of the form ``(x, y, z, w)``, in reference frame *to*. .. http:post:: /space-center/transform-velocity Converts a velocity (acting at the specified position) from one reference frame to another. The position is required to take the relative angular velocity of the reference frames into account. :reqjson tuple position: Position, as a vector, in reference frame *from*. :reqjson tuple velocity: Velocity, as a vector that points in the direction of travel and whose magnitude is the speed in :math:`\mathrm{m/s}`, in reference frame *from*. :reqjson SpaceCenter.ReferenceFrame from: The reference frame that the position and velocity are in. :reqjson SpaceCenter.ReferenceFrame to: The reference frame to covert the velocity to. :resjson tuple value: The corresponding velocity, as a vector, in reference frame *to*. .. http:post:: /space-center/raycast-distance Cast a ray from a given position in a given direction, and return the distance to the hit point. If no hit occurs, returns infinity. :reqjson tuple position: Position, as a vector, of the origin of the ray. :reqjson tuple direction: Direction of the ray, as a unit vector. :reqjson SpaceCenter.ReferenceFrame reference_frame: The reference frame that the position and direction are in. :resjson double value: The distance to the hit, in meters, or infinity if there was no hit. .. http:post:: /space-center/raycast-part Cast a ray from a given position in a given direction, and return the part that it hits. If no hit occurs, returns ``null``. :reqjson tuple position: Position, as a vector, of the origin of the ray. :reqjson tuple direction: Direction of the ray, as a unit vector. :reqjson SpaceCenter.ReferenceFrame reference_frame: The reference frame that the position and direction are in. :resjson SpaceCenter.Part? value: The part that was hit or ``null`` if there was no hit. .. http:get:: /space-center/far-available Whether Ferram Aerospace Research is installed. :resjson bool value: .. http:get:: /space-center/ag-ext-available Whether Action Groups Extended is installed. :resjson bool value: .. http:get:: /space-center/real-fuels-available Whether RealFuels is installed. :resjson bool value: .. http:get:: /space-center/real-chute-available Whether RealChute is installed. :resjson bool value: .. http:get:: /space-center/procedural-fairings-available Whether Procedural Fairings is installed. :resjson bool value: .. http:get:: /space-center/near-future-solar-available Whether Near Future Solar is installed. :resjson bool value: .. http:get:: /space-center/d-magic-available Whether DMagic's DMModuleScienceAnimateGeneric is installed. :resjson bool value: .. http:get:: /space-center/firespitter-available Whether Firespitter is installed. :resjson bool value: .. http:get:: /space-center/kerbal-actuators-available Whether KerbalActuators is installed. :resjson bool value: .. http:get:: /space-center/ksp-community-part-modules-available Whether KSPCommunityPartModules is installed. :resjson bool value: .. http:get:: /space-center/kos-available Whether kOS is installed. :resjson bool value: .. http:get:: /space-center/b9-part-switch-available Whether B9PartSwitch is installed. :resjson bool value: .. http:get:: /space-center/tweak-scale-rescaled-available Whether TweakScale Rescaled is installed. :resjson bool value: .. http:get:: /space-center/real-antennas-available Whether RealAntennas is installed. :resjson bool value: .. http:get:: /space-center/kerbals The Kerbals in the roster. :resjson list value: .. http:post:: /space-center/create-kerbal Creates a Kerbal. :reqjson string name: :reqjson string job: :reqjson bool male: .. http:post:: /space-center/get-kerbal Find a Kerbal by name. :reqjson string name: :resjson SpaceCenter.CrewMember? value: .. http:get:: /space-center/map-filter The visible objects in map mode. :resjson SpaceCenter.MapFilterType value: .. http:put:: /space-center/map-filter The visible objects in map mode. :reqjson SpaceCenter.MapFilterType value: The new value. .. http:post:: /space-center/screenshot Saves a screenshot. :reqjson string file_path: The path of the file to save. :reqjson int32 scale: Resolution scaling factor Optional, defaults to ``1``. .. http:get:: /space-center/game-mode The current mode the game is in. :resjson SpaceCenter.GameMode value: .. http:get:: /space-center/warp-mode The current time warp mode. Returns ``"none"`` if time warp is not active, ``"rails"`` if regular "on-rails" time warp is active, or ``"physics"`` if physical time warp is active. :resjson SpaceCenter.WarpMode value: .. http:get:: /space-center/camera An object that can be used to control the camera. :resjson SpaceCenter.Camera value: .. http:get:: /space-center/waypoint-manager The waypoint manager. :resjson SpaceCenter.WaypointManager value: .. http:get:: /space-center/contract-manager The contract manager. :resjson SpaceCenter.ContractManager value: .. http:get:: /space-center/alarm-manager The alarm manager. :resjson SpaceCenter.AlarmManager value: .. _http-SpaceCenter.GameMode: .. rubric:: GameMode The game mode. Returned by :ref:`GameMode ` Passed and returned as the name of one of its values: ``"sandbox"`` Sandbox mode. ``"career"`` Career mode. ``"science"`` Science career mode. ``"science_sandbox"`` Science sandbox mode. ``"mission"`` Mission mode. ``"mission_builder"`` Mission builder mode. ``"scenario"`` Scenario mode. ``"scenario_non_resumable"`` Scenario mode that cannot be resumed. .. _http-SpaceCenter.AltimeterMode: .. rubric:: AltimeterMode The mode of the altitude reported on the altimeter. See :http:get:`/space-center/altimeter-mode`. Passed and returned as the name of one of its values: ``"default"`` The altimeter is in the default mode. ``"asl"`` The altimeter is in the "Above Sea Level" mode. ``"agl"`` The altimeter is in the "Above Ground Level" mode. .. _http-SpaceCenter.WarpMode: .. rubric:: WarpMode The time warp mode. Returned by :ref:`WarpMode ` Passed and returned as the name of one of its values: ``"rails"`` Time warp is active, and in regular "on-rails" mode. ``"physics"`` Time warp is active, and in physical time warp mode. ``"none"`` Time warp is not active. .. _http-SpaceCenter.MapFilterType: .. rubric:: MapFilterType The set of things that are visible in map mode. .. note:: The values may be combined. A flags enumeration, passed and returned as a list of the names of its values: ``"all"`` Everything. ``"none"`` Nothing. ``"debris"`` Debris. ``"unknown"`` Unknown. ``"space_objects"`` SpaceObjects. ``"probes"`` Probes. ``"rovers"`` Rovers. ``"landers"`` Landers. ``"ships"`` Ships. ``"stations"`` Stations. ``"bases"`` Bases. ``"evas"`` EVAs. ``"flags"`` Flags. ``"plane"`` Planes. ``"relay"`` Relays. ``"site"`` Launch Sites. ``"deployed_science_controller"`` Deployed Science Controllers. .. _http-SpaceCenter.LaunchSite: .. rubric:: LaunchSite A place where craft can be launched from. More of these can be added with mods like Kerbal Konstructs. Passed and returned as an object with these fields: ``name`` (string) The name of the launch site. ``body`` (SpaceCenter.CelestialBody) The celestial body the launch site is on. ``editor_facility`` (SpaceCenter.EditorFacility) Which editor is normally used for this launch site. ``latitude`` (double) The latitude of the point vessels launch from, in degrees, or ``NaN`` if the site has no spawn point. ``longitude`` (double) The longitude of the point vessels launch from, in degrees, or ``NaN`` if the site has no spawn point. ``altitude`` (double) The altitude above sea level of the point vessels launch from, in meters, or ``NaN`` if the site has no spawn point. .. _http-SpaceCenter.EditorFacility: .. rubric:: EditorFacility Editor facility. See ``editor_facility``. Passed and returned as the name of one of its values: ``"vab"`` Vehicle Assembly Building. ``"sph"`` Space Plane Hanger. ``"none"`` None.