Orbit

class Orbit

Describes an orbit. For example, the orbit of a vessel, obtained by calling Vessel.orbit, or a celestial body, obtained by calling CelestialBody.orbit.

body

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

Attribute:

Read-only, cannot be set

Return type:

CelestialBody

apoapsis

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

Attribute:

Read-only, cannot be set

Return type:

float

Note

For the apoapsis altitude reported on the in-game map view, use Orbit.apoapsis_altitude.

periapsis

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

Attribute:

Read-only, cannot be set

Return type:

float

Note

For the periapsis altitude reported on the in-game map view, use Orbit.periapsis_altitude.

apoapsis_altitude

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

Attribute:

Read-only, cannot be set

Return type:

float

Note

This is equal to Orbit.apoapsis minus the equatorial radius of the body.

periapsis_altitude

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

Attribute:

Read-only, cannot be set

Return type:

float

Note

This is equal to Orbit.periapsis minus the equatorial radius of the body.

semi_major_axis

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

Attribute:

Read-only, cannot be set

Return type:

float

semi_minor_axis

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

Attribute:

Read-only, cannot be set

Return type:

float

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.

Attribute:

Read-only, cannot be set

Return type:

float

Note

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

radius_at(ut)

The orbital radius at the given time, in meters.

Parameters:

ut (float) – The universal time to measure the radius at.

Return type:

float

position_at(ut, reference_frame)

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

Parameters:
  • ut (float) – The universal time to measure the position at.

  • reference_frame (ReferenceFrame) – The reference frame that the returned position vector is in.

Returns:

The position as a vector.

Return type:

tuple(float, float, float)

speed

The current orbital speed of the object in meters per second.

Attribute:

Read-only, cannot be set

Return type:

float

Note

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

period

The orbital period, in seconds.

Attribute:

Read-only, cannot be set

Return type:

float

time_to_apoapsis

The time until the object reaches apoapsis, in seconds.

Attribute:

Read-only, cannot be set

Return type:

float

time_to_periapsis

The time until the object reaches periapsis, in seconds.

Attribute:

Read-only, cannot be set

Return type:

float

eccentricity

The eccentricity of the orbit.

Attribute:

Read-only, cannot be set

Return type:

float

inclination

The inclination of the orbit, in radians.

Attribute:

Read-only, cannot be set

Return type:

float

longitude_of_ascending_node

The longitude of the ascending node, in radians.

Attribute:

Read-only, cannot be set

Return type:

float

argument_of_periapsis

The argument of periapsis, in radians.

Attribute:

Read-only, cannot be set

Return type:

float

mean_anomaly_at_epoch

The mean anomaly at epoch.

Attribute:

Read-only, cannot be set

Return type:

float

epoch

The time since the epoch (the point at which the mean anomaly at epoch was measured, in seconds.

Attribute:

Read-only, cannot be set

Return type:

float

mean_anomaly

The mean anomaly.

Attribute:

Read-only, cannot be set

Return type:

float

mean_anomaly_at_ut(ut)

The mean anomaly at the given time.

Parameters:

ut (float) – The universal time in seconds.

Return type:

float

eccentric_anomaly

The eccentric anomaly.

Attribute:

Read-only, cannot be set

Return type:

float

eccentric_anomaly_at_ut(ut)

The eccentric anomaly at the given universal time.

Parameters:

ut (float) – The universal time, in seconds.

Return type:

float

true_anomaly

The true anomaly.

Attribute:

Read-only, cannot be set

Return type:

float

true_anomaly_at_ut(ut)

The true anomaly at the given time.

Parameters:

ut (float) – The universal time in seconds.

Return type:

float

true_anomaly_at_radius(radius)

The true anomaly at the given orbital radius.

Parameters:

radius (float) – The orbital radius in meters.

Return type:

float

ut_at_true_anomaly(true_anomaly)

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

Parameters:

true_anomaly (float) – True anomaly.

Return type:

float

radius_at_true_anomaly(true_anomaly)

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

Parameters:

true_anomaly (float) – The true anomaly.

Return type:

float

true_anomaly_at_an(target)

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

Parameters:

target (Orbit) – Target orbit.

Return type:

float

true_anomaly_at_dn(target)

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

Parameters:

target (Orbit) – Target orbit.

Return type:

float

orbital_speed

The current orbital speed in meters per second.

Attribute:

Read-only, cannot be set

Return type:

float

orbital_speed_at(time)

The orbital speed at the given time, in meters per second.

Parameters:

time (float) – Time from now, in seconds.

Return type:

float

static reference_plane_normal(reference_frame)

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.

Parameters:

reference_frame (ReferenceFrame) – The reference frame that the returned direction is in.

Returns:

The direction as a unit vector.

Return type:

tuple(float, float, float)

static reference_plane_direction(reference_frame)

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

Parameters:

reference_frame (ReferenceFrame) – The reference frame that the returned direction is in.

Returns:

The direction as a unit vector.

Return type:

tuple(float, float, float)

relative_inclination(target)

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

Parameters:

target (Orbit) – Target orbit.

Return type:

float

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.

Attribute:

Read-only, cannot be set

Return type:

float

next_orbit

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

Attribute:

Read-only, cannot be set

Return type:

Orbit

time_of_closest_approach(target)

Estimates and returns the time at closest approach to a target orbit.

Parameters:

target (Orbit) – Target orbit.

Returns:

The universal time at closest approach, in seconds.

Return type:

float

distance_at_closest_approach(target)

Estimates and returns the distance at closest approach to a target orbit, in meters.

Parameters:

target (Orbit) – Target orbit.

Return type:

float

list_closest_approaches(target, orbits)

Returns the times at closest approach and corresponding distances, to a target orbit.

Parameters:
  • target (Orbit) – Target orbit.

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

Returns:

A list of two lists. The first is a list of times at closest approach, as universal times in seconds. The second is a list of corresponding distances at closest approach, in meters.

Return type:

list(list(float))