.. default-domain:: py .. highlight:: py .. currentmodule:: SpaceCenter 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 :attr:`active_vessel` or :attr:`vessels`. .. attribute:: name The name of the vessel. :Attribute: Can be read or written :rtype: str .. attribute:: type The type of the vessel. :Attribute: Can be read or written :rtype: :class:`VesselType` .. attribute:: situation The situation the vessel is in. :Attribute: Read-only, cannot be set :rtype: :class:`VesselSituation` .. attribute:: recoverable Whether the vessel is recoverable. :Attribute: Read-only, cannot be set :rtype: bool .. method:: recover() Recover the vessel. .. attribute:: met The mission elapsed time in seconds. :Attribute: Read-only, cannot be set :rtype: float .. attribute:: biome The name of the biome the vessel is currently in. :Attribute: Read-only, cannot be set :rtype: str .. method:: flight([reference_frame = None]) Returns a :class:`Flight` object that can be used to get flight telemetry for the vessel, in the specified reference frame. :param ReferenceFrame reference_frame: Reference frame. Defaults to the vessel's surface reference frame (:attr:`Vessel.surface_reference_frame`). :rtype: :class:`Flight` :Game Scenes: 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 :rst:ref:`reference frames tutorial ` for examples of getting :rst:ref:`the orbital and surface speeds of a vessel `. .. attribute:: orbit The current orbit of the vessel. :Attribute: Read-only, cannot be set :rtype: :class:`Orbit` .. attribute:: control Returns a :class:`Control` object that can be used to manipulate the vessel's control inputs. For example, its pitch/yaw/roll controls, RCS and thrust. :Attribute: Read-only, cannot be set :rtype: :class:`Control` :Game Scenes: Flight .. attribute:: comms Returns a :class:`Comms` object that can be used to interact with CommNet for this vessel. :Attribute: Read-only, cannot be set :rtype: :class:`Comms` :Game Scenes: Flight .. attribute:: auto_pilot An :class:`AutoPilot` object, that can be used to perform simple auto-piloting of the vessel. :Attribute: Read-only, cannot be set :rtype: :class:`AutoPilot` :Game Scenes: Flight .. attribute:: crew_capacity The number of crew that can occupy the vessel. :Attribute: Read-only, cannot be set :rtype: int .. attribute:: crew_count The number of crew that are occupying the vessel. :Attribute: Read-only, cannot be set :rtype: int .. attribute:: crew The crew in the vessel. :Attribute: Read-only, cannot be set :rtype: list(:class:`CrewMember`) .. attribute:: resources A :class:`Resources` object, that can used to get information about resources stored in the vessel. :Attribute: Read-only, cannot be set :rtype: :class:`Resources` :Game Scenes: Flight .. method:: resources_in_decouple_stage(stage, [cumulative = True]) Returns a :class:`Resources` object, that can used to get information about resources stored in a given *stage*. :param int stage: Get resources for parts that are decoupled in this stage. :param bool 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. :rtype: :class:`Resources` :Game Scenes: Flight .. note:: For details on stage numbering, see the discussion on :rst:ref:`python-api-parts-staging`. .. attribute:: parts A :class:`Parts` object, that can used to interact with the parts that make up this vessel. :Attribute: Read-only, cannot be set :rtype: :class:`Parts` :Game Scenes: Flight .. attribute:: mass The total mass of the vessel, including resources, in kg. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: dry_mass The total mass of the vessel, excluding resources, in kg. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: thrust The total thrust currently being produced by the vessel's engines, in Newtons. This is computed by summing :attr:`Engine.thrust` for every engine in the vessel. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: available_thrust Gets the total available thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :attr:`Engine.available_thrust` for every active engine in the vessel. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. method:: available_thrust_at(pressure) Gets the total available thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :meth:`Engine.available_thrust_at` for every active engine in the vessel. Takes the given pressure into account. :param float pressure: Atmospheric pressure in atmospheres :rtype: float :Game Scenes: Flight .. attribute:: max_thrust The total maximum thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :attr:`Engine.max_thrust` for every active engine. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. method:: max_thrust_at(pressure) The total maximum thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :meth:`Engine.max_thrust_at` for every active engine. Takes the given pressure into account. :param float pressure: Atmospheric pressure in atmospheres :rtype: float :Game Scenes: Flight .. attribute:: 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 :attr:`Engine.max_vacuum_thrust` for every active engine. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: specific_impulse The combined specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. method:: specific_impulse_at(pressure) The combined specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. Takes the given pressure into account. :param float pressure: Atmospheric pressure in atmospheres :rtype: float :Game Scenes: Flight .. attribute:: vacuum_specific_impulse The combined vacuum specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: 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: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: moment_of_inertia The moment of inertia of the vessel around its center of mass in :math:`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 (:class:`ReferenceFrame`). :Attribute: Read-only, cannot be set :rtype: tuple(float, float, float) :Game Scenes: Flight .. attribute:: inertia_tensor The inertia tensor of the vessel around its center of mass, in the vessels reference frame (:class:`ReferenceFrame`). Returns the 3x3 matrix as a list of elements, in row-major order. :Attribute: Read-only, cannot be set :rtype: list(float) .. attribute:: 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 :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_reaction_wheel_torque The maximum torque that the currently active and powered reaction wheels can generate. Returns the torques in :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_rcs_torque The maximum torque that the currently active RCS thrusters can generate. Returns the torques in :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_rcs_force The maximum force that the currently active RCS thrusters can generate. Returns the forces in :math:`N` along each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the right, forward and bottom directions of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_engine_torque The maximum torque that the currently active and gimballed engines can generate. Returns the torques in :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_control_surface_torque The maximum torque that the aerodynamic control surfaces can generate. Returns the torques in :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: available_other_torque The maximum torque that parts (excluding reaction wheels, gimballed engines, RCS and control surfaces) can generate. Returns the torques in :math:`N.m` around each of the coordinate axes of the vessels reference frame (:class:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Attribute: Read-only, cannot be set :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. attribute:: 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 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. :Attribute: Read-only, cannot be set :rtype: :class:`ReferenceFrame` :Game Scenes: Flight .. figure:: /images/reference-frames/vessel-aircraft.png :align: center Vessel reference frame origin and axes for the Aeris 3A aircraft .. figure:: /images/reference-frames/vessel-rocket.png :align: center Vessel reference frame origin and axes for the Kerbal-X rocket .. attribute:: 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 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. :Attribute: Read-only, cannot be set :rtype: :class:`ReferenceFrame` :Game Scenes: Flight .. note:: Be careful not to confuse this with 'orbit' mode on the navball. .. figure:: /images/reference-frames/vessel-orbital.png :align: center Vessel orbital reference frame origin and axes .. attribute:: 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 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). :Attribute: Read-only, cannot be set :rtype: :class:`ReferenceFrame` :Game Scenes: Flight .. note:: Be careful not to confuse this with 'surface' mode on the navball. .. figure:: /images/reference-frames/vessel-surface.png :align: center Vessel surface reference frame origin and axes .. attribute:: 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 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. :Attribute: Read-only, cannot be set :rtype: :class:`ReferenceFrame` :Game Scenes: Flight .. figure:: /images/reference-frames/vessel-surface-velocity.png :align: center Vessel surface velocity reference frame origin and axes .. method:: position(reference_frame) The position of the center of mass of the vessel, in the given reference frame. :param ReferenceFrame reference_frame: The reference frame that the returned position vector is in. :returns: The position as a vector. :rtype: tuple(float, float, float) :Game Scenes: Flight .. method:: bounding_box(reference_frame) The axis-aligned bounding box of the vessel in the given reference frame. :param ReferenceFrame reference_frame: 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. :rtype: tuple(tuple(float, float, float), tuple(float, float, float)) :Game Scenes: Flight .. method:: velocity(reference_frame) The velocity of the center of mass of the vessel, in the given reference frame. :param ReferenceFrame reference_frame: 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. :rtype: tuple(float, float, float) :Game Scenes: Flight .. method:: rotation(reference_frame) The rotation of the vessel, in the given reference frame. :param ReferenceFrame reference_frame: The reference frame that the returned rotation is in. :returns: The rotation as a quaternion of the form :math:`(x, y, z, w)`. :rtype: tuple(float, float, float, float) :Game Scenes: Flight .. method:: direction(reference_frame) The direction in which the vessel is pointing, in the given reference frame. :param ReferenceFrame reference_frame: The reference frame that the returned direction is in. :returns: The direction as a unit vector. :rtype: tuple(float, float, float) :Game Scenes: Flight .. method:: angular_velocity(reference_frame) The angular velocity of the vessel, in the given reference frame. :param ReferenceFrame reference_frame: 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 right-hand rule. :rtype: tuple(float, float, float) :Game Scenes: Flight .. class:: VesselType The type of a vessel. See :attr:`Vessel.type`. .. data:: base Base. .. data:: debris Debris. .. data:: lander Lander. .. data:: plane Plane. .. data:: probe Probe. .. data:: relay Relay. .. data:: rover Rover. .. data:: ship Ship. .. data:: station Station. .. data:: space_object SpaceObject. .. data:: unknown Unknown. .. data:: eva EVA. .. data:: flag Flag. .. data:: deployed_science_controller DeployedScienceController. .. data:: deployed_science_part DeploedSciencePart. .. data:: dropped_part DroppedPart. .. data:: deployed_ground_part DeployedGroundPart. .. class:: VesselSituation The situation a vessel is in. See :attr:`Vessel.situation`. .. data:: docked Vessel is docked to another. .. data:: escaping Escaping. .. data:: flying Vessel is flying through an atmosphere. .. data:: landed Vessel is landed on the surface of a body. .. data:: orbiting Vessel is orbiting a body. .. data:: pre_launch Vessel is awaiting launch. .. data:: splashed Vessel has splashed down in an ocean. .. data:: sub_orbital Vessel is on a sub-orbital trajectory. .. class:: CrewMember Represents crew in a vessel. Can be obtained using :attr:`Vessel.crew`. .. attribute:: name The crew members name. :Attribute: Can be read or written :rtype: str .. attribute:: type The type of crew member. :Attribute: Read-only, cannot be set :rtype: :class:`CrewMemberType` .. attribute:: on_mission Whether the crew member is on a mission. :Attribute: Read-only, cannot be set :rtype: bool .. attribute:: courage The crew members courage. :Attribute: Can be read or written :rtype: float .. attribute:: stupidity The crew members stupidity. :Attribute: Can be read or written :rtype: float .. attribute:: experience The crew members experience. :Attribute: Can be read or written :rtype: float .. attribute:: badass Whether the crew member is a badass. :Attribute: Can be read or written :rtype: bool .. attribute:: veteran Whether the crew member is a veteran. :Attribute: Can be read or written :rtype: bool .. attribute:: trait The crew member's job. :Attribute: Read-only, cannot be set :rtype: str .. attribute:: gender The crew member's gender. :Attribute: Read-only, cannot be set :rtype: :class:`CrewMemberGender` .. attribute:: roster_status The crew member's current roster status. :Attribute: Read-only, cannot be set :rtype: :class:`RosterStatus` .. attribute:: suit_type The crew member's suit type. :Attribute: Can be read or written :rtype: :class:`SuitType` .. attribute:: career_log_flights The flight IDs for each entry in the career flight log. :Attribute: Read-only, cannot be set :rtype: list(int) .. attribute:: career_log_types The type for each entry in the career flight log. :Attribute: Read-only, cannot be set :rtype: list(str) .. attribute:: career_log_targets The body name for each entry in the career flight log. :Attribute: Read-only, cannot be set :rtype: list(str) .. class:: CrewMemberType The type of a crew member. See :attr:`CrewMember.type`. .. data:: applicant An applicant for crew. .. data:: crew Rocket crew. .. data:: tourist A tourist. .. data:: unowned An unowned crew member. .. class:: CrewMemberGender A crew member's gender. See :attr:`CrewMember.gender`. .. data:: male Male. .. data:: female Female. .. class:: RosterStatus A crew member's roster status. See :attr:`CrewMember.roster_status`. .. data:: available Available. .. data:: assigned Assigned. .. data:: dead Dead. .. data:: missing Missing. .. class:: SuitType A crew member's suit type. See :attr:`CrewMember.suit_type`. .. data:: default Default. .. data:: vintage Vintage. .. data:: future Future. .. data:: slim Slim.