.. default-domain:: csharp .. highlight:: csharp .. namespace:: KRPC.Client.Services.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 :prop:`SpaceCenter.ActiveVessel` or :prop:`SpaceCenter.Vessels`. .. property:: string Name { get; set; } The name of the vessel. :Game Scenes: All .. property:: VesselType Type { get; set; } The type of the vessel. :Game Scenes: All .. property:: VesselSituation Situation { get; } The situation the vessel is in. :Game Scenes: All .. property:: bool Recoverable { get; } Whether the vessel is recoverable. :Game Scenes: All .. method:: void Recover() Recover the vessel. :Game Scenes: All .. property:: double MET { get; } The mission elapsed time in seconds. :Game Scenes: All .. property:: string Biome { get; } The name of the biome the vessel is currently in. :Game Scenes: All .. method:: Flight Flight(ReferenceFrame referenceFrame = null) Returns a :type:`Flight` object that can be used to get flight telemetry for the vessel, in the specified reference frame. :parameters: * **referenceFrame** -- Reference frame. Defaults to the vessel's surface reference frame (:prop:`Vessel.SurfaceReferenceFrame`). :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 `. .. property:: Orbit Orbit { get; } The current orbit of the vessel. :Game Scenes: All .. property:: Control Control { get; } Returns a :type:`Control` object that can be used to manipulate the vessel's control inputs. For example, its pitch/yaw/roll controls, RCS and thrust. :Game Scenes: Flight .. property:: Comms Comms { get; } Returns a :type:`Comms` object that can be used to interact with CommNet for this vessel. :Game Scenes: Flight .. property:: AutoPilot AutoPilot { get; } An :type:`AutoPilot` object, that can be used to perform simple auto-piloting of the vessel. :Game Scenes: Flight .. property:: int CrewCapacity { get; } The number of crew that can occupy the vessel. :Game Scenes: All .. property:: int CrewCount { get; } The number of crew that are occupying the vessel. :Game Scenes: All .. property:: System.Collections.Generic.IList Crew { get; } The crew in the vessel. :Game Scenes: All .. property:: Resources Resources { get; } A :type:`Resources` object, that can used to get information about resources stored in the vessel. :Game Scenes: Flight .. method:: Resources ResourcesInDecoupleStage(int stage, bool cumulative = true) Returns a :type:`Resources` object, that can used to get information about resources stored in a given *stage*. :parameters: * **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. :Game Scenes: Flight .. note:: For details on stage numbering, see the discussion on :rst:ref:`csharp-api-parts-staging`. .. property:: Parts Parts { get; } A :type:`Parts` object, that can used to interact with the parts that make up this vessel. :Game Scenes: Flight .. property:: float Mass { get; } The total mass of the vessel, including resources, in kg. :Game Scenes: Flight .. property:: float DryMass { get; } The total mass of the vessel, excluding resources, in kg. :Game Scenes: Flight .. property:: float Thrust { get; } The total thrust currently being produced by the vessel's engines, in Newtons. This is computed by summing :prop:`Engine.Thrust` for every engine in the vessel. :Game Scenes: Flight .. property:: float AvailableThrust { get; } Gets the total available thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :prop:`Engine.AvailableThrust` for every active engine in the vessel. :Game Scenes: Flight .. method:: float AvailableThrustAt(double 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.AvailableThrustAt` for every active engine in the vessel. Takes the given pressure into account. :parameters: * **pressure** -- Atmospheric pressure in atmospheres :Game Scenes: Flight .. property:: float MaxThrust { get; } The total maximum thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :prop:`Engine.MaxThrust` for every active engine. :Game Scenes: Flight .. method:: float MaxThrustAt(double pressure) The total maximum thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :meth:`Engine.MaxThrustAt` for every active engine. Takes the given pressure into account. :parameters: * **pressure** -- Atmospheric pressure in atmospheres :Game Scenes: Flight .. property:: float MaxVacuumThrust { get; } 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 :prop:`Engine.MaxVacuumThrust` for every active engine. :Game Scenes: Flight .. property:: float SpecificImpulse { get; } The combined specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. :Game Scenes: Flight .. method:: float SpecificImpulseAt(double 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. :parameters: * **pressure** -- Atmospheric pressure in atmospheres :Game Scenes: Flight .. property:: float VacuumSpecificImpulse { get; } The combined vacuum specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. :Game Scenes: Flight .. property:: float KerbinSeaLevelSpecificImpulse { get; } The combined specific impulse of all active engines at sea level on Kerbin, in seconds. This is computed using the formula `described here `_. :Game Scenes: Flight .. property:: System.Tuple MomentOfInertia { get; } 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 (:type:`ReferenceFrame`). :Game Scenes: Flight .. property:: System.Collections.Generic.IList InertiaTensor { get; } The inertia tensor of the vessel around its center of mass, in the vessels reference frame (:type:`ReferenceFrame`). Returns the 3x3 matrix as a list of elements, in row-major order. :Game Scenes: All .. property:: System.Tuple,System.Tuple> AvailableTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableReactionWheelTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableRCSTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableRCSForce { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the right, forward and bottom directions of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableEngineTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableControlSurfaceTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: System.Tuple,System.Tuple> AvailableOtherTorque { get; } 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 (:type:`ReferenceFrame`). These axes are equivalent to the pitch, roll and yaw axes of the vessel. :Game Scenes: Flight .. property:: ReferenceFrame ReferenceFrame { get; } 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. :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 .. property:: ReferenceFrame OrbitalReferenceFrame { get; } 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. :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 .. property:: ReferenceFrame SurfaceReferenceFrame { get; } 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). :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 .. property:: ReferenceFrame SurfaceVelocityReferenceFrame { get; } 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. :Game Scenes: Flight .. figure:: /images/reference-frames/vessel-surface-velocity.png :align: center Vessel surface velocity reference frame origin and axes .. method:: System.Tuple Position(ReferenceFrame referenceFrame) The position of the center of mass of the vessel, in the given reference frame. :parameters: * **referenceFrame** -- The reference frame that the returned position vector is in. :returns: The position as a vector. :Game Scenes: Flight .. method:: System.Tuple,System.Tuple> BoundingBox(ReferenceFrame referenceFrame) The axis-aligned bounding box of the vessel in the given reference frame. :parameters: * **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. :Game Scenes: Flight .. method:: System.Tuple Velocity(ReferenceFrame referenceFrame) The velocity of the center of mass of the vessel, in the given reference frame. :parameters: * **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. :Game Scenes: Flight .. method:: System.Tuple Rotation(ReferenceFrame referenceFrame) The rotation of the vessel, in the given reference frame. :parameters: * **referenceFrame** -- The reference frame that the returned rotation is in. :returns: The rotation as a quaternion of the form :math:`(x, y, z, w)`. :Game Scenes: Flight .. method:: System.Tuple Direction(ReferenceFrame referenceFrame) The direction in which the vessel is pointing, in the given reference frame. :parameters: * **referenceFrame** -- The reference frame that the returned direction is in. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: System.Tuple AngularVelocity(ReferenceFrame referenceFrame) The angular velocity of the vessel, in the given reference frame. :parameters: * **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 right-hand rule. :Game Scenes: Flight .. enum:: VesselType The type of a vessel. See :prop:`Vessel.Type`. .. value:: Base Base. .. value:: Debris Debris. .. value:: Lander Lander. .. value:: Plane Plane. .. value:: Probe Probe. .. value:: Relay Relay. .. value:: Rover Rover. .. value:: Ship Ship. .. value:: Station Station. .. value:: SpaceObject SpaceObject. .. value:: Unknown Unknown. .. value:: EVA EVA. .. value:: Flag Flag. .. value:: DeployedScienceController DeployedScienceController. .. value:: DeployedSciencePart DeploedSciencePart. .. value:: DroppedPart DroppedPart. .. value:: DeployedGroundPart DeployedGroundPart. .. enum:: VesselSituation The situation a vessel is in. See :prop:`Vessel.Situation`. .. value:: Docked Vessel is docked to another. .. value:: Escaping Escaping. .. value:: Flying Vessel is flying through an atmosphere. .. value:: Landed Vessel is landed on the surface of a body. .. value:: Orbiting Vessel is orbiting a body. .. value:: PreLaunch Vessel is awaiting launch. .. value:: Splashed Vessel has splashed down in an ocean. .. value:: SubOrbital Vessel is on a sub-orbital trajectory. .. class:: CrewMember Represents crew in a vessel. Can be obtained using :prop:`Vessel.Crew`. .. property:: string Name { get; set; } The crew members name. :Game Scenes: All .. property:: CrewMemberType Type { get; } The type of crew member. :Game Scenes: All .. property:: bool OnMission { get; } Whether the crew member is on a mission. :Game Scenes: All .. property:: float Courage { get; set; } The crew members courage. :Game Scenes: All .. property:: float Stupidity { get; set; } The crew members stupidity. :Game Scenes: All .. property:: float Experience { get; set; } The crew members experience. :Game Scenes: All .. property:: bool Badass { get; set; } Whether the crew member is a badass. :Game Scenes: All .. property:: bool Veteran { get; set; } Whether the crew member is a veteran. :Game Scenes: All .. property:: string Trait { get; } The crew member's job. :Game Scenes: All .. property:: CrewMemberGender Gender { get; } The crew member's gender. :Game Scenes: All .. property:: RosterStatus RosterStatus { get; } The crew member's current roster status. :Game Scenes: All .. property:: SuitType SuitType { get; set; } The crew member's suit type. :Game Scenes: All .. property:: System.Collections.Generic.IList CareerLogFlights { get; } The flight IDs for each entry in the career flight log. :Game Scenes: All .. property:: System.Collections.Generic.IList CareerLogTypes { get; } The type for each entry in the career flight log. :Game Scenes: All .. property:: System.Collections.Generic.IList CareerLogTargets { get; } The body name for each entry in the career flight log. :Game Scenes: All .. enum:: CrewMemberType The type of a crew member. See :prop:`CrewMember.Type`. .. value:: Applicant An applicant for crew. .. value:: Crew Rocket crew. .. value:: Tourist A tourist. .. value:: Unowned An unowned crew member. .. enum:: CrewMemberGender A crew member's gender. See :prop:`CrewMember.Gender`. .. value:: Male Male. .. value:: Female Female. .. enum:: RosterStatus A crew member's roster status. See :prop:`CrewMember.RosterStatus`. .. value:: Available Available. .. value:: Assigned Assigned. .. value:: Dead Dead. .. value:: Missing Missing. .. enum:: SuitType A crew member's suit type. See :prop:`CrewMember.SuitType`. .. value:: Default Default. .. value:: Vintage Vintage. .. value:: Future Future. .. value:: Slim Slim.