Vessel¶

class
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
SpaceCenter.active_vessel
orSpaceCenter.vessels
.
name
¶ The name of the vessel.
Attribute: Can be read or written Return type: string

type
¶ The type of the vessel.
Attribute: Can be read or written Return type: SpaceCenter.VesselType

situation
¶ The situation the vessel is in.
Attribute: Readonly, cannot be set Return type: SpaceCenter.VesselSituation

recoverable
¶ Whether the vessel is recoverable.
Attribute: Readonly, cannot be set Return type: boolean

recover
()¶ Recover the vessel.

met
¶ The mission elapsed time in seconds.
Attribute: Readonly, cannot be set Return type: number

biome
¶ The name of the biome the vessel is currently in.
Attribute: Readonly, cannot be set Return type: string

flight
([reference_frame = None])¶ Returns a
SpaceCenter.Flight
object that can be used to get flight telemetry for the vessel, in the specified reference frame.Parameters: reference_frame (SpaceCenter.ReferenceFrame) – Reference frame. Defaults to the vessel’s surface reference frame ( SpaceCenter.Vessel.surface_reference_frame
).Return type: SpaceCenter.Flight
Note
When this is called with no arguments, the vessel’s surface reference frame is used. This reference frame moves with the vessel, therefore velocities and speeds returned by the flight object will be zero. See the reference frames tutorial for examples of getting the orbital and surface speeds of a vessel.

orbit
¶ The current orbit of the vessel.
Attribute: Readonly, cannot be set Return type: SpaceCenter.Orbit

control
¶ Returns a
SpaceCenter.Control
object that can be used to manipulate the vessel’s control inputs. For example, its pitch/yaw/roll controls, RCS and thrust.Attribute: Readonly, cannot be set Return type: SpaceCenter.Control

comms
¶ Returns a
SpaceCenter.Comms
object that can be used to interact with CommNet for this vessel.Attribute: Readonly, cannot be set Return type: SpaceCenter.Comms

auto_pilot
¶ An
SpaceCenter.AutoPilot
object, that can be used to perform simple autopiloting of the vessel.Attribute: Readonly, cannot be set Return type: SpaceCenter.AutoPilot

crew_capacity
¶ The number of crew that can occupy the vessel.
Attribute: Readonly, cannot be set Return type: number

crew_count
¶ The number of crew that are occupying the vessel.
Attribute: Readonly, cannot be set Return type: number

crew
¶ The crew in the vessel.
Attribute: Readonly, cannot be set Return type: List of SpaceCenter.CrewMember

resources
¶ A
SpaceCenter.Resources
object, that can used to get information about resources stored in the vessel.Attribute: Readonly, cannot be set Return type: SpaceCenter.Resources

resources_in_decouple_stage
(stage[, cumulative = True])¶ Returns a
SpaceCenter.Resources
object, that can used to get information about resources stored in a given stage.Parameters:  stage (number) – Get resources for parts that are decoupled in this stage.
 cumulative (boolean) – When
False
, returns the resources for parts decoupled in just the given stage. WhenTrue
returns the resources decoupled in the given stage and all subsequent stages combined.
Return type: Note
For details on stage numbering, see the discussion on Staging.

parts
¶ A
SpaceCenter.Parts
object, that can used to interact with the parts that make up this vessel.Attribute: Readonly, cannot be set Return type: SpaceCenter.Parts

mass
¶ The total mass of the vessel, including resources, in kg.
Attribute: Readonly, cannot be set Return type: number

dry_mass
¶ The total mass of the vessel, excluding resources, in kg.
Attribute: Readonly, cannot be set Return type: number

thrust
¶ The total thrust currently being produced by the vessel’s engines, in Newtons. This is computed by summing
SpaceCenter.Engine.thrust
for every engine in the vessel.Attribute: Readonly, cannot be set Return type: number

available_thrust
¶ Gets the total available thrust that can be produced by the vessel’s active engines, in Newtons. This is computed by summing
SpaceCenter.Engine.available_thrust
for every active engine in the vessel.Attribute: Readonly, cannot be set Return type: number

max_thrust
¶ The total maximum thrust that can be produced by the vessel’s active engines, in Newtons. This is computed by summing
SpaceCenter.Engine.max_thrust
for every active engine.Attribute: Readonly, cannot be set Return type: number

max_vacuum_thrust
¶ 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
SpaceCenter.Engine.max_vacuum_thrust
for every active engine.Attribute: Readonly, cannot be set Return type: number

specific_impulse
¶ The combined specific impulse of all active engines, in seconds. This is computed using the formula described here.
Attribute: Readonly, cannot be set Return type: number

vacuum_specific_impulse
¶ The combined vacuum specific impulse of all active engines, in seconds. This is computed using the formula described here.
Attribute: Readonly, cannot be set Return type: number

kerbin_sea_level_specific_impulse
¶ The combined specific impulse of all active engines at sea level on Kerbin, in seconds. This is computed using the formula described here.
Attribute: Readonly, cannot be set Return type: number

moment_of_inertia
¶ The moment of inertia of the vessel around its center of mass in \(kg.m^2\). The inertia values in the returned 3tuple are around the pitch, roll and yaw directions respectively. This corresponds to the vessels reference frame (
SpaceCenter.ReferenceFrame
).Attribute: Readonly, cannot be set Return type: Tuple of (number, number, number)

inertia_tensor
¶ The inertia tensor of the vessel around its center of mass, in the vessels reference frame (
SpaceCenter.ReferenceFrame
). Returns the 3x3 matrix as a list of elements, in rowmajor order.Attribute: Readonly, cannot be set Return type: List of number

available_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

available_reaction_wheel_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

available_rcs_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

available_engine_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

available_control_surface_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

available_other_torque
¶ 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 (
SpaceCenter.ReferenceFrame
). These axes are equivalent to the pitch, roll and yaw axes of the vessel.Attribute: Readonly, cannot be set Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

reference_frame
¶ 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 xaxis points out to the right of the vessel.
 The yaxis points in the forward direction of the vessel.
 The zaxis points out of the bottom off the vessel.
Attribute: Readonly, cannot be set Return type: SpaceCenter.ReferenceFrame

orbital_reference_frame
¶ 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 xaxis points in the orbital antiradial direction.
 The yaxis points in the orbital prograde direction.
 The zaxis points in the orbital normal direction.
Attribute: Readonly, cannot be set Return type: SpaceCenter.ReferenceFrame
Note
Be careful not to confuse this with ‘orbit’ mode on the navball.

surface_reference_frame
¶ 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 xaxis 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 yaxis 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 zaxis points eastwards towards the astronomical horizon (east, and tangential to the surface of the body – east on a compass when on the surface).
Attribute: Readonly, cannot be set Return type: SpaceCenter.ReferenceFrame
Note
Be careful not to confuse this with ‘surface’ mode on the navball.

surface_velocity_reference_frame
¶ 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 yaxis points in the direction of the vessel’s velocity vector, relative to the surface of the body being orbited.
 The zaxis is in the plane of the astronomical horizon.
 The xaxis is orthogonal to the other two axes.
Attribute: Readonly, cannot be set Return type: SpaceCenter.ReferenceFrame

position
(reference_frame)¶ The position of the center of mass of the vessel, in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned position vector is in. Returns: The position as a vector. Return type: Tuple of (number, number, number)

bounding_box
(reference_frame)¶ The axisaligned bounding box of the vessel in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned position vectors are in. Returns: The positions of the minimum and maximum vertices of the box, as position vectors. Return type: Tuple of (Tuple of (number, number, number), Tuple of (number, number, number))

velocity
(reference_frame)¶ The velocity of the center of mass of the vessel, in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned velocity vector is in. 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. Return type: Tuple of (number, number, number)

rotation
(reference_frame)¶ The rotation of the vessel, in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned rotation is in. Returns: The rotation as a quaternion of the form \((x, y, z, w)\). Return type: Tuple of (number, number, number, number)

direction
(reference_frame)¶ The direction in which the vessel is pointing, in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame that the returned direction is in. Returns: The direction as a unit vector. Return type: Tuple of (number, number, number)

angular_velocity
(reference_frame)¶ The angular velocity of the vessel, in the given reference frame.
Parameters: reference_frame (SpaceCenter.ReferenceFrame) – The reference frame the returned angular velocity is in. 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 righthand rule. Return type: Tuple of (number, number, number)


class
VesselType
¶ The type of a vessel. See
SpaceCenter.Vessel.type
.
base
¶ Base.

debris
¶ Debris.

lander
¶ Lander.

plane
¶ Plane.

probe
¶ Probe.

relay
¶ Relay.

rover
¶ Rover.

ship
¶ Ship.

station
¶ Station.


class
VesselSituation
¶ The situation a vessel is in. See
SpaceCenter.Vessel.situation
.
docked
¶ Vessel is docked to another.

escaping
¶ Escaping.

flying
¶ Vessel is flying through an atmosphere.

landed
¶ Vessel is landed on the surface of a body.

orbiting
¶ Vessel is orbiting a body.

pre_launch
¶ Vessel is awaiting launch.

splashed
¶ Vessel has splashed down in an ocean.

sub_orbital
¶ Vessel is on a suborbital trajectory.


class
CrewMember
¶ Represents crew in a vessel. Can be obtained using
SpaceCenter.Vessel.crew
.
name
¶ The crew members name.
Attribute: Can be read or written Return type: string

type
¶ The type of crew member.
Attribute: Readonly, cannot be set Return type: SpaceCenter.CrewMemberType

on_mission
¶ Whether the crew member is on a mission.
Attribute: Readonly, cannot be set Return type: boolean

courage
¶ The crew members courage.
Attribute: Can be read or written Return type: number

stupidity
¶ The crew members stupidity.
Attribute: Can be read or written Return type: number

experience
¶ The crew members experience.
Attribute: Can be read or written Return type: number

badass
¶ Whether the crew member is a badass.
Attribute: Can be read or written Return type: boolean

veteran
¶ Whether the crew member is a veteran.
Attribute: Can be read or written Return type: boolean
