Orbit#

Orbit

Describes an orbit. For example, the orbit of a vessel, obtained by calling GET /space-center/vessel/(id)/orbit, or a celestial body, obtained by calling GET /space-center/celestial-body/(id)/orbit.

A Orbit object is passed and returned as its identifier, a number. A path that acts on an object takes it as (id).

POST /space-center/orbit/create-from-position-and-velocity#

Create the orbit that passes through a given position at a given velocity. The orbit coasts freely under the gravity of the body being orbited, so it describes where an object left to fall from that position and velocity would be at any later time.

Note

The orbit is a single conic around body. It never changes sphere of influence, so GET /space-center/orbit/(id)/next-orbit is null, and no atmosphere slows it. A vessel held on rails follows its own orbit exactly, while one inside the physics bubble is simulated and drifts from it a little.

GET /space-center/orbit/(id)/radius, GET /space-center/orbit/(id)/speed, POST /space-center/orbit/(id)/position, POST /space-center/orbit/(id)/velocity and the like describe the orbit at ut and stay there. Use POST /space-center/orbit/(id)/radius-at, POST /space-center/orbit/(id)/speed-at, POST /space-center/orbit/(id)/position-at, POST /space-center/orbit/(id)/velocity-at and POST /space-center/orbit/(id)/true-anomaly-at-ut for another time, and GET /space-center/orbit/(id)/reference-frame and GET /space-center/orbit/(id)/orbital-reference-frame to follow the orbit as time passes.

The orbit is held until POST /space-center/orbit/(id)/remove is called on it or the client that created it disconnects. Remove each one created by a script that creates them repeatedly, for example once per update.

Request JSON Object:
  • body (SpaceCenter.CelestialBody) – The celestial body being orbited.

  • position (tuple<double, double, double>) – The position, as a position vector.

  • velocity (tuple<double, double, double>) – The velocity, as a vector pointing in the direction of travel, whose magnitude is the speed in \(\mathrm{m/s}\).

  • ut (double) – The universal time, in seconds, at which the object is at position traveling at velocity.

  • reference_frame (SpaceCenter.ReferenceFrame?) – The reference frame that position and velocity are in. Defaults to GET /space-center/celestial-body/(id)/non-rotating-reference-frame of body. Optional, defaults to null.

Response JSON Object:
  • value (SpaceCenter.Orbit)

POST /space-center/orbit/create-from-orbital-elements#

Create the orbit with the given orbital elements around a given body. The orbit coasts freely under the gravity of that body, so it describes where an object on it would be at any time.

Note

The orbit is a single conic around body. It never changes sphere of influence, so GET /space-center/orbit/(id)/next-orbit is null, and no atmosphere slows it.

The angles are measured against the reference plane and direction that GET /space-center/orbit/(id)/inclination, GET /space-center/orbit/(id)/longitude-of-ascending-node and GET /space-center/orbit/(id)/argument-of-periapsis report them against. POST /space-center/orbit/reference-plane-normal and POST /space-center/orbit/reference-plane-direction give these as vectors in a reference frame.

GET /space-center/orbit/(id)/radius, GET /space-center/orbit/(id)/speed, POST /space-center/orbit/(id)/position, POST /space-center/orbit/(id)/velocity and the like describe the orbit at epoch and stay there. Use POST /space-center/orbit/(id)/radius-at, POST /space-center/orbit/(id)/speed-at, POST /space-center/orbit/(id)/position-at, POST /space-center/orbit/(id)/velocity-at and POST /space-center/orbit/(id)/true-anomaly-at-ut for another time, and GET /space-center/orbit/(id)/reference-frame and GET /space-center/orbit/(id)/orbital-reference-frame to follow the orbit as time passes.

The orbit is held until POST /space-center/orbit/(id)/remove is called on it or the client that created it disconnects. Remove each one created by a script that creates them repeatedly, for example once per update.

Request JSON Object:
  • body (SpaceCenter.CelestialBody) – The celestial body being orbited.

  • semi_major_axis (double) – The semi-major axis of the orbit, in meters. Positive for an ellipse and negative for a hyperbola.

  • eccentricity (double) – The eccentricity of the orbit. Below one for an ellipse and above one for a hyperbola.

  • inclination (double) – The inclination of the orbit, in radians.

  • longitude_of_ascending_node (double) – The longitude of the ascending node, in radians.

  • argument_of_periapsis (double) – The argument of periapsis, in radians.

  • mean_anomaly_at_epoch (double) – The mean anomaly at epoch, in radians.

  • epoch (double) – The universal time, in seconds, that mean_anomaly_at_epoch is measured at.

Response JSON Object:
  • value (SpaceCenter.Orbit)

POST /space-center/orbit/(id)/remove#

Remove the orbit, releasing the memory the server holds for it.

Note

Only an orbit created by POST /space-center/orbit/create-from-position-and-velocity or POST /space-center/orbit/create-from-orbital-elements can be removed. Every other orbit belongs to something in the game, and the server holds one of each.

Any further use of this object throws an exception, as does use of a reference frame defined against it. An orbit belongs to the client that created it, and is removed when that client disconnects.

Parameters:
  • id – The identifier of the Orbit object.

GET /space-center/orbit/(id)/body#

The celestial body (e.g. planet or moon) around which the object is orbiting.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (SpaceCenter.CelestialBody)

GET /space-center/orbit/(id)/reference-frame#

The reference frame that moves along the orbit, and is orientated in a fixed direction.

Note

For the orbit of a vessel, the origin is the point the vessel’s orbit has reached rather than the vessel’s own center of mass. The two are a few meters apart, as a vessel inside the physics bubble is simulated rather than being held on its orbit.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (SpaceCenter.ReferenceFrame)

GET /space-center/orbit/(id)/orbital-reference-frame#

The reference frame that moves along the orbit, and is orientated with its prograde/normal/radial directions.

  • The origin is at the point the orbit has reached at the current time.

  • The axes rotate with the orbital prograde/normal/radial directions.

  • The x-axis points in the orbital anti-radial direction.

  • The y-axis points in the orbital prograde direction.

  • The z-axis points in the orbital normal direction.

Note

For the orbit of a vessel, the origin is the point the vessel’s orbit has reached rather than the vessel’s own center of mass, which is what GET /space-center/vessel/(id)/orbital-reference-frame is centered on.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (SpaceCenter.ReferenceFrame)

GET /space-center/orbit/(id)/apoapsis#

Gets the apoapsis of the orbit, in meters, from the center of mass of the body being orbited.

Note

For the apoapsis altitude reported on the in-game map view, use GET /space-center/orbit/(id)/apoapsis-altitude.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/periapsis#

The periapsis of the orbit, in meters, from the center of mass of the body being orbited.

Note

For the periapsis altitude reported on the in-game map view, use GET /space-center/orbit/(id)/periapsis-altitude.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/apoapsis-altitude#

The apoapsis of the orbit, in meters, above the sea level of the body being orbited.

Note

This is equal to GET /space-center/orbit/(id)/apoapsis minus the equatorial radius of the body.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/periapsis-altitude#

The periapsis of the orbit, in meters, above the sea level of the body being orbited.

Note

This is equal to GET /space-center/orbit/(id)/periapsis minus the equatorial radius of the body.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/semi-major-axis#

The semi-major axis of the orbit, in meters.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/semi-minor-axis#

The semi-minor axis of the orbit, in meters.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/semi-latus-rectum#

The semi-latus rectum of the orbit, in meters.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/radius#

The current radius of the orbit, in meters. This is the distance between the center of mass of the object in orbit, and the center of mass of the body around which it is orbiting.

Note

This value will change over time if the orbit is elliptical.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/altitude#

The current altitude of the object, in meters above the sea level of the body being orbited.

Note

This is equal to GET /space-center/orbit/(id)/radius minus the equatorial radius of the body.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/radius-at#

The orbital radius at the given time, in meters.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time to measure the radius at.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/radius-at-true-anomaly#

The orbital radius at the point in the orbit given by the true anomaly.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • true_anomaly (double) – The true anomaly.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/position#

The position the orbit has reached at the current time, in the given reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The position as a vector.

POST /space-center/orbit/(id)/position-at#

The position at a given time, in the specified reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The position as a vector.

POST /space-center/orbit/(id)/position-at-true-anomaly#

The position at the point in the orbit given by the true anomaly, in the specified reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The position as a vector.

POST /space-center/orbit/(id)/velocity#

The velocity the orbit has reached at the current time, in the given reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed in \(\mathrm{m/s}\).

POST /space-center/orbit/(id)/velocity-at#

The velocity at a given time, in the specified reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed in \(\mathrm{m/s}\).

POST /space-center/orbit/(id)/velocity-at-true-anomaly#

The velocity at the point in the orbit given by the true anomaly, in the specified reference frame.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
Response JSON Object:
  • value (tuple<double, double, double>) – The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed in \(\mathrm{m/s}\).

GET /space-center/orbit/(id)/speed#

The current orbital speed of the object in \(\mathrm{m/s}\).

Note

This value will change over time if the orbit is elliptical.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/speed-at#

The orbital speed at the given time, in \(\mathrm{m/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time to measure the speed at.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/speed-at-radius#

The orbital speed at the given orbital radius, in \(\mathrm{m/s}\).

Note

This is the vis-viva speed. A radius the orbit never reaches is accepted. On an ellipse the speed is NaN above twice the semi-major axis.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • radius (double) – The orbital radius in meters.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/speed-at-true-anomaly#

The orbital speed at the point in the orbit given by the true anomaly, in \(\mathrm{m/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • true_anomaly (double) – The true anomaly.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/specific-energy#

The specific orbital energy, in \(\mathrm{J/kg}\).

Note

This is the sum of the orbit’s specific kinetic and potential energy, \(v^{2}/2 - \mu/r\), where \(v\) is the orbital speed, \(\mu\) the gravitational parameter of the body and \(r\) the orbital radius. It is negative for a bound (elliptical) orbit.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/specific-angular-momentum#

The specific relative angular momentum, in \(\mathrm{m^{2}/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/period#

The orbital period, in seconds.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/mean-motion#

The mean motion, in \(\mathrm{rad/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/time-to-apoapsis#

The time until the object reaches apoapsis, in seconds.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/time-to-periapsis#

The time until the object reaches periapsis, in seconds.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/eccentricity#

The eccentricity of the orbit.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/inclination#

The inclination of the orbit, in radians.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/longitude-of-ascending-node#

The longitude of the ascending node, in radians.

Note

For a near-equatorial orbit, the ascending node is ill-defined and this value may vary erratically over time.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/argument-of-periapsis#

The argument of periapsis, in radians.

Note

For a near-circular orbit, the periapsis is ill-defined and this value may vary erratically over time.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/mean-anomaly-at-epoch#

The mean anomaly at epoch.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/epoch#

The universal time, in seconds, at which the mean anomaly at epoch is measured.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/mean-anomaly#

The mean anomaly.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/mean-anomaly-at-ut#

The mean anomaly at the given time.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time in seconds.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/eccentric-anomaly#

The eccentric anomaly.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/eccentric-anomaly-at-ut#

The eccentric anomaly at the given universal time.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time, in seconds.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/true-anomaly#

The true anomaly.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/true-anomaly-at-ut#

The true anomaly at the given time.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time in seconds.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/true-anomaly-at-radius#

The true anomaly at the given orbital radius.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • radius (double) – The orbital radius in meters.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/ut-at-true-anomaly#

The universal time, in seconds, corresponding to the given true anomaly.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • true_anomaly (double) – True anomaly.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/true-anomaly-at-an#

The true anomaly of the ascending node with the given target orbit.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • target (SpaceCenter.Orbit) – Target orbit.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/true-anomaly-at-dn#

The true anomaly of the descending node with the given target orbit.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • target (SpaceCenter.Orbit) – Target orbit.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/orbital-speed#

Warning

Deprecated. Use GET /space-center/orbit/(id)/speed instead.

The current orbital speed in \(\mathrm{m/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/(id)/orbital-speed-at#

Warning

Deprecated. Use POST /space-center/orbit/(id)/speed-at instead.

The orbital speed at the given time, in \(\mathrm{m/s}\).

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • ut (double) – The universal time to measure the speed at.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/orbital-energy#

Warning

Deprecated. Use GET /space-center/orbit/(id)/specific-energy instead.

The specific orbital energy of the orbit, in \(\mathrm{J/kg}\).

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

POST /space-center/orbit/reference-plane-normal#

The direction that is normal to the orbits reference plane, in the given reference frame. The reference plane is the plane from which the orbits inclination is measured.

Request JSON Object:
  • reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned direction is in.

Response JSON Object:
  • value (tuple<double, double, double>) – The direction as a unit vector.

POST /space-center/orbit/reference-plane-direction#

The direction from which the orbits longitude of ascending node is measured, in the given reference frame.

Request JSON Object:
  • reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned direction is in.

Response JSON Object:
  • value (tuple<double, double, double>) – The direction as a unit vector.

POST /space-center/orbit/(id)/relative-inclination#

Relative inclination of this orbit and the target orbit, in radians.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • target (SpaceCenter.Orbit) – Target orbit.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/time-to-soi-change#

The time until the object changes sphere of influence, in seconds. Returns NaN if the object is not going to change sphere of influence.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (double)

GET /space-center/orbit/(id)/next-orbit#

If the object is going to change sphere of influence in the future, returns the new orbit after the change. Otherwise returns null.

Parameters:
  • id – The identifier of the Orbit object.

Response JSON Object:
  • value (SpaceCenter.Orbit?)

POST /space-center/orbit/(id)/next-closest-approach#

The next closest approach to a target orbit.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • target (SpaceCenter.Orbit) – Target orbit.

Response JSON Object:
  • value (SpaceCenter.ClosestApproach)

POST /space-center/orbit/(id)/closest-approaches#

A list of the closest approaches to a target orbit, one for each of the next orbits orbital periods.

Parameters:
  • id – The identifier of the Orbit object.

Request JSON Object:
  • target (SpaceCenter.Orbit) – Target orbit.

  • orbits (int32) – The number of future orbits to search.

Response JSON Object:
  • value (list<SpaceCenter.ClosestApproach>)