space_ex v0.3.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(conn, this, referenceFrame)

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.

  • referenceFrame — The reference frame the returned angular velocity is in.
Link to this function auto_pilot(conn, this)

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

Link to this function available_control_surface_torque(conn, 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.

Link to this function available_engine_torque(conn, 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.

Link to this function available_other_torque(conn, 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.

Link to this function available_rcs_torque(conn, 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.

Link to this function available_reaction_wheel_torque(conn, 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.

Link to this function available_thrust(conn, 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/2 for every active engine in the vessel.

Link to this function available_torque(conn, 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.

Link to this function biome(conn, this)

The name of the biome the vessel is currently in.

Link to this function bounding_box(conn, this, referenceFrame)

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.

  • referenceFrame — The reference frame that the returned position vectors are in.
Link to this function comms(conn, this)

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

Link to this function control(conn, this)

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.

Link to this function crew(conn, this)

The crew in the vessel.

Link to this function crew_capacity(conn, this)

The number of crew that can occupy the vessel.

Link to this function crew_count(conn, this)

The number of crew that are occupying the vessel.

Link to this function direction(conn, this, referenceFrame)

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

Returns: The direction as a unit vector.

  • referenceFrame — The reference frame that the returned direction is in.
Link to this function dry_mass(conn, this)

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

Link to this function flight(conn, this, referenceFrame)

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

Link to this function inertia_tensor(conn, 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.

Link to this function kerbin_sea_level_specific_impulse(conn, this)

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

This is computed using the formula described here.

Link to this function mass(conn, this)

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

Link to this function max_thrust(conn, 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/2 for every active engine.

Link to this function max_vacuum_thrust(conn, 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/2 for every active engine.

Link to this function met(conn, this)

The mission elapsed time in seconds.

Link to this function moment_of_inertia(conn, 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).

Link to this function name(conn, this)

The name of the vessel.

Link to this function orbit(conn, this)

The current orbit of the vessel.

Link to this function orbital_reference_frame(conn, 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.

Link to this function parts(conn, this)

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

Link to this function position(conn, this, referenceFrame)

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

Returns: The position as a vector.

  • referenceFrame — The reference frame that the returned position vector is in.
Link to this function recover(conn, this)

Recover the vessel.

Link to this function recoverable(conn, this)

Whether the vessel is recoverable.

Link to this function reference_frame(conn, 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.

Link to this function resources(conn, this)

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

Link to this function resources_in_decouple_stage(conn, this, stage, cumulative)

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.

Link to this function rotation(conn, this, referenceFrame)

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

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

  • referenceFrame — The reference frame that the returned rotation is in.
Link to this function set_name(conn, this, value)

The name of the vessel.

Link to this function set_type(conn, this, value)

The type of the vessel.

Link to this function situation(conn, this)

The situation the vessel is in.

Link to this function specific_impulse(conn, this)

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

This is computed using the formula described here.

Link to this function surface_reference_frame(conn, 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.

Link to this function surface_velocity_reference_frame(conn, 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.

Link to this function thrust(conn, this)

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

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

Link to this function type(conn, this)

The type of the vessel.

Link to this function vacuum_specific_impulse(conn, this)

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

This is computed using the formula described here.

Link to this function velocity(conn, this, referenceFrame)

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.

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