Vessel

krpc_SpaceCenter_Vessel_t

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 krpc_SpaceCenter_ActiveVessel() or krpc_SpaceCenter_Vessels().

krpc_error_t krpc_SpaceCenter_Vessel_Name(krpc_connection_t connection, char * * result)
void krpc_SpaceCenter_Vessel_set_Name(const char * value)

The name of the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Type(krpc_connection_t connection, krpc_SpaceCenter_VesselType_t * result)
void krpc_SpaceCenter_Vessel_set_Type(krpc_SpaceCenter_VesselType_t value)

The type of the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Situation(krpc_connection_t connection, krpc_SpaceCenter_VesselSituation_t * result)

The situation the vessel is in.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Recoverable(krpc_connection_t connection, bool * result)

Whether the vessel is recoverable.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Recover(krpc_connection_t connection)

Recover the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_MET(krpc_connection_t connection, double * result)

The mission elapsed time in seconds.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Biome(krpc_connection_t connection, char * * result)

The name of the biome the vessel is currently in.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Flight(krpc_connection_t connection, krpc_SpaceCenter_Flight_t * result, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)

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

Parameters:
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 reference frames tutorial for examples of getting the orbital and surface speeds of a vessel.

krpc_error_t krpc_SpaceCenter_Vessel_Orbit(krpc_connection_t connection, krpc_SpaceCenter_Orbit_t * result)

The current orbit of the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Control(krpc_connection_t connection, krpc_SpaceCenter_Control_t * result)

Returns a krpc_SpaceCenter_Control_t 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
krpc_error_t krpc_SpaceCenter_Vessel_Comms(krpc_connection_t connection, krpc_SpaceCenter_Comms_t * result)

Returns a krpc_SpaceCenter_Comms_t object that can be used to interact with CommNet for this vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AutoPilot(krpc_connection_t connection, krpc_SpaceCenter_AutoPilot_t * result)

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

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_CrewCapacity(krpc_connection_t connection, int32_t * result)

The number of crew that can occupy the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_CrewCount(krpc_connection_t connection, int32_t * result)

The number of crew that are occupying the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Crew(krpc_connection_t connection, krpc_list_object_t * result)

The crew in the vessel.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_Resources(krpc_connection_t connection, krpc_SpaceCenter_Resources_t * result)

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

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_ResourcesInDecoupleStage(krpc_connection_t connection, krpc_SpaceCenter_Resources_t * result, int32_t stage, bool cumulative)

Returns a krpc_SpaceCenter_Resources_t 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 Staging.

krpc_error_t krpc_SpaceCenter_Vessel_Parts(krpc_connection_t connection, krpc_SpaceCenter_Parts_t * result)

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

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_Mass(krpc_connection_t connection, float * result)

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

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_DryMass(krpc_connection_t connection, float * result)

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

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_Thrust(krpc_connection_t connection, float * result)

The total thrust currently being produced by the vessel’s engines, in Newtons. This is computed by summing krpc_SpaceCenter_Engine_Thrust() for every engine in the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableThrust(krpc_connection_t connection, float * result)

Gets the total available thrust that can be produced by the vessel’s active engines, in Newtons. This is computed by summing krpc_SpaceCenter_Engine_AvailableThrust() for every active engine in the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_MaxThrust(krpc_connection_t connection, float * result)

The total maximum thrust that can be produced by the vessel’s active engines, in Newtons. This is computed by summing krpc_SpaceCenter_Engine_MaxThrust() for every active engine.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_MaxVacuumThrust(krpc_connection_t connection, float * result)

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 krpc_SpaceCenter_Engine_MaxVacuumThrust() for every active engine.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_SpecificImpulse(krpc_connection_t connection, float * result)

The combined specific impulse of all active engines, in seconds. This is computed using the formula described here.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_VacuumSpecificImpulse(krpc_connection_t connection, float * result)

The combined vacuum specific impulse of all active engines, in seconds. This is computed using the formula described here.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_KerbinSeaLevelSpecificImpulse(krpc_connection_t connection, float * result)

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
krpc_error_t krpc_SpaceCenter_Vessel_MomentOfInertia(krpc_connection_t connection, krpc_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t).

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_InertiaTensor(krpc_connection_t connection, krpc_list_double_t * result)

The inertia tensor of the vessel around its center of mass, in the vessels reference frame (krpc_SpaceCenter_ReferenceFrame_t). Returns the 3x3 matrix as a list of elements, in row-major order.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Vessel_AvailableTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableReactionWheelTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableRCSTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableEngineTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableControlSurfaceTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_AvailableOtherTorque(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result)

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 (krpc_SpaceCenter_ReferenceFrame_t). These axes are equivalent to the pitch, roll and yaw axes of the vessel.

Game Scenes:Flight
krpc_error_t krpc_SpaceCenter_Vessel_ReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t * result)

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
../../../_images/vessel-aircraft.png

Vessel reference frame origin and axes for the Aeris 3A aircraft

../../../_images/vessel-rocket.png

Vessel reference frame origin and axes for the Kerbal-X rocket

krpc_error_t krpc_SpaceCenter_Vessel_OrbitalReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t * result)

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.

../../../_images/vessel-orbital.png

Vessel orbital reference frame origin and axes

krpc_error_t krpc_SpaceCenter_Vessel_SurfaceReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t * result)

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.

../../../_images/vessel-surface.png

Vessel surface reference frame origin and axes

krpc_error_t krpc_SpaceCenter_Vessel_SurfaceVelocityReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t * result)

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
../../../_images/vessel-surface-velocity.png

Vessel surface velocity reference frame origin and axes

krpc_error_t krpc_SpaceCenter_Vessel_Position(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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

krpc_error_t krpc_SpaceCenter_Vessel_BoundingBox(krpc_connection_t connection, krpc_tuple_tuple_double_double_double_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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

krpc_error_t krpc_SpaceCenter_Vessel_Velocity(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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

krpc_error_t krpc_SpaceCenter_Vessel_Rotation(krpc_connection_t connection, krpc_tuple_double_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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 \((x, y, z, w)\).

Game Scenes:

Flight

krpc_error_t krpc_SpaceCenter_Vessel_Direction(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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

krpc_error_t krpc_SpaceCenter_Vessel_AngularVelocity(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t 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

krpc_SpaceCenter_VesselType_t

The type of a vessel. See krpc_SpaceCenter_Vessel_Type().

KRPC_SPACECENTER_VESSELTYPE_BASE

Base.

KRPC_SPACECENTER_VESSELTYPE_DEBRIS

Debris.

KRPC_SPACECENTER_VESSELTYPE_LANDER

Lander.

KRPC_SPACECENTER_VESSELTYPE_PLANE

Plane.

KRPC_SPACECENTER_VESSELTYPE_PROBE

Probe.

KRPC_SPACECENTER_VESSELTYPE_RELAY

Relay.

KRPC_SPACECENTER_VESSELTYPE_ROVER

Rover.

KRPC_SPACECENTER_VESSELTYPE_SHIP

Ship.

KRPC_SPACECENTER_VESSELTYPE_STATION

Station.

krpc_SpaceCenter_VesselSituation_t

The situation a vessel is in. See krpc_SpaceCenter_Vessel_Situation().

KRPC_SPACECENTER_VESSELSITUATION_DOCKED

Vessel is docked to another.

KRPC_SPACECENTER_VESSELSITUATION_ESCAPING

Escaping.

KRPC_SPACECENTER_VESSELSITUATION_FLYING

Vessel is flying through an atmosphere.

KRPC_SPACECENTER_VESSELSITUATION_LANDED

Vessel is landed on the surface of a body.

KRPC_SPACECENTER_VESSELSITUATION_ORBITING

Vessel is orbiting a body.

KRPC_SPACECENTER_VESSELSITUATION_PRELAUNCH

Vessel is awaiting launch.

KRPC_SPACECENTER_VESSELSITUATION_SPLASHED

Vessel has splashed down in an ocean.

KRPC_SPACECENTER_VESSELSITUATION_SUBORBITAL

Vessel is on a sub-orbital trajectory.

krpc_SpaceCenter_CrewMember_t

Represents crew in a vessel. Can be obtained using krpc_SpaceCenter_Vessel_Crew().

krpc_error_t krpc_SpaceCenter_CrewMember_Name(krpc_connection_t connection, char * * result)
void krpc_SpaceCenter_CrewMember_set_Name(const char * value)

The crew members name.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Type(krpc_connection_t connection, krpc_SpaceCenter_CrewMemberType_t * result)

The type of crew member.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_OnMission(krpc_connection_t connection, bool * result)

Whether the crew member is on a mission.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Courage(krpc_connection_t connection, float * result)
void krpc_SpaceCenter_CrewMember_set_Courage(float value)

The crew members courage.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Stupidity(krpc_connection_t connection, float * result)
void krpc_SpaceCenter_CrewMember_set_Stupidity(float value)

The crew members stupidity.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Experience(krpc_connection_t connection, float * result)
void krpc_SpaceCenter_CrewMember_set_Experience(float value)

The crew members experience.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Badass(krpc_connection_t connection, bool * result)
void krpc_SpaceCenter_CrewMember_set_Badass(bool value)

Whether the crew member is a badass.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_CrewMember_Veteran(krpc_connection_t connection, bool * result)
void krpc_SpaceCenter_CrewMember_set_Veteran(bool value)

Whether the crew member is a veteran.

Game Scenes:All
krpc_SpaceCenter_CrewMemberType_t

The type of a crew member. See krpc_SpaceCenter_CrewMember_Type().

KRPC_SPACECENTER_CREWMEMBERTYPE_APPLICANT

An applicant for crew.

KRPC_SPACECENTER_CREWMEMBERTYPE_CREW

Rocket crew.

KRPC_SPACECENTER_CREWMEMBERTYPE_TOURIST

A tourist.

KRPC_SPACECENTER_CREWMEMBERTYPE_UNOWNED

An unowned crew member.