.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.SpaceCenter Flight ====== .. type:: public class Flight Used to get flight telemetry for a vessel, by calling :meth:`Vessel.flight(ReferenceFrame)`. All of the information returned by this class is given in the reference frame passed to that method. Obtained by calling :meth:`Vessel.flight(ReferenceFrame)`. .. note:: To get orbital information, such as the apoapsis or inclination, see :type:`Orbit`. .. method:: float getGForce() The current G force acting on the vessel in :math:`g`. :Game Scenes: Flight .. method:: double getMeanAltitude() The altitude above sea level, in meters. Measured from the center of mass of the vessel. :Game Scenes: Flight .. method:: double getSurfaceAltitude() The altitude above the surface of the body or sea level, whichever is closer, in meters. Measured from the center of mass of the vessel. :Game Scenes: Flight .. method:: double getBedrockAltitude() The altitude above the surface of the body, in meters. When over water, this is the altitude above the sea floor. Measured from the center of mass of the vessel. :Game Scenes: Flight .. method:: double getElevation() The elevation of the terrain under the vessel, in meters. This is the height of the terrain above sea level, and is negative when the vessel is over the sea. :Game Scenes: Flight .. method:: double getLatitude() The `latitude `_ of the vessel for the body being orbited, in degrees. :Game Scenes: Flight .. method:: double getLongitude() The `longitude `_ of the vessel for the body being orbited, in degrees. :Game Scenes: Flight .. method:: org.javatuples.Triplet getVelocity() The velocity of the vessel, in the reference frame :type:`ReferenceFrame`. :returns: The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the vessel in meters per second. :Game Scenes: Flight .. method:: double getSpeed() The speed of the vessel in meters per second, in the reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. method:: double getHorizontalSpeed() The horizontal speed of the vessel in meters per second, in the reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. method:: double getVerticalSpeed() The vertical speed of the vessel in meters per second, in the reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAcceleration() The acceleration of the vessel, in the reference frame :type:`ReferenceFrame`. This is the total acceleration, including the acceleration due to gravity, and is the time derivative of :meth:`Flight.getVelocity()`. :returns: The acceleration as a vector. The vector points in the direction of the acceleration, and its magnitude is the acceleration of the vessel in :math:`m/s^2`. :Game Scenes: Flight .. method:: org.javatuples.Triplet getCenterOfMass() The position of the center of mass of the vessel, in the reference frame :type:`ReferenceFrame` :returns: The position as a vector. :Game Scenes: Flight .. method:: org.javatuples.Quartet getRotation() The rotation of the vessel, in the reference frame :type:`ReferenceFrame` :returns: The rotation as a quaternion of the form :math:`(x, y, z, w)`. :Game Scenes: Flight .. method:: org.javatuples.Triplet getDirection() The direction that the vessel is pointing in, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: float getPitch() The pitch of the vessel relative to the horizon, in degrees. A value between -90° and +90°. :Game Scenes: Flight .. note:: An absolute Euler angle, ill-conditioned when the vessel points near vertical (pitch → ±90°), where heading and roll become ambiguous. For an always-defined attitude use :meth:`Flight.getRotation()` or :meth:`Flight.getDirection()`. .. method:: float getHeading() The heading of the vessel (its angle relative to north), in degrees. A value between 0° and 360°. :Game Scenes: Flight .. note:: An absolute Euler angle, undefined when the vessel points near vertical (pitch → ±90°). For an always-defined attitude use :meth:`Flight.getRotation()` or :meth:`Flight.getDirection()`. .. method:: float getRoll() The roll of the vessel relative to the horizon, in degrees. A value between -180° and +180°. :Game Scenes: Flight .. note:: An absolute Euler angle, ill-conditioned when the vessel points near vertical (pitch → ±90°), where the vertical-plane reference vanishes. For an always-defined attitude use :meth:`Flight.getRotation()`; for a well-defined roll use the auto-pilot's ``TargetRoll`` / ``RollError`` against a chosen up reference. .. method:: org.javatuples.Triplet getPrograde() The prograde direction of the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet getRetrograde() The retrograde direction of the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet getSurfacePrograde() The direction of the vessels surface velocity, in the reference frame :type:`ReferenceFrame`. This is the prograde direction as shown on the navball when in surface mode. :returns: The direction as a unit vector. :Game Scenes: Flight .. note:: Singular when surface speed is approximately zero. .. method:: org.javatuples.Triplet getSurfaceRetrograde() The direction opposite to the vessels surface velocity, in the reference frame :type:`ReferenceFrame`. This is the retrograde direction as shown on the navball when in surface mode. :returns: The direction as a unit vector. :Game Scenes: Flight .. note:: Singular when surface speed is approximately zero. .. method:: org.javatuples.Triplet getNormal() The direction normal to the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAntiNormal() The direction opposite to the normal of the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet getRadial() The radial direction of the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAntiRadial() The direction opposite to the radial direction of the vessels orbit, in the reference frame :type:`ReferenceFrame`. :returns: The direction as a unit vector. :Game Scenes: Flight .. method:: float getAtmosphereDensity() The current density of the atmosphere around the vessel, in :math:`kg/m^3`. :Game Scenes: Flight .. method:: float getDynamicPressure() The dynamic pressure acting on the vessel, in Pascals. This is a measure of the strength of the aerodynamic forces. It is equal to ½ · air density · velocity². It is commonly denoted :math:`Q`. :Game Scenes: Flight .. method:: float getStaticPressure() The static atmospheric pressure acting on the vessel, in Pascals. :Game Scenes: Flight .. method:: float getStaticPressureAtMSL() The static atmospheric pressure at mean sea level, in Pascals. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAerodynamicForce() The total aerodynamic forces acting on the vessel, in reference frame :type:`ReferenceFrame`. :returns: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAerodynamicTorque() The net aerodynamic torque currently acting on the vessel about its center of mass, in reference frame :type:`ReferenceFrame`. The magnitude is in newton-meters. :returns: A vector pointing along the axis of the torque, with its magnitude equal to the strength of the torque in newton-meters. :Game Scenes: Flight .. note:: This is the live counterpart to :meth:`Flight.getAerodynamicForce()`: it reconstructs the per-part aerodynamic forces and application points that the game applied on the current physics frame and levers them about the center of mass, rather than re-simulating them for hypothetical conditions the way :meth:`Flight.simulateAerodynamicTorqueAt(CelestialBody, org.javatuples.Triplet, org.javatuples.Triplet, org.javatuples.Quartet, org.javatuples.Triplet)` does. It is intended for validating the simulator against the live game state. Not available when `Ferram Aerospace Research `_ is installed, as FAR does not expose a live per-frame torque. .. method:: org.javatuples.Triplet simulateAerodynamicForceAt(CelestialBody body, org.javatuples.Triplet position, org.javatuples.Triplet velocity, org.javatuples.Quartet rotation) Simulate and return the total aerodynamic forces acting on the vessel, if it were traveling with the given velocity, at the given position and orientation, in the atmosphere of the given celestial body. :param CelestialBody body: The celestial body whose atmosphere the forces are simulated in. :param org.javatuples.Triplet position: The position of the vessel, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Triplet velocity: The velocity of the vessel, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Quartet rotation: The orientation of the vessel, in reference frame :type:`ReferenceFrame`, in the same form as :meth:`Vessel.rotation(ReferenceFrame)`. The angle of attack and sideslip follow from this orientation relative to the velocity; the roll component sets the direction of any aerodynamic lift. Pass the vessel's current rotation to evaluate the force at its current orientation. :returns: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons, in reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. note:: The position, velocity and rotation arguments, and the returned force, are all expressed in reference frame :type:`ReferenceFrame`. The result is the force the vessel would experience if it were placed at that position and orientation with the air flowing past it at that velocity; it is the force at the requested orientation, not the force in the vessel's current orientation. Atmospheric temperature and density are evaluated at the current universal time. .. method:: org.javatuples.Triplet simulateAerodynamicTorqueAt(CelestialBody body, org.javatuples.Triplet position, org.javatuples.Triplet velocity, org.javatuples.Quartet rotation, org.javatuples.Triplet angularVelocity) Simulate and return the total aerodynamic torque acting on the vessel about its center of mass, if it were traveling with the given velocity, at the given position, orientation and angular velocity, in the atmosphere of the given celestial body. :param CelestialBody body: The celestial body whose atmosphere the torque is simulated in. :param org.javatuples.Triplet position: The position of the vessel, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Triplet velocity: The velocity of the vessel, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Quartet rotation: The orientation of the vessel, in reference frame :type:`ReferenceFrame`, in the same form as :meth:`Vessel.rotation(ReferenceFrame)`. Pass the vessel's current rotation to evaluate the torque at its current orientation. :param org.javatuples.Triplet angularVelocity: The angular velocity of the vessel, in reference frame :type:`ReferenceFrame`. This adds the solid-body rotation term to each part's local airflow and the per-part rigid-body angular drag the game applies, together giving the aerodynamic damping torque. Pass a zero vector to evaluate the static torque. :returns: A vector pointing along the axis of the torque, with its magnitude equal to the strength of the torque in newton-meters, in reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. note:: The position, velocity, rotation and angular velocity arguments, and the returned torque, are all expressed in reference frame :type:`ReferenceFrame`. When `Ferram Aerospace Research `_ is installed the angular velocity argument is ignored. Atmospheric temperature and density are evaluated at the current universal time. This is the ideal rigid-body aerodynamic torque, summed from the per-part forces about the center of mass. A vessel may not visibly rotate by the full amount when a large aerodynamic force acts on a small part far from the center of mass, because the game applies each part's force to that part and propagates it through the joints rather than to the vessel as a rigid body. .. method:: org.javatuples.Pair,org.javatuples.Triplet> simulateAerodynamicWrenchAt(CelestialBody body, org.javatuples.Triplet position, org.javatuples.Triplet velocity, org.javatuples.Quartet rotation, org.javatuples.Triplet angularVelocity, double ut) Simulate and return the total aerodynamic force and torque acting on the vessel, if its center of mass were traveling with the given velocity, at the given position, orientation and angular velocity, in the atmosphere of the given celestial body. :param CelestialBody body: The celestial body whose atmosphere the wrench is simulated in. :param org.javatuples.Triplet position: The position of the vessel's center of mass, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Triplet velocity: The velocity of the vessel's center of mass, in reference frame :type:`ReferenceFrame`. :param org.javatuples.Quartet rotation: The orientation of the vessel, in reference frame :type:`ReferenceFrame`, in the same form as :meth:`Vessel.rotation(ReferenceFrame)`. Pass the vessel's current rotation to evaluate the wrench at its current orientation. :param org.javatuples.Triplet angularVelocity: The angular velocity of the vessel, in reference frame :type:`ReferenceFrame`. This adds the solid-body rotation term to each part's local airflow and the per-part rigid-body angular drag the game applies, together giving the aerodynamic damping force and torque. Pass a zero vector to evaluate the static wrench relative to the reference frame. :param double ut: The universal time used for the atmospheric ephemeris. It selects the body/Sun geometry used for temperature and density, but does not change or propagate :type:`ReferenceFrame` or any of the state arguments. :returns: A pair containing the aerodynamic force in newtons followed by the aerodynamic torque in newton-meters about the vessel's center of mass. Both are vectors in reference frame :type:`ReferenceFrame`. :Game Scenes: Flight .. note:: The position and velocity describe the hypothetical center-of-mass state. The position, velocity, rotation and angular velocity arguments, and both returned vectors, are expressed in reference frame :type:`ReferenceFrame`. For future-state prediction, :meth:`CelestialBody.getNonRotatingReferenceFrame()` is recommended so that the spatial state has unambiguous inertial semantics. This is an instantaneous rigid-body result based on the vessel's current parts, drag cubes and control-surface state. When `Ferram Aerospace Research `_ is installed the angular velocity and *ut* arguments are ignored. .. method:: org.javatuples.Triplet getLift() The `aerodynamic lift `_ currently acting on the vessel. :returns: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. :Game Scenes: Flight .. method:: org.javatuples.Triplet getDrag() The `aerodynamic drag `_ currently acting on the vessel. :returns: A vector pointing in the direction of the force, with its magnitude equal to the strength of the force in Newtons. :Game Scenes: Flight .. method:: org.javatuples.Triplet getAerodynamicAcceleration() The acceleration of the vessel due to the total aerodynamic forces acting on it (:meth:`Flight.getAerodynamicForce()` divided by the vessel's mass), in reference frame :type:`ReferenceFrame`. :returns: A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in :math:`m/s^2`. :Game Scenes: Flight .. method:: org.javatuples.Triplet getLiftAcceleration() The acceleration of the vessel due to :meth:`Flight.getLift()` (the aerodynamic lift divided by the vessel's mass), in reference frame :type:`ReferenceFrame`. :returns: A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in :math:`m/s^2`. :Game Scenes: Flight .. method:: org.javatuples.Triplet getDragAcceleration() The acceleration of the vessel due to :meth:`Flight.getDrag()` (the aerodynamic drag divided by the vessel's mass), in reference frame :type:`ReferenceFrame`. :returns: A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in :math:`m/s^2`. :Game Scenes: Flight .. method:: float getSpeedOfSound() The speed of sound, in the atmosphere around the vessel, in :math:`m/s`. :Game Scenes: Flight .. method:: float getMach() The speed of the vessel, in multiples of the speed of sound. :Game Scenes: Flight .. method:: float getReynoldsNumber() The vessels Reynolds number. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_. .. method:: float getTrueAirSpeed() The `true air speed `_ of the vessel, in meters per second. :Game Scenes: Flight .. method:: float getEquivalentAirSpeed() The `equivalent air speed `_ of the vessel, in meters per second. :Game Scenes: Flight .. method:: float getTerminalVelocity() An estimate of the current terminal velocity of the vessel, in meters per second. This is the speed at which the drag forces cancel out the force of gravity. :Game Scenes: Flight .. method:: float getAngleOfAttack() The pitch angle between the orientation of the vessel and its velocity vector, in degrees. :Game Scenes: Flight .. method:: float getSideslipAngle() The yaw angle between the orientation of the vessel and its velocity vector, in degrees. :Game Scenes: Flight .. method:: float getTotalAirTemperature() The `total air temperature `_ of the atmosphere around the vessel, in Kelvin. This includes the :meth:`Flight.getStaticAirTemperature()` and the vessel's kinetic energy. :Game Scenes: Flight .. method:: float getStaticAirTemperature() The `static (ambient) temperature `_ of the atmosphere around the vessel, in Kelvin. :Game Scenes: Flight .. method:: float getStallFraction() The current amount of stall, between 0 and 1. A value greater than 0.005 indicates a minor stall and a value greater than 0.5 indicates a large-scale stall. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_. .. method:: float getDragCoefficient() The coefficient of drag. This is the amount of drag produced by the vessel. It depends on air speed, air density and wing area. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_. .. method:: float getLiftCoefficient() The coefficient of lift. This is the amount of lift produced by the vessel, and depends on air speed, air density and wing area. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_. .. method:: float getBallisticCoefficient() The `ballistic coefficient `_. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_. .. method:: float getThrustSpecificFuelConsumption() The thrust specific fuel consumption for the jet engines on the vessel. This is a measure of the efficiency of the engines, with a lower value indicating a more efficient vessel. This value is the number of Newtons of fuel that are burned, per hour, to produce one newton of thrust. :Game Scenes: Flight .. note:: Requires `Ferram Aerospace Research `_.