# Parts¶

The following classes allow interaction with a vessels individual parts.

## Parts¶

public class Parts

Instances of this class are used to interact with the parts of a vessel. An instance can be obtained by calling Vessel.getParts().

java.util.List<Part> getAll()

A list of all of the vessels parts.

Game Scenes: All
Part getRoot()

The vessels root part.

Game Scenes: All

Note

See the discussion on Trees of Parts.

Part getControlling()
void setControlling(Part value)

The part from which the vessel is controlled.

Game Scenes: All
java.util.List<Part> withName(String name)

A list of parts whose Part.getName() is name.

Parameters: name (String) – All
java.util.List<Part> withTitle(String title)

A list of all parts whose Part.getTitle() is title.

Parameters: title (String) – All
java.util.List<Part> withTag(String tag)

A list of all parts whose Part.getTag() is tag.

Parameters: tag (String) – All
java.util.List<Part> withModule(String moduleName)

A list of all parts that contain a Module whose Module.getName() is moduleName.

Parameters: moduleName (String) – All
java.util.List<Part> inStage(int stage)

A list of all parts that are activated in the given stage.

Parameters: stage (int) – All

Note

See the discussion on Staging.

java.util.List<Part> inDecoupleStage(int stage)

A list of all parts that are decoupled in the given stage.

Parameters: stage (int) – All

Note

See the discussion on Staging.

java.util.List<Module> modulesWithName(String moduleName)

A list of modules (combined across all parts in the vessel) whose Module.getName() is moduleName.

Parameters: moduleName (String) – All
java.util.List<Antenna> getAntennas()

A list of all antennas in the vessel.

Game Scenes: All
java.util.List<CargoBay> getCargoBays()

A list of all cargo bays in the vessel.

Game Scenes: All
java.util.List<ControlSurface> getControlSurfaces()

A list of all control surfaces in the vessel.

Game Scenes: All
java.util.List<Decoupler> getDecouplers()

A list of all decouplers in the vessel.

Game Scenes: All
java.util.List<DockingPort> getDockingPorts()

A list of all docking ports in the vessel.

Game Scenes: All
java.util.List<Engine> getEngines()

A list of all engines in the vessel.

Game Scenes: All

Note

This includes any part that generates thrust. This covers many different types of engine, including liquid fuel rockets, solid rocket boosters, jet engines and RCS thrusters.

java.util.List<Experiment> getExperiments()

A list of all science experiments in the vessel.

Game Scenes: All
java.util.List<Fairing> getFairings()

A list of all fairings in the vessel.

Game Scenes: All
java.util.List<Intake> getIntakes()

A list of all intakes in the vessel.

Game Scenes: All
java.util.List<Leg> getLegs()

A list of all landing legs attached to the vessel.

Game Scenes: All
java.util.List<LaunchClamp> getLaunchClamps()

A list of all launch clamps attached to the vessel.

Game Scenes: All
java.util.List<Light> getLights()

A list of all lights in the vessel.

Game Scenes: All
java.util.List<Parachute> getParachutes()

A list of all parachutes in the vessel.

Game Scenes: All
java.util.List<Radiator> getRadiators()

A list of all radiators in the vessel.

Game Scenes: All
java.util.List<RCS> getRCS()

A list of all RCS blocks/thrusters in the vessel.

Game Scenes: All
java.util.List<ReactionWheel> getReactionWheels()

A list of all reaction wheels in the vessel.

Game Scenes: All
java.util.List<ResourceConverter> getResourceConverters()

A list of all resource converters in the vessel.

Game Scenes: All
java.util.List<ResourceHarvester> getResourceHarvesters()

A list of all resource harvesters in the vessel.

Game Scenes: All
java.util.List<Sensor> getSensors()

A list of all sensors in the vessel.

Game Scenes: All
java.util.List<SolarPanel> getSolarPanels()

A list of all solar panels in the vessel.

Game Scenes: All
java.util.List<Wheel> getWheels()

A list of all wheels in the vessel.

Game Scenes: All

## Part¶

public class Part

Represents an individual part. Vessels are made up of multiple parts. Instances of this class can be obtained by several methods in Parts.

String getName()

Internal name of the part, as used in part cfg files. For example “Mark1-2Pod”.

Game Scenes: All
String getTitle()

Title of the part, as shown when the part is right clicked in-game. For example “Mk1-2 Command Pod”.

Game Scenes: All
String getTag()
void setTag(String value)

The name tag for the part. Can be set to a custom string using the in-game user interface.

Game Scenes: All

Note

This string is shared with kOS if it is installed.

boolean getHighlighted()
void setHighlighted(boolean value)

Whether the part is highlighted.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> getHighlightColor()
void setHighlightColor(org.javatuples.Triplet<Double, Double, Double> value)

The color used to highlight the part, as an RGB triple.

Game Scenes: All
double getCost()

The cost of the part, in units of funds.

Game Scenes: All
Vessel getVessel()

The vessel that contains this part.

Game Scenes: All
Part getParent()

The parts parent. Returns null if the part does not have a parent. This, in combination with Part.getChildren(), can be used to traverse the vessels parts tree.

Game Scenes: All

Note

See the discussion on Trees of Parts.

java.util.List<Part> getChildren()

The parts children. Returns an empty list if the part has no children. This, in combination with Part.getParent(), can be used to traverse the vessels parts tree.

Game Scenes: All

Note

See the discussion on Trees of Parts.

boolean getAxiallyAttached()

Whether the part is axially attached to its parent, i.e. on the top or bottom of its parent. If the part has no parent, returns false.

Game Scenes: All

Note

See the discussion on Attachment Modes.

boolean getRadiallyAttached()

Whether the part is radially attached to its parent, i.e. on the side of its parent. If the part has no parent, returns false.

Game Scenes: All

Note

See the discussion on Attachment Modes.

int getStage()

The stage in which this part will be activated. Returns -1 if the part is not activated by staging.

Game Scenes: All

Note

See the discussion on Staging.

int getDecoupleStage()

The stage in which this part will be decoupled. Returns -1 if the part is never decoupled from the vessel.

Game Scenes: All

Note

See the discussion on Staging.

boolean getMassless()

Whether the part is massless.

Game Scenes: All
double getMass()

The current mass of the part, including resources it contains, in kilograms. Returns zero if the part is massless.

Game Scenes: All
double getDryMass()

The mass of the part, not including any resources it contains, in kilograms. Returns zero if the part is massless.

Game Scenes: All
boolean getShielded()

Whether the part is shielded from the exterior of the vessel, for example by a fairing.

Game Scenes: All
float getDynamicPressure()

The dynamic pressure acting on the part, in Pascals.

Game Scenes: All
double getImpactTolerance()

The impact tolerance of the part, in meters per second.

Game Scenes: All
double getTemperature()

Temperature of the part, in Kelvin.

Game Scenes: All
double getSkinTemperature()

Temperature of the skin of the part, in Kelvin.

Game Scenes: All
double getMaxTemperature()

Maximum temperature that the part can survive, in Kelvin.

Game Scenes: All
double getMaxSkinTemperature()

Maximum temperature that the skin of the part can survive, in Kelvin.

Game Scenes: All
float getThermalMass()

A measure of how much energy it takes to increase the internal temperature of the part, in Joules per Kelvin.

Game Scenes: All
float getThermalSkinMass()

A measure of how much energy it takes to increase the skin temperature of the part, in Joules per Kelvin.

Game Scenes: All
float getThermalResourceMass()

A measure of how much energy it takes to increase the temperature of the resources contained in the part, in Joules per Kelvin.

Game Scenes: All
float getThermalConductionFlux()

The rate at which heat energy is conducting into or out of the part via contact with other parts. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Game Scenes: All
float getThermalConvectionFlux()

The rate at which heat energy is convecting into or out of the part from the surrounding atmosphere. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Game Scenes: All
float getThermalRadiationFlux()

The rate at which heat energy is radiating into or out of the part from the surrounding environment. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Game Scenes: All
float getThermalInternalFlux()

The rate at which heat energy is begin generated by the part. For example, some engines generate heat by combusting fuel. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Game Scenes: All
float getThermalSkinToInternalFlux()

The rate at which heat energy is transferring between the part’s skin and its internals. Measured in energy per unit time, or power, in Watts. A positive value means the part’s internals are gaining heat energy, and negative means its skin is gaining heat energy.

Game Scenes: All
Resources getResources()

A Resources object for the part.

Game Scenes: All
boolean getCrossfeed()

Whether this part is crossfeed capable.

Game Scenes: All
boolean getIsFuelLine()

Whether this part is a fuel line.

Game Scenes: All
java.util.List<Part> getFuelLinesFrom()

The parts that are connected to this part via fuel lines, where the direction of the fuel line is into this part.

Game Scenes: All

Note

See the discussion on Fuel Lines.

java.util.List<Part> getFuelLinesTo()

The parts that are connected to this part via fuel lines, where the direction of the fuel line is out of this part.

Game Scenes: All

Note

See the discussion on Fuel Lines.

java.util.List<Module> getModules()

The modules for this part.

Game Scenes: All
Antenna getAntenna()

A Antenna if the part is an antenna, otherwise null.

Game Scenes: All
CargoBay getCargoBay()

A CargoBay if the part is a cargo bay, otherwise null.

Game Scenes: All
ControlSurface getControlSurface()

A ControlSurface if the part is an aerodynamic control surface, otherwise null.

Game Scenes: All
Decoupler getDecoupler()

A Decoupler if the part is a decoupler, otherwise null.

Game Scenes: All
DockingPort getDockingPort()

A DockingPort if the part is a docking port, otherwise null.

Game Scenes: All
Engine getEngine()

An Engine if the part is an engine, otherwise null.

Game Scenes: All
Experiment getExperiment()

An Experiment if the part is a science experiment, otherwise null.

Game Scenes: All
Fairing getFairing()

A Fairing if the part is a fairing, otherwise null.

Game Scenes: All
Intake getIntake()

An Intake if the part is an intake, otherwise null.

Game Scenes: All

Note

This includes any part that generates thrust. This covers many different types of engine, including liquid fuel rockets, solid rocket boosters and jet engines. For RCS thrusters see RCS.

Leg getLeg()

A Leg if the part is a landing leg, otherwise null.

Game Scenes: All
LaunchClamp getLaunchClamp()

A LaunchClamp if the part is a launch clamp, otherwise null.

Game Scenes: All
Light getLight()

A Light if the part is a light, otherwise null.

Game Scenes: All
Parachute getParachute()

A Parachute if the part is a parachute, otherwise null.

Game Scenes: All
Radiator getRadiator()

A Radiator if the part is a radiator, otherwise null.

Game Scenes: All
RCS getRCS()

A RCS if the part is an RCS block/thruster, otherwise null.

Game Scenes: All
ReactionWheel getReactionWheel()

A ReactionWheel if the part is a reaction wheel, otherwise null.

Game Scenes: All
ResourceConverter getResourceConverter()

A ResourceConverter if the part is a resource converter, otherwise null.

Game Scenes: All
ResourceHarvester getResourceHarvester()

A ResourceHarvester if the part is a resource harvester, otherwise null.

Game Scenes: All
Sensor getSensor()

A Sensor if the part is a sensor, otherwise null.

Game Scenes: All
SolarPanel getSolarPanel()

A SolarPanel if the part is a solar panel, otherwise null.

Game Scenes: All
Wheel getWheel()

A Wheel if the part is a wheel, otherwise null.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> position(ReferenceFrame referenceFrame)

The position of the part in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All

Note

This is a fixed position in the part, defined by the parts model. It s not necessarily the same as the parts center of mass. Use Part.centerOfMass(ReferenceFrame) to get the parts center of mass.

org.javatuples.Triplet<Double, Double, Double> centerOfMass(ReferenceFrame referenceFrame)

The position of the parts center of mass in the given reference frame. If the part is physicsless, this is equivalent to Part.position(ReferenceFrame).

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> boundingBox(ReferenceFrame referenceFrame)

The axis-aligned bounding box of the part in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vectors are in. The positions of the minimum and maximum vertices of the box, as position vectors. All

Note

This is computed from the collision mesh of the part. If the part is not collidable, the box has zero volume and is centered on the Part.position(ReferenceFrame) of the part.

org.javatuples.Triplet<Double, Double, Double> direction(ReferenceFrame referenceFrame)

The direction the part points in, in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned direction is in. The direction as a unit vector. All
org.javatuples.Triplet<Double, Double, Double> velocity(ReferenceFrame referenceFrame)

The linear velocity of the part in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned velocity vector is in. 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. All
org.javatuples.Quartet<Double, Double, Double, Double> rotation(ReferenceFrame referenceFrame)

The rotation of the part, in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned rotation is in. The rotation as a quaternion of the form $$(x, y, z, w)$$. All
org.javatuples.Triplet<Double, Double, Double> getMomentOfInertia()

The moment of inertia of the part in $$kg.m^2$$ around its center of mass in the parts reference frame (ReferenceFrame).

Game Scenes: All
java.util.List<Double> getInertiaTensor()

The inertia tensor of the part in the parts reference frame (ReferenceFrame). Returns the 3x3 matrix as a list of elements, in row-major order.

Game Scenes: All
ReferenceFrame getReferenceFrame()

The reference frame that is fixed relative to this part, and centered on a fixed position within the part, defined by the parts model.

Game Scenes: All

Note

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by DockingPort.getReferenceFrame().

Mk1 Command Pod reference frame origin and axes

ReferenceFrame getCenterOfMassReferenceFrame()

The reference frame that is fixed relative to this part, and centered on its center of mass.

Game Scenes: All

Note

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by DockingPort.getReferenceFrame().

Force addForce(org.javatuples.Triplet<Double, Double, Double> force, org.javatuples.Triplet<Double, Double, Double> position, ReferenceFrame referenceFrame)

Exert a constant force on the part, acting at the given position.

Parameters: force (org.javatuples.Triplet) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. position (org.javatuples.Triplet) – The position at which the force acts, as a vector. referenceFrame (ReferenceFrame) – The reference frame that the force and position are in. An object that can be used to remove or modify the force. All
void instantaneousForce(org.javatuples.Triplet<Double, Double, Double> force, org.javatuples.Triplet<Double, Double, Double> position, ReferenceFrame referenceFrame)

Exert an instantaneous force on the part, acting at the given position.

Parameters: force (org.javatuples.Triplet) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. position (org.javatuples.Triplet) – The position at which the force acts, as a vector. referenceFrame (ReferenceFrame) – The reference frame that the force and position are in. All

Note

The force is applied instantaneously in a single physics update.

public class Force
Part getPart()

The part that this force is applied to.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> getForceVector()
void setForceVector(org.javatuples.Triplet<Double, Double, Double> value)

The force vector, in Newtons.

Returns: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. All
org.javatuples.Triplet<Double, Double, Double> getPosition()
void setPosition(org.javatuples.Triplet<Double, Double, Double> value)

The position at which the force acts, in reference frame ReferenceFrame.

Returns: The position as a vector. All
ReferenceFrame getReferenceFrame()
void setReferenceFrame(ReferenceFrame value)

The reference frame of the force vector and position.

Game Scenes: All
void remove()

Remove the force.

Game Scenes: All

## Module¶

public class Module

This can be used to interact with a specific part module. This includes part modules in stock KSP, and those added by mods.

In KSP, each part has zero or more PartModules associated with it. Each one contains some of the functionality of the part. For example, an engine has a “ModuleEngines” part module that contains all the functionality of an engine.

String getName()

Name of the PartModule. For example, “ModuleEngines”.

Game Scenes: All
Part getPart()

The part that contains this module.

Game Scenes: All
java.util.Map<String, String> getFields()

The modules field names and their associated values, as a dictionary. These are the values visible in the right-click menu of the part.

Game Scenes: All
boolean hasField(String name)

Returns true if the module has a field with the given name.

Parameters: name (String) – Name of the field. All
String getField(String name)

Returns the value of a field.

Parameters: name (String) – Name of the field. All
void setFieldInt(String name, int value)

Set the value of a field to the given integer number.

Parameters: name (String) – Name of the field. value (int) – Value to set. All
void setFieldFloat(String name, float value)

Set the value of a field to the given floating point number.

Parameters: name (String) – Name of the field. value (float) – Value to set. All
void setFieldString(String name, String value)

Set the value of a field to the given string.

Parameters: name (String) – Name of the field. value (String) – Value to set. All
void resetField(String name)

Set the value of a field to its original value.

Parameters: name (String) – Name of the field. All
java.util.List<String> getEvents()

A list of the names of all of the modules events. Events are the clickable buttons visible in the right-click menu of the part.

Game Scenes: All
boolean hasEvent(String name)

true if the module has an event with the given name.

Parameters: name (String) – All
void triggerEvent(String name)

Trigger the named event. Equivalent to clicking the button in the right-click menu of the part.

Parameters: name (String) – All
java.util.List<String> getActions()

A list of all the names of the modules actions. These are the parts actions that can be assigned to action groups in the in-game editor.

Game Scenes: All
boolean hasAction(String name)

true if the part has an action with the given name.

Parameters: name (String) – All
void setAction(String name, boolean value)

Set the value of an action with the given name.

Parameters: name (String) – value (boolean) – All

## Specific Types of Part¶

The following classes provide functionality for specific types of part.

### Antenna¶

public class Antenna

An antenna. Obtained by calling Part.getAntenna().

Part getPart()

The part object for this antenna.

Game Scenes: All
AntennaState getState()

The current state of the antenna.

Game Scenes: All
boolean getDeployable()

Whether the antenna is deployable.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the antenna is deployed.

Game Scenes: All

Note

Fixed antennas are always deployed. Returns an error if you try to deploy a fixed antenna.

boolean getCanTransmit()

Whether data can be transmitted by this antenna.

Game Scenes: All
void transmit()

Transmit data.

Game Scenes: All
void cancel()

Cancel current transmission of data.

Game Scenes: All
boolean getAllowPartial()
void setAllowPartial(boolean value)

Whether partial data transmission is permitted.

Game Scenes: All
double getPower()

The power of the antenna.

Game Scenes: All
boolean getCombinable()

Whether the antenna can be combined with other antennae on the vessel to boost the power.

Game Scenes: All
double getCombinableExponent()

Exponent used to calculate the combined power of multiple antennae on a vessel.

Game Scenes: All
float getPacketInterval()

Interval between sending packets in seconds.

Game Scenes: All
float getPacketSize()

Amount of data sent per packet in Mits.

Game Scenes: All
double getPacketResourceCost()

Units of electric charge consumed per packet sent.

Game Scenes: All
public enum AntennaState

The state of an antenna. See Antenna.getState().

public AntennaState DEPLOYED

Antenna is fully deployed.

public AntennaState RETRACTED

Antenna is fully retracted.

public AntennaState DEPLOYING

Antenna is being deployed.

public AntennaState RETRACTING

Antenna is being retracted.

public AntennaState BROKEN

Antenna is broken.

### Cargo Bay¶

public class CargoBay

A cargo bay. Obtained by calling Part.getCargoBay().

Part getPart()

The part object for this cargo bay.

Game Scenes: All
CargoBayState getState()

The state of the cargo bay.

Game Scenes: All
boolean getOpen()
void setOpen(boolean value)

Whether the cargo bay is open.

Game Scenes: All
public enum CargoBayState

The state of a cargo bay. See CargoBay.getState().

public CargoBayState OPEN

Cargo bay is fully open.

public CargoBayState CLOSED

Cargo bay closed and locked.

public CargoBayState OPENING

Cargo bay is opening.

public CargoBayState CLOSING

Cargo bay is closing.

### Control Surface¶

public class ControlSurface

An aerodynamic control surface. Obtained by calling Part.getControlSurface().

Part getPart()

The part object for this control surface.

Game Scenes: All
boolean getPitchEnabled()
void setPitchEnabled(boolean value)

Whether the control surface has pitch control enabled.

Game Scenes: All
boolean getYawEnabled()
void setYawEnabled(boolean value)

Whether the control surface has yaw control enabled.

Game Scenes: All
boolean getRollEnabled()
void setRollEnabled(boolean value)

Whether the control surface has roll control enabled.

Game Scenes: All
float getAuthorityLimiter()
void setAuthorityLimiter(float value)

The authority limiter for the control surface, which controls how far the control surface will move.

Game Scenes: All
boolean getInverted()
void setInverted(boolean value)

Whether the control surface movement is inverted.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the control surface has been fully deployed.

Game Scenes: All
float getSurfaceArea()

Surface area of the control surface in $$m^2$$.

Game Scenes: All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()

The available torque, in Newton meters, that can be produced by this control surface, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the Vessel.getReferenceFrame().

Game Scenes: All

### Decoupler¶

public class Decoupler

A decoupler. Obtained by calling Part.getDecoupler()

Part getPart()

The part object for this decoupler.

Game Scenes: All
Vessel decouple()

Fires the decoupler. Returns the new vessel created when the decoupler fires. Throws an exception if the decoupler has already fired.

Game Scenes: All

Note

When called, the active vessel may change. It is therefore possible that, after calling this function, the object(s) returned by previous call(s) to getActiveVessel() no longer refer to the active vessel.

boolean getDecoupled()

Whether the decoupler has fired.

Game Scenes: All
boolean getStaged()

Whether the decoupler is enabled in the staging sequence.

Game Scenes: All
float getImpulse()

The impulse that the decoupler imparts when it is fired, in Newton seconds.

Game Scenes: All

### Docking Port¶

public class DockingPort

A docking port. Obtained by calling Part.getDockingPort()

Part getPart()

The part object for this docking port.

Game Scenes: All
DockingPortState getState()

The current state of the docking port.

Game Scenes: All
Part getDockedPart()

The part that this docking port is docked to. Returns null if this docking port is not docked to anything.

Game Scenes: All
Vessel undock()

Undocks the docking port and returns the new Vessel that is created. This method can be called for either docking port in a docked pair. Throws an exception if the docking port is not docked to anything.

Game Scenes: All

Note

When called, the active vessel may change. It is therefore possible that, after calling this function, the object(s) returned by previous call(s) to getActiveVessel() no longer refer to the active vessel.

float getReengageDistance()

The distance a docking port must move away when it undocks before it becomes ready to dock with another port, in meters.

Game Scenes: All
boolean getHasShield()

Whether the docking port has a shield.

Game Scenes: All
boolean getShielded()
void setShielded(boolean value)

The state of the docking ports shield, if it has one.

Returns true if the docking port has a shield, and the shield is closed. Otherwise returns false. When set to true, the shield is closed, and when set to false the shield is opened. If the docking port does not have a shield, setting this attribute has no effect.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> position(ReferenceFrame referenceFrame)

The position of the docking port, in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All
org.javatuples.Triplet<Double, Double, Double> direction(ReferenceFrame referenceFrame)

The direction that docking port points in, in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned direction is in. The direction as a unit vector. All
org.javatuples.Quartet<Double, Double, Double, Double> rotation(ReferenceFrame referenceFrame)

The rotation of the docking port, in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned rotation is in. The rotation as a quaternion of the form $$(x, y, z, w)$$. All
ReferenceFrame getReferenceFrame()

The reference frame that is fixed relative to this docking port, and oriented with the port.

• The origin is at the position of the docking port.
• The axes rotate with the docking port.
• The x-axis points out to the right side of the docking port.
• The y-axis points in the direction the docking port is facing.
• The z-axis points out of the bottom off the docking port.
Game Scenes: All

Note

This reference frame is not necessarily equivalent to the reference frame for the part, returned by Part.getReferenceFrame().

Docking port reference frame origin and axes

Inline docking port reference frame origin and axes

public enum DockingPortState

The state of a docking port. See DockingPort.getState().

public DockingPortState READY

The docking port is ready to dock to another docking port.

public DockingPortState DOCKED

The docking port is docked to another docking port, or docked to another part (from the VAB/SPH).

public DockingPortState DOCKING

The docking port is very close to another docking port, but has not docked. It is using magnetic force to acquire a solid dock.

public DockingPortState UNDOCKING

The docking port has just been undocked from another docking port, and is disabled until it moves away by a sufficient distance (DockingPort.getReengageDistance()).

public DockingPortState SHIELDED

The docking port has a shield, and the shield is closed.

public DockingPortState MOVING

The docking ports shield is currently opening/closing.

### Engine¶

public class Engine

An engine, including ones of various types. For example liquid fuelled gimballed engines, solid rocket boosters and jet engines. Obtained by calling Part.getEngine().

Note

For RCS thrusters Part.getRCS().

Part getPart()

The part object for this engine.

Game Scenes: All
boolean getActive()
void setActive(boolean value)

Whether the engine is active. Setting this attribute may have no effect, depending on Engine.getCanShutdown() and Engine.getCanRestart().

Game Scenes: All
float getThrust()

The current amount of thrust being produced by the engine, in Newtons.

Game Scenes: All
float getAvailableThrust()

The amount of thrust, in Newtons, that would be produced by the engine when activated and with its throttle set to 100%. Returns zero if the engine does not have any fuel. Takes the engine’s current Engine.getThrustLimit() and atmospheric conditions into account.

Game Scenes: All
float getMaxThrust()

The amount of thrust, in Newtons, that would be produced by the engine when activated and fueled, with its throttle and throttle limiter set to 100%.

Game Scenes: All
float getMaxVacuumThrust()

The maximum amount of thrust that can be produced by the engine in a vacuum, in Newtons. This is the amount of thrust produced by the engine when activated, Engine.getThrustLimit() is set to 100%, the main vessel’s throttle is set to 100% and the engine is in a vacuum.

Game Scenes: All
float getThrustLimit()
void setThrustLimit(float value)

The thrust limiter of the engine. A value between 0 and 1. Setting this attribute may have no effect, for example the thrust limit for a solid rocket booster cannot be changed in flight.

Game Scenes: All
java.util.List<Thruster> getThrusters()

The components of the engine that generate thrust.

Game Scenes: All

Note

For example, this corresponds to the rocket nozzel on a solid rocket booster, or the individual nozzels on a RAPIER engine. The overall thrust produced by the engine, as reported by Engine.getAvailableThrust(), Engine.getMaxThrust() and others, is the sum of the thrust generated by each thruster.

float getSpecificImpulse()

The current specific impulse of the engine, in seconds. Returns zero if the engine is not active.

Game Scenes: All
float getVacuumSpecificImpulse()

The vacuum specific impulse of the engine, in seconds.

Game Scenes: All
float getKerbinSeaLevelSpecificImpulse()

The specific impulse of the engine at sea level on Kerbin, in seconds.

Game Scenes: All
java.util.List<String> getPropellantNames()

The names of the propellants that the engine consumes.

Game Scenes: All
java.util.Map<String, Float> getPropellantRatios()

The ratio of resources that the engine consumes. A dictionary mapping resource names to the ratio at which they are consumed by the engine.

Game Scenes: All

Note

For example, if the ratios are 0.6 for LiquidFuel and 0.4 for Oxidizer, then for every 0.6 units of LiquidFuel that the engine burns, it will burn 0.4 units of Oxidizer.

java.util.List<Propellant> getPropellants()

The propellants that the engine consumes.

Game Scenes: All
boolean getHasFuel()

Whether the engine has any fuel available.

Game Scenes: All

Note

The engine must be activated for this property to update correctly.

float getThrottle()

The current throttle setting for the engine. A value between 0 and 1. This is not necessarily the same as the vessel’s main throttle setting, as some engines take time to adjust their throttle (such as jet engines).

Game Scenes: All
boolean getThrottleLocked()

Whether the Control.getThrottle() affects the engine. For example, this is true for liquid fueled rockets, and false for solid rocket boosters.

Game Scenes: All
boolean getCanRestart()

Whether the engine can be restarted once shutdown. If the engine cannot be shutdown, returns false. For example, this is true for liquid fueled rockets and false for solid rocket boosters.

Game Scenes: All
boolean getCanShutdown()

Whether the engine can be shutdown once activated. For example, this is true for liquid fueled rockets and false for solid rocket boosters.

Game Scenes: All
boolean getHasModes()

Whether the engine has multiple modes of operation.

Game Scenes: All
String getMode()
void setMode(String value)

The name of the current engine mode.

Game Scenes: All
java.util.Map<String, Engine> getModes()

The available modes for the engine. A dictionary mapping mode names to Engine objects.

Game Scenes: All
void toggleMode()

Toggle the current engine mode.

Game Scenes: All
boolean getAutoModeSwitch()
void setAutoModeSwitch(boolean value)

Whether the engine will automatically switch modes.

Game Scenes: All
boolean getGimballed()

Whether the engine is gimballed.

Game Scenes: All
float getGimbalRange()

The range over which the gimbal can move, in degrees. Returns 0 if the engine is not gimballed.

Game Scenes: All
boolean getGimbalLocked()
void setGimbalLocked(boolean value)

Whether the engines gimbal is locked in place. Setting this attribute has no effect if the engine is not gimballed.

Game Scenes: All
float getGimbalLimit()
void setGimbalLimit(float value)

The gimbal limiter of the engine. A value between 0 and 1. Returns 0 if the gimbal is locked.

Game Scenes: All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()

The available torque, in Newton meters, that can be produced by this engine, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the Vessel.getReferenceFrame(). Returns zero if the engine is inactive, or not gimballed.

Game Scenes: All
public class Propellant

A propellant for an engine. Obtains by calling Engine.getPropellants().

String getName()

The name of the propellant.

Game Scenes: All
double getCurrentAmount()

The current amount of propellant.

Game Scenes: All
double getCurrentRequirement()

The required amount of propellant.

Game Scenes: All
double getTotalResourceAvailable()

The total amount of the underlying resource currently reachable given resource flow rules.

Game Scenes: All
double getTotalResourceCapacity()

The total vehicle capacity for the underlying propellant resource, restricted by resource flow rules.

Game Scenes: All
boolean getIgnoreForIsp()

If this propellant should be ignored when calculating required mass flow given specific impulse.

Game Scenes: All
boolean getIgnoreForThrustCurve()

If this propellant should be ignored for thrust curve calculations.

Game Scenes: All
boolean getDrawStackGauge()

If this propellant has a stack gauge or not.

Game Scenes: All
boolean getIsDeprived()

If this propellant is deprived.

Game Scenes: All
float getRatio()

The propellant ratio.

Game Scenes: All

### Experiment¶

public class Experiment

Obtained by calling Part.getExperiment().

Part getPart()

The part object for this experiment.

Game Scenes: All
void run()

Run the experiment.

Game Scenes: All
void transmit()

Transmit all experimental data contained by this part.

Game Scenes: All
void dump()

Dump the experimental data contained by the experiment.

Game Scenes: All
void reset()

Reset the experiment.

Game Scenes: All
boolean getDeployed()

Whether the experiment has been deployed.

Game Scenes: All
boolean getRerunnable()

Whether the experiment can be re-run.

Game Scenes: All
boolean getInoperable()

Whether the experiment is inoperable.

Game Scenes: All
boolean getHasData()

Whether the experiment contains data.

Game Scenes: All
java.util.List<ScienceData> getData()

The data contained in this experiment.

Game Scenes: All
String getBiome()

The name of the biome the experiment is currently in.

Game Scenes: All
boolean getAvailable()

Determines if the experiment is available given the current conditions.

Game Scenes: All
ScienceSubject getScienceSubject()

Containing information on the corresponding specific science result for the current conditions. Returns null if the experiment is unavailable.

Game Scenes: All
public class ScienceData

Obtained by calling Experiment.getData().

float getDataAmount()

Data amount.

Game Scenes: All
float getScienceValue()

Science value.

Game Scenes: All
float getTransmitValue()

Transmit value.

Game Scenes: All
public class ScienceSubject

Obtained by calling Experiment.getScienceSubject().

String getTitle()

Title of science subject, displayed in science archives

Game Scenes: All
boolean getIsComplete()

Whether the experiment has been completed.

Game Scenes: All
float getScience()

Amount of science already earned from this subject, not updated until after transmission/recovery.

Game Scenes: All
float getScienceCap()

Total science allowable for this subject.

Game Scenes: All
float getDataScale()

Multiply science value by this to determine data amount in mits.

Game Scenes: All
float getSubjectValue()

Multiplier for specific Celestial Body/Experiment Situation combination.

Game Scenes: All
float getScientificValue()

Diminishing value multiplier for decreasing the science value returned from repeated experiments.

Game Scenes: All

### Fairing¶

public class Fairing

A fairing. Obtained by calling Part.getFairing().

Part getPart()

The part object for this fairing.

Game Scenes: All
void jettison()

Jettison the fairing. Has no effect if it has already been jettisoned.

Game Scenes: All
boolean getJettisoned()

Whether the fairing has been jettisoned.

Game Scenes: All

### Intake¶

public class Intake

An air intake. Obtained by calling Part.getIntake().

Part getPart()

The part object for this intake.

Game Scenes: All
boolean getOpen()
void setOpen(boolean value)

Whether the intake is open.

Game Scenes: All
float getSpeed()

Speed of the flow into the intake, in $$m/s$$.

Game Scenes: All
float getFlow()

The rate of flow into the intake, in units of resource per second.

Game Scenes: All
float getArea()

The area of the intake’s opening, in square meters.

Game Scenes: All

### Leg¶

public class Leg

A landing leg. Obtained by calling Part.getLeg().

Part getPart()

The part object for this landing leg.

Game Scenes: All
LegState getState()

The current state of the landing leg.

Game Scenes: All
boolean getDeployable()

Whether the leg is deployable.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the landing leg is deployed.

Game Scenes: All

Note

Fixed landing legs are always deployed. Returns an error if you try to deploy fixed landing gear.

boolean getIsGrounded()

Returns whether the leg is touching the ground.

Game Scenes: All
public enum LegState

The state of a landing leg. See Leg.getState().

public LegState DEPLOYED

Landing leg is fully deployed.

public LegState RETRACTED

Landing leg is fully retracted.

public LegState DEPLOYING

Landing leg is being deployed.

public LegState RETRACTING

Landing leg is being retracted.

public LegState BROKEN

Landing leg is broken.

### Launch Clamp¶

public class LaunchClamp

A launch clamp. Obtained by calling Part.getLaunchClamp().

Part getPart()

The part object for this launch clamp.

Game Scenes: All
void release()

Releases the docking clamp. Has no effect if the clamp has already been released.

Game Scenes: All

### Light¶

public class Light

A light. Obtained by calling Part.getLight().

Part getPart()

The part object for this light.

Game Scenes: All
boolean getActive()
void setActive(boolean value)

Whether the light is switched on.

Game Scenes: All
org.javatuples.Triplet<Float, Float, Float> getColor()
void setColor(org.javatuples.Triplet<Float, Float, Float> value)

The color of the light, as an RGB triple.

Game Scenes: All
float getPowerUsage()

The current power usage, in units of charge per second.

Game Scenes: All

### Parachute¶

public class Parachute

A parachute. Obtained by calling Part.getParachute().

Part getPart()

The part object for this parachute.

Game Scenes: All
void deploy()

Deploys the parachute. This has no effect if the parachute has already been deployed.

Game Scenes: All
boolean getDeployed()

Whether the parachute has been deployed.

Game Scenes: All
void arm()

Deploys the parachute. This has no effect if the parachute has already been armed or deployed. Only applicable to RealChutes parachutes.

Game Scenes: All
boolean getArmed()

Whether the parachute has been armed or deployed. Only applicable to RealChutes parachutes.

Game Scenes: All
ParachuteState getState()

The current state of the parachute.

Game Scenes: All
float getDeployAltitude()
void setDeployAltitude(float value)

The altitude at which the parachute will full deploy, in meters. Only applicable to stock parachutes.

Game Scenes: All
float getDeployMinPressure()
void setDeployMinPressure(float value)

The minimum pressure at which the parachute will semi-deploy, in atmospheres. Only applicable to stock parachutes.

Game Scenes: All
public enum ParachuteState

The state of a parachute. See Parachute.getState().

public ParachuteState STOWED

The parachute is safely tucked away inside its housing.

public ParachuteState ARMED

The parachute is armed for deployment. (RealChutes only)

public ParachuteState ACTIVE

The parachute is still stowed, but ready to semi-deploy. (Stock parachutes only)

public ParachuteState SEMI_DEPLOYED

The parachute has been deployed and is providing some drag, but is not fully deployed yet. (Stock parachutes only)

public ParachuteState DEPLOYED

The parachute is fully deployed.

public ParachuteState CUT

The parachute has been cut.

public class Radiator

A radiator. Obtained by calling Part.getRadiator().

Part getPart()

The part object for this radiator.

Game Scenes: All
boolean getDeployable()

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

For a deployable radiator, true if the radiator is extended. If the radiator is not deployable, this is always true.

Game Scenes: All
RadiatorState getState()

The current state of the radiator.

Game Scenes: All

Note

A fixed radiator is always RadiatorState.EXTENDED.

public enum RadiatorState

The state of a radiator. RadiatorState

public RadiatorState EXTENDED

public RadiatorState RETRACTED

public RadiatorState EXTENDING

public RadiatorState RETRACTING

public RadiatorState BROKEN

### Resource Converter¶

public class ResourceConverter

A resource converter. Obtained by calling Part.getResourceConverter().

Part getPart()

The part object for this converter.

Game Scenes: All
int getCount()

The number of converters in the part.

Game Scenes: All
String name(int index)

The name of the specified converter.

Parameters: index (int) – Index of the converter. All
boolean active(int index)

True if the specified converter is active.

Parameters: index (int) – Index of the converter. All
void start(int index)

Start the specified converter.

Parameters: index (int) – Index of the converter. All
void stop(int index)

Stop the specified converter.

Parameters: index (int) – Index of the converter. All
ResourceConverterState state(int index)

The state of the specified converter.

Parameters: index (int) – Index of the converter. All
String statusInfo(int index)

Status information for the specified converter. This is the full status message shown in the in-game UI.

Parameters: index (int) – Index of the converter. All
java.util.List<String> inputs(int index)

List of the names of resources consumed by the specified converter.

Parameters: index (int) – Index of the converter. All
java.util.List<String> outputs(int index)

List of the names of resources produced by the specified converter.

Parameters: index (int) – Index of the converter. All
float getOptimumCoreTemperature()

The core temperature at which the converter will operate with peak efficiency, in Kelvin.

Game Scenes: All
float getCoreTemperature()

The core temperature of the converter, in Kelvin.

Game Scenes: All
float getThermalEfficiency()

The thermal efficiency of the converter, as a percentage of its maximum.

Game Scenes: All
public enum ResourceConverterState

The state of a resource converter. See ResourceConverter.state(int).

public ResourceConverterState RUNNING

Converter is running.

public ResourceConverterState IDLE

Converter is idle.

public ResourceConverterState MISSING_RESOURCE

Converter is missing a required resource.

public ResourceConverterState STORAGE_FULL

No available storage for output resource.

public ResourceConverterState CAPACITY

At preset resource capacity.

public ResourceConverterState UNKNOWN

Unknown state. Possible with modified resource converters. In this case, check ResourceConverter.statusInfo(int) for more information.

### Resource Harvester¶

public class ResourceHarvester

A resource harvester (drill). Obtained by calling Part.getResourceHarvester().

Part getPart()

The part object for this harvester.

Game Scenes: All
ResourceHarvesterState getState()

The state of the harvester.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the harvester is deployed.

Game Scenes: All
boolean getActive()
void setActive(boolean value)

Whether the harvester is actively drilling.

Game Scenes: All
float getExtractionRate()

The rate at which the drill is extracting ore, in units per second.

Game Scenes: All
float getThermalEfficiency()

The thermal efficiency of the drill, as a percentage of its maximum.

Game Scenes: All
float getCoreTemperature()

The core temperature of the drill, in Kelvin.

Game Scenes: All
float getOptimumCoreTemperature()

The core temperature at which the drill will operate with peak efficiency, in Kelvin.

Game Scenes: All
public enum ResourceHarvesterState

The state of a resource harvester. See ResourceHarvester.getState().

public ResourceHarvesterState DEPLOYING

The drill is deploying.

public ResourceHarvesterState DEPLOYED

The drill is deployed and ready.

public ResourceHarvesterState RETRACTING

The drill is retracting.

public ResourceHarvesterState RETRACTED

The drill is retracted.

public ResourceHarvesterState ACTIVE

The drill is running.

### Reaction Wheel¶

public class ReactionWheel

A reaction wheel. Obtained by calling Part.getReactionWheel().

Part getPart()

The part object for this reaction wheel.

Game Scenes: All
boolean getActive()
void setActive(boolean value)

Whether the reaction wheel is active.

Game Scenes: All
boolean getBroken()

Whether the reaction wheel is broken.

Game Scenes: All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()

The available torque, in Newton meters, that can be produced by this reaction wheel, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the Vessel.getReferenceFrame(). Returns zero if the reaction wheel is inactive or broken.

Game Scenes: All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getMaxTorque()

The maximum torque, in Newton meters, that can be produced by this reaction wheel, when it is active, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the Vessel.getReferenceFrame().

Game Scenes: All

### RCS¶

public class RCS

An RCS block or thruster. Obtained by calling Part.getRCS().

Part getPart()

The part object for this RCS.

Game Scenes: All
boolean getActive()

Whether the RCS thrusters are active. An RCS thruster is inactive if the RCS action group is disabled (Control.getRCS()), the RCS thruster itself is not enabled (RCS.getEnabled()) or it is covered by a fairing (Part.getShielded()).

Game Scenes: All
boolean getEnabled()
void setEnabled(boolean value)

Whether the RCS thrusters are enabled.

Game Scenes: All
boolean getPitchEnabled()
void setPitchEnabled(boolean value)

Whether the RCS thruster will fire when pitch control input is given.

Game Scenes: All
boolean getYawEnabled()
void setYawEnabled(boolean value)

Whether the RCS thruster will fire when yaw control input is given.

Game Scenes: All
boolean getRollEnabled()
void setRollEnabled(boolean value)

Whether the RCS thruster will fire when roll control input is given.

Game Scenes: All
boolean getForwardEnabled()
void setForwardEnabled(boolean value)

Whether the RCS thruster will fire when pitch control input is given.

Game Scenes: All
boolean getUpEnabled()
void setUpEnabled(boolean value)

Whether the RCS thruster will fire when yaw control input is given.

Game Scenes: All
boolean getRightEnabled()
void setRightEnabled(boolean value)

Whether the RCS thruster will fire when roll control input is given.

Game Scenes: All
org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()

The available torque, in Newton meters, that can be produced by this RCS, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the Vessel.getReferenceFrame(). Returns zero if RCS is disable.

Game Scenes: All
float getMaxThrust()

The maximum amount of thrust that can be produced by the RCS thrusters when active, in Newtons.

Game Scenes: All
float getMaxVacuumThrust()

The maximum amount of thrust that can be produced by the RCS thrusters when active in a vacuum, in Newtons.

Game Scenes: All
java.util.List<Thruster> getThrusters()

A list of thrusters, one of each nozzel in the RCS part.

Game Scenes: All
float getSpecificImpulse()

The current specific impulse of the RCS, in seconds. Returns zero if the RCS is not active.

Game Scenes: All
float getVacuumSpecificImpulse()

The vacuum specific impulse of the RCS, in seconds.

Game Scenes: All
float getKerbinSeaLevelSpecificImpulse()

The specific impulse of the RCS at sea level on Kerbin, in seconds.

Game Scenes: All
java.util.List<String> getPropellants()

The names of resources that the RCS consumes.

Game Scenes: All
java.util.Map<String, Float> getPropellantRatios()

The ratios of resources that the RCS consumes. A dictionary mapping resource names to the ratios at which they are consumed by the RCS.

Game Scenes: All
boolean getHasFuel()

Whether the RCS has fuel available.

Game Scenes: All

Note

The RCS thruster must be activated for this property to update correctly.

### Sensor¶

public class Sensor

A sensor, such as a thermometer. Obtained by calling Part.getSensor().

Part getPart()

The part object for this sensor.

Game Scenes: All
boolean getActive()
void setActive(boolean value)

Whether the sensor is active.

Game Scenes: All
String getValue()

The current value of the sensor.

Game Scenes: All

### Solar Panel¶

public class SolarPanel

A solar panel. Obtained by calling Part.getSolarPanel().

Part getPart()

The part object for this solar panel.

Game Scenes: All
boolean getDeployable()

Whether the solar panel is deployable.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the solar panel is extended.

Game Scenes: All
SolarPanelState getState()

The current state of the solar panel.

Game Scenes: All
float getEnergyFlow()

The current amount of energy being generated by the solar panel, in units of charge per second.

Game Scenes: All
float getSunExposure()

The current amount of sunlight that is incident on the solar panel, as a percentage. A value between 0 and 1.

Game Scenes: All
public enum SolarPanelState

The state of a solar panel. See SolarPanel.getState().

public SolarPanelState EXTENDED

Solar panel is fully extended.

public SolarPanelState RETRACTED

Solar panel is fully retracted.

public SolarPanelState EXTENDING

Solar panel is being extended.

public SolarPanelState RETRACTING

Solar panel is being retracted.

public SolarPanelState BROKEN

Solar panel is broken.

### Thruster¶

public class Thruster

The component of an Engine or RCS part that generates thrust. Can obtained by calling Engine.getThrusters() or RCS.getThrusters().

Note

Engines can consist of multiple thrusters. For example, the S3 KS-25x4 “Mammoth” has four rocket nozzels, and so consists of four thrusters.

Part getPart()

The Part that contains this thruster.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> thrustPosition(ReferenceFrame referenceFrame)

The position at which the thruster generates thrust, in the given reference frame. For gimballed engines, this takes into account the current rotation of the gimbal.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All
org.javatuples.Triplet<Double, Double, Double> thrustDirection(ReferenceFrame referenceFrame)

The direction of the force generated by the thruster, in the given reference frame. This is opposite to the direction in which the thruster expels propellant. For gimballed engines, this takes into account the current rotation of the gimbal.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned direction is in. The direction as a unit vector. All
ReferenceFrame getThrustReferenceFrame()

A reference frame that is fixed relative to the thruster and orientated with its thrust direction (Thruster.thrustDirection(ReferenceFrame)). For gimballed engines, this takes into account the current rotation of the gimbal.

• The origin is at the position of thrust for this thruster (Thruster.thrustPosition(ReferenceFrame)).
• The axes rotate with the thrust direction. This is the direction in which the thruster expels propellant, including any gimballing.
• The y-axis points along the thrust direction.
• The x-axis and z-axis are perpendicular to the thrust direction.
Game Scenes: All
boolean getGimballed()

Whether the thruster is gimballed.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> gimbalPosition(ReferenceFrame referenceFrame)

Position around which the gimbal pivots.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All
org.javatuples.Triplet<Double, Double, Double> getGimbalAngle()

The current gimbal angle in the pitch, roll and yaw axes, in degrees.

Game Scenes: All
org.javatuples.Triplet<Double, Double, Double> initialThrustPosition(ReferenceFrame referenceFrame)

The position at which the thruster generates thrust, when the engine is in its initial position (no gimballing), in the given reference frame.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned position vector is in. The position as a vector. All

Note

This position can move when the gimbal rotates. This is because the thrust position and gimbal position are not necessarily the same.

org.javatuples.Triplet<Double, Double, Double> initialThrustDirection(ReferenceFrame referenceFrame)

The direction of the force generated by the thruster, when the engine is in its initial position (no gimballing), in the given reference frame. This is opposite to the direction in which the thruster expels propellant.

Parameters: referenceFrame (ReferenceFrame) – The reference frame that the returned direction is in. The direction as a unit vector. All

### Wheel¶

public class Wheel

A wheel. Includes landing gear and rover wheels. Obtained by calling Part.getWheel(). Can be used to control the motors, steering and deployment of wheels, among other things.

Part getPart()

The part object for this wheel.

Game Scenes: All
WheelState getState()

The current state of the wheel.

Game Scenes: All
float getRadius()

Radius of the wheel, in meters.

Game Scenes: All
boolean getGrounded()

Whether the wheel is touching the ground.

Game Scenes: All
boolean getHasBrakes()

Whether the wheel has brakes.

Game Scenes: All
float getBrakes()
void setBrakes(float value)

The braking force, as a percentage of maximum, when the brakes are applied.

Game Scenes: All
boolean getAutoFrictionControl()
void setAutoFrictionControl(boolean value)

Whether automatic friction control is enabled.

Game Scenes: All
float getManualFrictionControl()
void setManualFrictionControl(float value)

Manual friction control value. Only has an effect if automatic friction control is disabled. A value between 0 and 5 inclusive.

Game Scenes: All
boolean getDeployable()

Whether the wheel is deployable.

Game Scenes: All
boolean getDeployed()
void setDeployed(boolean value)

Whether the wheel is deployed.

Game Scenes: All
boolean getPowered()

Game Scenes: All
boolean getMotorEnabled()
void setMotorEnabled(boolean value)

Whether the motor is enabled.

Game Scenes: All
boolean getMotorInverted()
void setMotorInverted(boolean value)

Whether the direction of the motor is inverted.

Game Scenes: All
MotorState getMotorState()

Whether the direction of the motor is inverted.

Game Scenes: All
float getMotorOutput()

The output of the motor. This is the torque currently being generated, in Newton meters.

Game Scenes: All
boolean getTractionControlEnabled()
void setTractionControlEnabled(boolean value)

Whether automatic traction control is enabled. A wheel only has traction control if it is powered.

Game Scenes: All
float getTractionControl()
void setTractionControl(float value)

Setting for the traction control. Only takes effect if the wheel has automatic traction control enabled. A value between 0 and 5 inclusive.

Game Scenes: All
float getDriveLimiter()
void setDriveLimiter(float value)

Manual setting for the motor limiter. Only takes effect if the wheel has automatic traction control disabled. A value between 0 and 100 inclusive.

Game Scenes: All
boolean getSteerable()

Whether the wheel has steering.

Game Scenes: All
boolean getSteeringEnabled()
void setSteeringEnabled(boolean value)

Whether the wheel steering is enabled.

Game Scenes: All
boolean getSteeringInverted()
void setSteeringInverted(boolean value)

Whether the wheel steering is inverted.

Game Scenes: All
boolean getHasSuspension()

Whether the wheel has suspension.

Game Scenes: All
float getSuspensionSpringStrength()

Suspension spring strength, as set in the editor.

Game Scenes: All
float getSuspensionDamperStrength()

Suspension damper strength, as set in the editor.

Game Scenes: All
boolean getBroken()

Whether the wheel is broken.

Game Scenes: All
boolean getRepairable()

Whether the wheel is repairable.

Game Scenes: All
float getStress()

Current stress on the wheel.

Game Scenes: All
float getStressTolerance()

Stress tolerance of the wheel.

Game Scenes: All
float getStressPercentage()

Current stress on the wheel as a percentage of its stress tolerance.

Game Scenes: All
float getDeflection()

Current deflection of the wheel.

Game Scenes: All
float getSlip()

Current slip of the wheel.

Game Scenes: All
public enum WheelState

The state of a wheel. See Wheel.getState().

public WheelState DEPLOYED

Wheel is fully deployed.

public WheelState RETRACTED

Wheel is fully retracted.

public WheelState DEPLOYING

Wheel is being deployed.

public WheelState RETRACTING

Wheel is being retracted.

public WheelState BROKEN

Wheel is broken.

public enum MotorState

The state of the motor on a powered wheel. See Wheel.getMotorState().

public MotorState IDLE

The motor is idle.

public MotorState RUNNING

The motor is running.

public MotorState DISABLED

The motor is disabled.

public MotorState INOPERABLE

The motor is inoperable.

public MotorState NOT_ENOUGH_RESOURCES

The motor does not have enough resources to run.

## Trees of Parts¶

Vessels in KSP are comprised of a number of parts, connected to one another in a tree structure. An example vessel is shown in Figure 1, and the corresponding tree of parts in Figure 2. The craft file for this example can also be downloaded here.

Figure 1 – Example parts making up a vessel.

Figure 2 – Tree of parts for the vessel in Figure 1. Arrows point from the parent part to the child part.

### Traversing the Tree¶

The tree of parts can be traversed using the attributes Parts.getRoot(), Part.getParent() and Part.getChildren().

The root of the tree is the same as the vessels root part (part number 1 in the example above) and can be obtained by calling Parts.getRoot(). A parts children can be obtained by calling Part.getChildren(). If the part does not have any children, Part.getChildren() returns an empty list. A parts parent can be obtained by calling Part.getParent(). If the part does not have a parent (as is the case for the root part), Part.getParent() returns null.

The following Java example uses these attributes to perform a depth-first traversal over all of the parts in a vessel:

import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Part;
import krpc.client.services.SpaceCenter.Vessel;

import org.javatuples.Pair;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;

public class TreeTraversal {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Part root = vessel.getParts().getRoot();
Deque<Pair<Part, Integer>> stack = new ArrayDeque<Pair<Part, Integer>>();
stack.push(new Pair<Part, Integer>(root, 0));
while (stack.size() > 0) {
Pair<Part, Integer> item = stack.pop();
Part part = item.getValue0();
int depth = item.getValue1();
String prefix = "";
for (int i = 0; i < depth; i++) {
prefix += " ";
}
System.out.println(prefix + part.getTitle());
for (Part child : part.getChildren()) {
stack.push(new Pair<Part, Integer>(child, depth + 1));
}
}
connection.close();
}
}


When this code is execute using the craft file for the example vessel pictured above, the following is printed out:

Command Pod Mk1
TR-18A Stack Decoupler
FL-T400 Fuel Tank
LV-909 Liquid Fuel Engine
TR-18A Stack Decoupler
FL-T800 Fuel Tank
LV-909 Liquid Fuel Engine
FL-T400 Fuel Tank
TT18-A Launch Stability Enhancer
FTX-2 External Fuel Duct
LV-909 Liquid Fuel Engine
Aerodynamic Nose Cone
FL-T400 Fuel Tank
TT18-A Launch Stability Enhancer
FTX-2 External Fuel Duct
LV-909 Liquid Fuel Engine
Aerodynamic Nose Cone
LT-1 Landing Struts
LT-1 Landing Struts
Mk16 Parachute


### Attachment Modes¶

Parts can be attached to other parts either radially (on the side of the parent part) or axially (on the end of the parent part, to form a stack).

For example, in the vessel pictured above, the parachute (part 2) is axially connected to its parent (the command pod – part 1), and the landing leg (part 5) is radially connected to its parent (the fuel tank – part 4).

The root part of a vessel (for example the command pod – part 1) does not have a parent part, so does not have an attachment mode. However, the part is consider to be axially attached to nothing.

The following Java example does a depth-first traversal as before, but also prints out the attachment mode used by the part:

import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Part;
import krpc.client.services.SpaceCenter.Vessel;

import org.javatuples.Pair;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;

public class AttachmentModes {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Part root = vessel.getParts().getRoot();
Deque<Pair<Part, Integer>> stack = new ArrayDeque<Pair<Part, Integer>>();
stack.push(new Pair<Part, Integer>(root, 0));
while (stack.size() > 0) {
Pair<Part, Integer> item = stack.pop();
Part part = item.getValue0();
int depth = item.getValue1();
String prefix = "";
for (int i = 0; i < depth; i++) {
prefix += " ";
}
String attachMode = part.getAxiallyAttached() ? "axial" : "radial";
System.out.println(prefix + part.getTitle() + " - " + attachMode);
for (Part child : part.getChildren()) {
stack.push(new Pair<Part, Integer>(child, depth + 1));
}
}
connection.close();
}
}


When this code is execute using the craft file for the example vessel pictured above, the following is printed out:

Command Pod Mk1 - axial
TR-18A Stack Decoupler - axial
FL-T400 Fuel Tank - axial
LV-909 Liquid Fuel Engine - axial
TR-18A Stack Decoupler - axial
FL-T800 Fuel Tank - axial
LV-909 Liquid Fuel Engine - axial
TT18-A Launch Stability Enhancer - radial
FTX-2 External Fuel Duct - radial
LV-909 Liquid Fuel Engine - axial
Aerodynamic Nose Cone - axial
TT18-A Launch Stability Enhancer - radial
FTX-2 External Fuel Duct - radial
LV-909 Liquid Fuel Engine - axial
Aerodynamic Nose Cone - axial
Mk16 Parachute - axial


## Fuel Lines¶

Figure 5 – Fuel lines from the example in Figure 1. Fuel flows from the parts highlighted in green, into the part highlighted in blue.

Figure 4 – A subset of the parts tree from Figure 2 above.

Fuel lines are considered parts, and are included in the parts tree (for example, as pictured in Figure 4). However, the parts tree does not contain information about which parts fuel lines connect to. The parent part of a fuel line is the part from which it will take fuel (as shown in Figure 4) however the part that it will send fuel to is not represented in the parts tree.

Figure 5 shows the fuel lines from the example vessel pictured earlier. Fuel line part 15 (in red) takes fuel from a fuel tank (part 11 – in green) and feeds it into another fuel tank (part 9 – in blue). The fuel line is therefore a child of part 11, but its connection to part 9 is not represented in the tree.

The attributes Part.getFuelLinesFrom() and Part.getFuelLinesTo() can be used to discover these connections. In the example in Figure 5, when Part.getFuelLinesTo() is called on fuel tank part 11, it will return a list of parts containing just fuel tank part 9 (the blue part). When Part.getFuelLinesFrom() is called on fuel tank part 9, it will return a list containing fuel tank parts 11 and 17 (the parts colored green).

## Staging¶

Figure 6 – Example vessel from Figure 1 with a staging sequence.

Each part has two staging numbers associated with it: the stage in which the part is activated and the stage in which the part is decoupled. These values can be obtained using Part.getStage() and Part.getDecoupleStage() respectively. For parts that are not activated by staging, Part.getStage() returns -1. For parts that are never decoupled, Part.getDecoupleStage() returns a value of -1.

Figure 6 shows an example staging sequence for a vessel. Figure 7 shows the stages in which each part of the vessel will be activated. Figure 8 shows the stages in which each part of the vessel will be decoupled.

Figure 7 – The stage in which each part is activated.

Figure 8 – The stage in which each part is decoupled.