.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.SpaceCenter Vessel ====== .. type:: public 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 :meth:`getActiveVessel()` or :meth:`getVessels()`. .. method:: String getName() .. method:: void setName(String value) The name of the vessel. .. method:: VesselType getType() .. method:: void setType(VesselType value) The type of the vessel. .. method:: VesselSituation getSituation() The situation the vessel is in. .. method:: boolean getRecoverable() Whether the vessel is recoverable. .. method:: void recover() Recover the vessel. .. method:: double getMET() The mission elapsed time in seconds. .. method:: String getBiome() The name of the biome the vessel is currently in. .. method:: Flight flight(ReferenceFrame referenceFrame) Returns a :type:`Flight` object that can be used to get flight telemetry for the vessel, in the specified reference frame. :param ReferenceFrame referenceFrame: Reference frame. Defaults to the vessel's surface reference frame (:meth:`Vessel.getSurfaceReferenceFrame()`). :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 `. .. method:: Orbit getOrbit() The current orbit of the vessel. .. method:: Control getControl() 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 .. method:: Comms getComms() Returns a :type:`Comms` object that can be used to interact with CommNet for this vessel. :Game Scenes: Flight .. method:: AutoPilot getAutoPilot() An :type:`AutoPilot` object, that can be used to perform simple auto-piloting of the vessel. :Game Scenes: Flight .. method:: int getCrewCapacity() The number of crew that can occupy the vessel. .. method:: int getCrewCount() The number of crew that are occupying the vessel. .. method:: java.util.List getCrew() The crew in the vessel. .. method:: Resources getResources() A :type:`Resources` object, that can used to get information about resources stored in the vessel. :Game Scenes: Flight .. method:: Resources resourcesInDecoupleStage(int stage, boolean cumulative) Returns a :type:`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 boolean 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:`java-api-parts-staging`. .. method:: Parts getParts() A :type:`Parts` object, that can used to interact with the parts that make up this vessel. :Game Scenes: Flight .. method:: float getMass() The total mass of the vessel, including resources, in kg. :Game Scenes: Flight .. method:: float getDryMass() The total mass of the vessel, excluding resources, in kg. :Game Scenes: Flight .. method:: float getThrust() The total thrust currently being produced by the vessel's engines, in Newtons. This is computed by summing :meth:`Engine.getThrust()` for every engine in the vessel. :Game Scenes: Flight .. method:: float getAvailableThrust() Gets the total available thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :meth:`Engine.getAvailableThrust()` 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(double)` for every active engine in the vessel. Takes the given pressure into account. :param double pressure: Atmospheric pressure in atmospheres :Game Scenes: Flight .. method:: float getMaxThrust() The total maximum thrust that can be produced by the vessel's active engines, in Newtons. This is computed by summing :meth:`Engine.getMaxThrust()` 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(double)` for every active engine. Takes the given pressure into account. :param double pressure: Atmospheric pressure in atmospheres :Game Scenes: Flight .. method:: float getMaxVacuumThrust() 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 :meth:`Engine.getMaxVacuumThrust()` for every active engine. :Game Scenes: Flight .. method:: float getSpecificImpulse() 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. :param double pressure: Atmospheric pressure in atmospheres :Game Scenes: Flight .. method:: float getVacuumSpecificImpulse() The combined vacuum specific impulse of all active engines, in seconds. This is computed using the formula `described here `_. :Game Scenes: Flight .. method:: float getKerbinSeaLevelSpecificImpulse() 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 .. method:: org.javatuples.Triplet getMomentOfInertia() 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 .. method:: java.util.List getInertiaTensor() 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. .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableTorque() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableReactionWheelTorque() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableRCSTorque() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableRCSForce() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableEngineTorque() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableControlSurfaceTorque() 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 .. method:: org.javatuples.Pair,org.javatuples.Triplet> getAvailableOtherTorque() 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 .. method:: ReferenceFrame getReferenceFrame() 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 .. method:: ReferenceFrame getOrbitalReferenceFrame() 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 .. method:: ReferenceFrame getSurfaceReferenceFrame() 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 .. method:: ReferenceFrame getSurfaceVelocityReferenceFrame() 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:: org.javatuples.Triplet position(ReferenceFrame referenceFrame) The position of the center of mass of the vessel, in the given reference frame. :param ReferenceFrame referenceFrame: The reference frame that the returned position vector is in. :returns: The position as a vector. :Game Scenes: Flight .. method:: org.javatuples.Pair,org.javatuples.Triplet> boundingBox(ReferenceFrame referenceFrame) The axis-aligned bounding box of the vessel in the given reference frame. :param ReferenceFrame 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:: org.javatuples.Triplet velocity(ReferenceFrame referenceFrame) The velocity of the center of mass of the vessel, in the given reference frame. :param ReferenceFrame 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:: org.javatuples.Quartet rotation(ReferenceFrame referenceFrame) The rotation of the vessel, in the given reference frame. :param ReferenceFrame 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:: org.javatuples.Triplet direction(ReferenceFrame referenceFrame) The direction in which the vessel is pointing, in the given reference frame. :param ReferenceFrame referenceFrame: The reference frame that the returned direction is in. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet angularVelocity(ReferenceFrame referenceFrame) The angular velocity of the vessel, in the given reference frame. :param ReferenceFrame 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 .. type:: public enum VesselType The type of a vessel. See :meth:`Vessel.getType()`. .. field:: public VesselType BASE Base. .. field:: public VesselType DEBRIS Debris. .. field:: public VesselType LANDER Lander. .. field:: public VesselType PLANE Plane. .. field:: public VesselType PROBE Probe. .. field:: public VesselType RELAY Relay. .. field:: public VesselType ROVER Rover. .. field:: public VesselType SHIP Ship. .. field:: public VesselType STATION Station. .. field:: public VesselType SPACE_OBJECT SpaceObject. .. field:: public VesselType UNKNOWN Unknown. .. field:: public VesselType EVA EVA. .. field:: public VesselType FLAG Flag. .. field:: public VesselType DEPLOYED_SCIENCE_CONTROLLER DeployedScienceController. .. field:: public VesselType DEPLOYED_SCIENCE_PART DeploedSciencePart. .. field:: public VesselType DROPPED_PART DroppedPart. .. field:: public VesselType DEPLOYED_GROUND_PART DeployedGroundPart. .. type:: public enum VesselSituation The situation a vessel is in. See :meth:`Vessel.getSituation()`. .. field:: public VesselSituation DOCKED Vessel is docked to another. .. field:: public VesselSituation ESCAPING Escaping. .. field:: public VesselSituation FLYING Vessel is flying through an atmosphere. .. field:: public VesselSituation LANDED Vessel is landed on the surface of a body. .. field:: public VesselSituation ORBITING Vessel is orbiting a body. .. field:: public VesselSituation PRE_LAUNCH Vessel is awaiting launch. .. field:: public VesselSituation SPLASHED Vessel has splashed down in an ocean. .. field:: public VesselSituation SUB_ORBITAL Vessel is on a sub-orbital trajectory. .. type:: public class CrewMember Represents crew in a vessel. Can be obtained using :meth:`Vessel.getCrew()`. .. method:: String getName() .. method:: void setName(String value) The crew members name. .. method:: CrewMemberType getType() The type of crew member. .. method:: boolean getOnMission() Whether the crew member is on a mission. .. method:: float getCourage() .. method:: void setCourage(float value) The crew members courage. .. method:: float getStupidity() .. method:: void setStupidity(float value) The crew members stupidity. .. method:: float getExperience() .. method:: void setExperience(float value) The crew members experience. .. method:: boolean getBadass() .. method:: void setBadass(boolean value) Whether the crew member is a badass. .. method:: boolean getVeteran() .. method:: void setVeteran(boolean value) Whether the crew member is a veteran. .. method:: String getTrait() The crew member's job. .. method:: CrewMemberGender getGender() The crew member's gender. .. method:: RosterStatus getRosterStatus() The crew member's current roster status. .. method:: SuitType getSuitType() .. method:: void setSuitType(SuitType value) The crew member's suit type. .. method:: java.util.List getCareerLogFlights() The flight IDs for each entry in the career flight log. .. method:: java.util.List getCareerLogTypes() The type for each entry in the career flight log. .. method:: java.util.List getCareerLogTargets() The body name for each entry in the career flight log. .. type:: public enum CrewMemberType The type of a crew member. See :meth:`CrewMember.getType()`. .. field:: public CrewMemberType APPLICANT An applicant for crew. .. field:: public CrewMemberType CREW Rocket crew. .. field:: public CrewMemberType TOURIST A tourist. .. field:: public CrewMemberType UNOWNED An unowned crew member. .. type:: public enum CrewMemberGender A crew member's gender. See :meth:`CrewMember.getGender()`. .. field:: public CrewMemberGender MALE Male. .. field:: public CrewMemberGender FEMALE Female. .. type:: public enum RosterStatus A crew member's roster status. See :meth:`CrewMember.getRosterStatus()`. .. field:: public RosterStatus AVAILABLE Available. .. field:: public RosterStatus ASSIGNED Assigned. .. field:: public RosterStatus DEAD Dead. .. field:: public RosterStatus MISSING Missing. .. type:: public enum SuitType A crew member's suit type. See :meth:`CrewMember.getSuitType()`. .. field:: public SuitType DEFAULT Default. .. field:: public SuitType VINTAGE Vintage. .. field:: public SuitType FUTURE Future. .. field:: public SuitType SLIM Slim.