space_ex v0.8.0 SpaceEx.SpaceCenter.Vessel

These objects are used to interact with vessels in KSP.

This includes getting orbital and flight data, manipulating control inputs and managing resources. Created using SpaceEx.SpaceCenter.active_vessel/1 or SpaceEx.SpaceCenter.vessels/1.

Link to this section Summary

Functions

The angular velocity of the vessel, in the given reference frame

An SpaceEx.SpaceCenter.AutoPilot object, that can be used to perform simple auto-piloting of the vessel

The maximum torque that the aerodynamic control surfaces can generate

The maximum torque that the currently active and gimballed engines can generate

The maximum torque that parts (excluding reaction wheels, gimballed engines, RCS and control surfaces) can generate

The maximum torque that the currently active RCS thrusters can generate

The maximum torque that the currently active and powered reaction wheels can generate

Gets the total available thrust that can be produced by the vessel’s active engines, in Newtons

The maximum torque that the vessel generates

The name of the biome the vessel is currently in

The axis-aligned bounding box of the vessel in the given reference frame

Returns a SpaceEx.SpaceCenter.Comms object that can be used to interact with CommNet for this vessel

Returns a SpaceEx.SpaceCenter.Control object that can be used to manipulate the vessel’s control inputs

The crew in the vessel

The number of crew that can occupy the vessel

The number of crew that are occupying the vessel

The direction in which the vessel is pointing, in the given reference frame

The total mass of the vessel, excluding resources, in kg

Returns a SpaceEx.SpaceCenter.Flight object that can be used to get flight telemetry for the vessel, in the specified reference frame

The inertia tensor of the vessel around its center of mass, in the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame)

The combined specific impulse of all active engines at sea level on Kerbin, in seconds

The total mass of the vessel, including resources, in kg

The total maximum thrust that can be produced by the vessel’s active engines, in Newtons

The total maximum thrust that can be produced by the vessel’s active engines when the vessel is in a vacuum, in Newtons

The mission elapsed time in seconds

The moment of inertia of the vessel around its center of mass in \(kg.m^2\)

The name of the vessel

The current orbit of the vessel

The reference frame that is fixed relative to the vessel, and orientated with the vessels orbital prograde/normal/radial directions

A SpaceEx.SpaceCenter.Parts object, that can used to interact with the parts that make up this vessel

The position of the center of mass of the vessel, in the given reference frame

Recover the vessel

Whether the vessel is recoverable

The reference frame that is fixed relative to the vessel, and orientated with the vessel

A SpaceEx.SpaceCenter.Resources object, that can used to get information about resources stored in the vessel

Returns a SpaceEx.SpaceCenter.Resources object, that can used to get information about resources stored in a given stage

The rotation of the vessel, in the given reference frame

The name of the vessel

The type of the vessel

The situation the vessel is in

The combined specific impulse of all active engines, in seconds

The reference frame that is fixed relative to the vessel, and orientated with the surface of the body being orbited

The reference frame that is fixed relative to the vessel, and orientated with the velocity vector of the vessel relative to the surface of the body being orbited

The total thrust currently being produced by the vessel’s engines, in Newtons

The type of the vessel

The combined vacuum specific impulse of all active engines, in seconds

The velocity of the center of mass of the vessel, in the given reference frame

Link to this section Functions

Link to this function angular_velocity(this, reference_frame)

The angular velocity of the vessel, in the given reference frame.

Returns the angular velocity as a vector. The magnitude of the vector is the rotational speed of the vessel, in radians per second. The direction of the vector indicates the axis of rotation, using the right-hand rule.

  • reference_frame — The reference frame the returned angular velocity is in.

Returns: {double, double, double}, where double is a high precision decimal

Link to this function auto_pilot(this)

An SpaceEx.SpaceCenter.AutoPilot object, that can be used to perform simple auto-piloting of the vessel.

Returns: a reference to a SpaceEx.SpaceCenter.AutoPilot object

Link to this function available_control_surface_torque(this)

The maximum torque that the aerodynamic control surfaces can generate.

Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Link to this function available_engine_torque(this)

The maximum torque that the currently active and gimballed engines can generate.

Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Link to this function available_other_torque(this)

The maximum torque that parts (excluding reaction wheels, gimballed engines, RCS and control surfaces) can generate.

Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Link to this function available_rcs_torque(this)

The maximum torque that the currently active RCS thrusters can generate.

Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Link to this function available_reaction_wheel_torque(this)

The maximum torque that the currently active and powered reaction wheels can generate.

Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Link to this function available_thrust(this)

Gets the total available thrust that can be produced by the vessel’s active engines, in Newtons.

This is computed by summing SpaceEx.SpaceCenter.Engine.available_thrust/1 for every active engine in the vessel.

Returns: a low-precision decimal

Link to this function available_torque(this)

The maximum torque that the vessel generates.

Includes contributions from reaction wheels, RCS, gimballed engines and aerodynamic control surfaces. Returns the torques in \(N.m\) around each of the coordinate axes of the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

The name of the biome the vessel is currently in.

Returns: a string

Link to this function bounding_box(this, reference_frame)

The axis-aligned bounding box of the vessel in the given reference frame.

Returns the positions of the minimum and maximum vertices of the box, as position vectors.

  • reference_frame — The reference frame that the returned position vectors are in.

Returns: {{double, double, double}, {double, double, double}}, where double is a high precision decimal

Returns a SpaceEx.SpaceCenter.Comms object that can be used to interact with CommNet for this vessel.

Returns: a reference to a SpaceEx.SpaceCenter.Comms object

Returns a SpaceEx.SpaceCenter.Control object that can be used to manipulate the vessel’s control inputs.

For example, its pitch/yaw/roll controls, RCS and thrust.

Returns: a reference to a SpaceEx.SpaceCenter.Control object

The crew in the vessel.

Returns: [crew_member, ...], where crew_member is a reference to a SpaceEx.SpaceCenter.CrewMember object

Link to this function crew_capacity(this)

The number of crew that can occupy the vessel.

Returns: an integer

Link to this function crew_count(this)

The number of crew that are occupying the vessel.

Returns: an integer

Link to this function direction(this, reference_frame)

The direction in which the vessel is pointing, in the given reference frame.

Returns the direction as a unit vector.

  • reference_frame — The reference frame that the returned direction is in.

Returns: {double, double, double}, where double is a high precision decimal

The total mass of the vessel, excluding resources, in kg.

Returns: a low-precision decimal

Link to this function flight(this, opts \\ [])

Returns a SpaceEx.SpaceCenter.Flight object that can be used to get flight telemetry for the vessel, in the specified reference frame.

Returns: a reference to a SpaceEx.SpaceCenter.Flight object

Link to this function inertia_tensor(this)

The inertia tensor of the vessel around its center of mass, in the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame).

Returns the 3x3 matrix as a list of elements, in row-major order.

Returns: [double, ...], where double is a high precision decimal

Link to this function kerbin_sea_level_specific_impulse(this)

The combined specific impulse of all active engines at sea level on Kerbin, in seconds.

This is computed using the formula described here.

Returns: a low-precision decimal

The total mass of the vessel, including resources, in kg.

Returns: a low-precision decimal

Link to this function max_thrust(this)

The total maximum thrust that can be produced by the vessel’s active engines, in Newtons.

This is computed by summing SpaceEx.SpaceCenter.Engine.max_thrust/1 for every active engine.

Returns: a low-precision decimal

Link to this function max_vacuum_thrust(this)

The total maximum thrust that can be produced by the vessel’s active engines when the vessel is in a vacuum, in Newtons.

This is computed by summing SpaceEx.SpaceCenter.Engine.max_vacuum_thrust/1 for every active engine.

Returns: a low-precision decimal

The mission elapsed time in seconds.

Returns: a high precision decimal

Link to this function moment_of_inertia(this)

The moment of inertia of the vessel around its center of mass in \(kg.m^2\).

The inertia values in the returned 3-tuple are around the pitch, roll and yaw directions respectively. This corresponds to the vessels reference frame (SpaceEx.SpaceCenter.ReferenceFrame).

Returns: {double, double, double}, where double is a high precision decimal

The name of the vessel.

Returns: a string

The current orbit of the vessel.

Returns: a reference to a SpaceEx.SpaceCenter.Orbit object

Link to this function orbital_reference_frame(this)

The reference frame that is fixed relative to the vessel, and orientated with the vessels orbital prograde/normal/radial directions.

  • The origin is at the center of mass of the vessel.

  • 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.

Be careful not to confuse this with ‘orbit’ mode on the navball.

Returns: a reference to a SpaceEx.SpaceCenter.ReferenceFrame object

A SpaceEx.SpaceCenter.Parts object, that can used to interact with the parts that make up this vessel.

Returns: a reference to a SpaceEx.SpaceCenter.Parts object

Link to this function position(this, reference_frame)

The position of the center of mass of the vessel, in the given reference frame.

Returns the position as a vector.

  • reference_frame — The reference frame that the returned position vector is in.

Returns: {double, double, double}, where double is a high precision decimal

Recover the vessel.

Returns: :ok

Link to this function recoverable(this)

Whether the vessel is recoverable.

Returns: true or false

Link to this function reference_frame(this)

The reference frame that is fixed relative to the vessel, and orientated with the vessel.

  • The origin is at the center of mass of the vessel.

  • The axes rotate with the vessel.

  • The x-axis points out to the right of the vessel.

  • The y-axis points in the forward direction of the vessel.

  • The z-axis points out of the bottom off the vessel.

Returns: a reference to a SpaceEx.SpaceCenter.ReferenceFrame object

Link to this function resources(this)

A SpaceEx.SpaceCenter.Resources object, that can used to get information about resources stored in the vessel.

Returns: a reference to a SpaceEx.SpaceCenter.Resources object

Link to this function resources_in_decouple_stage(this, stage, opts \\ [])

Returns a SpaceEx.SpaceCenter.Resources object, that can used to get information about resources stored in a given stage.

  • stage — Get resources for parts that are decoupled in this stage.

  • cumulative — When false, returns the resources for parts decoupled in just the given stage. When true returns the resources decoupled in the given stage and all subsequent stages combined.

Returns: a reference to a SpaceEx.SpaceCenter.Resources object

Link to this function rotation(this, reference_frame)

The rotation of the vessel, in the given reference frame.

Returns the rotation as a quaternion of the form \((x, y, z, w)\).

  • reference_frame — The reference frame that the returned rotation is in.

Returns: {double, double, double, double}, where double is a high precision decimal

Link to this function set_name(this, value)

The name of the vessel.

Returns: :ok

Link to this function set_type(this, value)

The type of the vessel.

Returns: :ok

Link to this function situation(this)

The situation the vessel is in.

Returns: a Elixir.SpaceEx.SpaceCenter.VesselSituation value in atom form

Link to this function specific_impulse(this)

The combined specific impulse of all active engines, in seconds.

This is computed using the formula described here.

Returns: a low-precision decimal

Link to this function surface_reference_frame(this)

The reference frame that is fixed relative to the vessel, and orientated with the surface of the body being orbited.

  • The origin is at the center of mass of the vessel.

  • The axes rotate with the north and up directions on the surface of the body.

  • The x-axis points in the zenith direction (upwards, normal to the body being orbited, from the center of the body towards the center of mass of the vessel).

  • The y-axis points northwards towards the astronomical horizon (north, and tangential to the surface of the body — the direction in which a compass would point when on the surface).

  • The z-axis points eastwards towards the astronomical horizon (east, and tangential to the surface of the body — east on a compass when on the surface).

Be careful not to confuse this with ‘surface’ mode on the navball.

Returns: a reference to a SpaceEx.SpaceCenter.ReferenceFrame object

Link to this function surface_velocity_reference_frame(this)

The reference frame that is fixed relative to the vessel, and orientated with the velocity vector of the vessel relative to the surface of the body being orbited.

  • The origin is at the center of mass of the vessel.

  • The axes rotate with the vessel’s velocity vector.

  • The y-axis points in the direction of the vessel’s velocity vector, relative to the surface of the body being orbited.

  • The z-axis is in the plane of the astronomical horizon.

  • The x-axis is orthogonal to the other two axes.

Returns: a reference to a SpaceEx.SpaceCenter.ReferenceFrame object

The total thrust currently being produced by the vessel’s engines, in Newtons.

This is computed by summing SpaceEx.SpaceCenter.Engine.thrust/1 for every engine in the vessel.

Returns: a low-precision decimal

The type of the vessel.

Returns: a Elixir.SpaceEx.SpaceCenter.VesselType value in atom form

Link to this function vacuum_specific_impulse(this)

The combined vacuum specific impulse of all active engines, in seconds.

This is computed using the formula described here.

Returns: a low-precision decimal

Link to this function velocity(this, reference_frame)

The velocity of the center of mass of the vessel, in the given reference frame.

Returns the velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the body in meters per second.

  • reference_frame — The reference frame that the returned velocity vector is in.

Returns: {double, double, double}, where double is a high precision decimal