Flight#
-
class Flight#
Used to get flight telemetry for a vessel, by calling
Vessel::flight(). All of the information returned by this class is given in the reference frame passed to that method. Obtained by callingVessel::flight().Note
To get orbital information, such as the apoapsis or inclination, see
Orbit.-
float g_force()#
The current G force acting on the vessel in \(g\).
- Game Scenes:
Flight
-
double mean_altitude()#
The altitude above sea level, in meters. Measured from the center of mass of the vessel.
- Game Scenes:
Flight
-
double surface_altitude()#
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
-
double bedrock_altitude()#
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
-
double elevation()#
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
-
double latitude()#
The latitude of the vessel for the body being orbited, in degrees.
- Game Scenes:
Flight
-
double longitude()#
The longitude of the vessel for the body being orbited, in degrees.
- Game Scenes:
Flight
-
std::tuple<double, double, double> surface_normal()#
The normal to the surface under the vessel, in the reference frame
ReferenceFrame. This describes the slope of the terrain, and points straight up when the vessel is over water.- Returns:
The normal as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> velocity()#
The velocity of the vessel, in the reference frame
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
-
double speed()#
The speed of the vessel in meters per second, in the reference frame
ReferenceFrame.- Game Scenes:
Flight
-
double horizontal_speed()#
The horizontal speed of the vessel in meters per second, in the reference frame
ReferenceFrame.- Game Scenes:
Flight
-
double vertical_speed()#
The vertical speed of the vessel in meters per second, in the reference frame
ReferenceFrame.- Game Scenes:
Flight
-
std::tuple<double, double, double> acceleration()#
The acceleration of the vessel, in the reference frame
ReferenceFrame. This is the total acceleration, including the acceleration due to gravity, and is the time derivative ofFlight::velocity().- 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 \(m/s^2\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> center_of_mass()#
The position of the center of mass of the vessel, in the reference frame
ReferenceFrame- Returns:
The position as a vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double, double> rotation()#
The rotation of the vessel, in the reference frame
ReferenceFrame- Returns:
The rotation as a quaternion of the form \((x, y, z, w)\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> direction()#
The direction that the vessel is pointing in, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
float pitch()#
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 (a pitch near -90° or +90°), where heading and roll become ambiguous. For an always-defined attitude use
Flight::rotation()orFlight::direction().
-
float heading()#
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 (a pitch near -90° or +90°). For an always-defined attitude use
Flight::rotation()orFlight::direction().
-
float roll()#
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 (a pitch near -90° or +90°), where the vertical-plane reference vanishes. For an always-defined attitude use
Flight::rotation(); for a well-defined roll use the auto-pilot’sTargetRoll/RollErroragainst a chosen up reference.
-
std::tuple<double, double, double> prograde()#
The prograde direction of the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> retrograde()#
The retrograde direction of the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> surface_prograde()#
The direction of the vessels surface velocity, in the reference frame
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.
-
std::tuple<double, double, double> surface_retrograde()#
The direction opposite to the vessels surface velocity, in the reference frame
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.
-
std::tuple<double, double, double> normal()#
The direction normal to the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> anti_normal()#
The direction opposite to the normal of the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> radial()#
The radial direction of the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
std::tuple<double, double, double> anti_radial()#
The direction opposite to the radial direction of the vessels orbit, in the reference frame
ReferenceFrame.- Returns:
The direction as a unit vector.
- Game Scenes:
Flight
-
float atmosphere_density()#
The current density of the atmosphere around the vessel, in \(kg/m^3\).
- Game Scenes:
Flight
-
float dynamic_pressure()#
The dynamic pressure acting on the vessel, in Pascals. This is a measure of the strength of the aerodynamic forces. It is equal to \(\frac{1}{2} . \mbox{air density} . \mbox{velocity}^2\). It is commonly denoted \(Q\).
- Game Scenes:
Flight
-
float static_pressure()#
The static pressure acting on the vessel, in Pascals.
- Game Scenes:
Flight
Note
Below the waterline this includes the pressure of the water above the vessel’s center of mass.
-
float static_pressure_at_msl()#
The static atmospheric pressure at mean sea level, in Pascals.
- Game Scenes:
Flight
-
double displacement()#
The volume of water the vessel displaces when fully submerged, in \(m^3\).
- Game Scenes:
Flight
-
double displaced_volume()#
The volume of water the vessel is displacing, in \(m^3\).
- Game Scenes:
Flight
-
double submerged_portion()#
The fraction of the vessel below the waterline, between 0 and 1. This is
Flight::displaced_volume()overFlight::displacement().- Game Scenes:
Flight
-
std::optional<std::tuple<double, double, double>> center_of_buoyancy()#
The point the total buoyant force on the vessel acts through, in reference frame
ReferenceFrame. ReturnsNULLif no part of the vessel is in the water.- Returns:
The position as a vector.
- Game Scenes:
Flight
Note
A hull at rest carries this on the same vertical line as
Flight::center_of_mass(). A horizontal offset between the two turns the weight and the buoyancy into a couple that rolls or pitches the vessel.
-
std::tuple<double, double, double> buoyant_force()#
The total buoyant force acting on the vessel, in reference frame
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
Note
A vessel floating at rest carries a buoyant force equal to its weight.
-
std::tuple<double, double, double> buoyant_acceleration()#
The acceleration of the vessel due to the buoyant force acting on it (
Flight::buoyant_force()divided by the vessel’s mass), in reference frameReferenceFrame.- Returns:
A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in \(m/s^2\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> buoyant_torque()#
The torque the buoyant force exerts on the vessel about its center of mass, in reference frame
ReferenceFrame.- 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
-
std::optional<std::tuple<double, double, double>> fully_submerged_center_of_buoyancy()#
The point the buoyant force acts through with the vessel fully submerged, in reference frame
ReferenceFrame. ReturnsNULLif no part of the vessel displaces any water.- Returns:
The position as a vector.
- Game Scenes:
Flight
Note
The point is fixed relative to the hull.
Flight::center_of_buoyancy()moves as the vessel rides the waves.
-
double buoyant_force_at(double density, double gravity)#
The buoyant force on the vessel when fully submerged in a fluid of the given density, in Newtons.
- Parameters:
density – The density of the fluid, in \(kg/m^3\).
gravity – The acceleration due to gravity, in \(m/s^2\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> buoyant_torque_at(double density, double gravity)#
The torque the buoyant force exerts about the vessel’s center of mass when fully submerged in a fluid of the given density, in reference frame
ReferenceFrame. Gravity acts towards the center of the body.- Parameters:
density – The density of the fluid, in \(kg/m^3\).
gravity – The acceleration due to gravity, in \(m/s^2\).
- 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
-
double depth()#
The depth of the center of mass of the vessel below the waterline, in meters. Negative above the waterline.
- Game Scenes:
Flight
-
float submerged_dynamic_pressure()#
The dynamic pressure of the water acting on the vessel, in Pascals. Returns zero if no part of the vessel is below the waterline.
- Game Scenes:
Flight
-
std::tuple<double, double, double> aerodynamic_force()#
The total aerodynamic forces acting on the vessel, in reference frame
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
Note
This is the force the aerodynamics model actually applied to the vessel on the last physics frame, summed over its parts, so it points where the air pushes the vessel whatever the vessel’s orientation. It equals
Flight::lift()plusFlight::side_force()plusFlight::drag().
-
std::tuple<double, double, double> aerodynamic_torque()#
The net aerodynamic torque currently acting on the vessel about its center of mass, in reference frame
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
Flight::aerodynamic_force(): it is the torque the aerodynamics model applied on the current physics frame, taken about the center of mass, rather than one re-simulated for hypothetical conditions the wayFlight::simulate_aerodynamic_torque_at()does. It is intended for validating the simulator against the live game state.
-
std::tuple<double, double, double> simulate_aerodynamic_force_at(CelestialBody body, std::tuple<double, double, double> position, std::tuple<double, double, double> velocity, std::tuple<double, double, double, double> 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.
- Parameters:
body – The celestial body whose atmosphere the forces are simulated in.
position – The position of the vessel, in reference frame
ReferenceFrame.velocity – The velocity of the vessel, in reference frame
ReferenceFrame.rotation – The orientation of the vessel, in reference frame
ReferenceFrame, in the same form asVessel::rotation(). 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
ReferenceFrame.- Game Scenes:
Flight
Note
The position, velocity and rotation arguments, and the returned force, are all expressed in reference frame
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.
-
std::tuple<double, double, double> simulate_aerodynamic_torque_at(CelestialBody body, std::tuple<double, double, double> position, std::tuple<double, double, double> velocity, std::tuple<double, double, double, double> rotation, std::tuple<double, double, double> angular_velocity)#
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.
- Parameters:
body – The celestial body whose atmosphere the torque is simulated in.
position – The position of the vessel, in reference frame
ReferenceFrame.velocity – The velocity of the vessel, in reference frame
ReferenceFrame.rotation – The orientation of the vessel, in reference frame
ReferenceFrame, in the same form asVessel::rotation(). Pass the vessel’s current rotation to evaluate the torque at its current orientation.angular_velocity – The angular velocity of the vessel, in reference frame
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
ReferenceFrame.- Game Scenes:
Flight
Note
The position, velocity, rotation and angular velocity arguments, and the returned torque, are all expressed in reference frame
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.
-
Wrench simulate_aerodynamic_wrench_at(CelestialBody body, std::tuple<double, double, double> position, std::tuple<double, double, double> velocity, std::tuple<double, double, double, double> rotation, std::tuple<double, double, double> angular_velocity, 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.
- Parameters:
body – The celestial body whose atmosphere the wrench is simulated in.
position – The position of the vessel’s center of mass, in reference frame
ReferenceFrame.velocity – The velocity of the vessel’s center of mass, in reference frame
ReferenceFrame.rotation – The orientation of the vessel, in reference frame
ReferenceFrame, in the same form asVessel::rotation(). Pass the vessel’s current rotation to evaluate the wrench at its current orientation.angular_velocity – The angular velocity of the vessel, in reference frame
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.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
ReferenceFrameor any of the state arguments.
- Returns:
The aerodynamic force, and the aerodynamic torque about the vessel’s center of mass. Both are vectors in reference frame
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
ReferenceFrame. For future-state prediction,CelestialBody::non_rotating_reference_frame()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.
-
std::tuple<double, double, double> lift()#
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
Note
The part of
Flight::aerodynamic_force()that acts across the air stream and towards the top of the vessel: perpendicular to the air stream, in the plane the vessel’s nose and its top sit in. A vessel flying with sideslip is also pushed out of that plane, and that part of the force isFlight::side_force(). Zero for a vessel flying exactly sideways, which has no such plane to speak of.
-
std::tuple<double, double, double> side_force()#
The aerodynamic side force 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
Note
The part of
Flight::aerodynamic_force()that acts across the air stream and out of the vessel’s side, which is what the air does to a vessel flying with sideslip. It is perpendicular to bothFlight::lift()andFlight::drag(), and the three of them sum toFlight::aerodynamic_force().
-
std::tuple<double, double, double> drag()#
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
Note
The part of
Flight::aerodynamic_force()along the air stream, opposing the vessel’s motion through the air.
-
std::tuple<double, double, double> aerodynamic_acceleration()#
The acceleration of the vessel due to the total aerodynamic forces acting on it (
Flight::aerodynamic_force()divided by the vessel’s mass), in reference frameReferenceFrame.- Returns:
A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in \(m/s^2\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> lift_acceleration()#
The acceleration of the vessel due to
Flight::lift()(the aerodynamic lift divided by the vessel’s mass), in reference frameReferenceFrame.- Returns:
A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in \(m/s^2\).
- Game Scenes:
Flight
-
std::tuple<double, double, double> drag_acceleration()#
The acceleration of the vessel due to
Flight::drag()(the aerodynamic drag divided by the vessel’s mass), in reference frameReferenceFrame.- Returns:
A vector pointing in the direction that the vessel is accelerated, with its magnitude equal to the acceleration in \(m/s^2\).
- Game Scenes:
Flight
-
float speed_of_sound()#
The speed of sound, in the atmosphere around the vessel, in \(m/s\).
- Game Scenes:
Flight
-
float mach()#
The speed of the vessel, in multiples of the speed of sound.
- Game Scenes:
Flight
-
float reynolds_number()#
The vessels Reynolds number.
- Game Scenes:
Flight
Note
Requires Ferram Aerospace Research.
-
float true_air_speed()#
The true air speed of the vessel, in meters per second.
- Game Scenes:
Flight
-
float equivalent_air_speed()#
The equivalent air speed of the vessel, in meters per second.
- Game Scenes:
Flight
-
float terminal_velocity()#
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
-
float angle_of_attack()#
The pitch angle between the orientation of the vessel and its velocity vector, in degrees.
- Game Scenes:
Flight
-
float sideslip_angle()#
The yaw angle between the orientation of the vessel and its velocity vector, in degrees.
- Game Scenes:
Flight
-
float total_air_temperature()#
The total air temperature of the atmosphere around the vessel, in Kelvin. This includes the
Flight::static_air_temperature()and the vessel’s kinetic energy.- Game Scenes:
Flight
-
float static_air_temperature()#
The static (ambient) temperature of the atmosphere around the vessel, in Kelvin.
- Game Scenes:
Flight
-
float stall_fraction()#
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.
-
float drag_coefficient()#
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.
-
float lift_coefficient()#
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.
-
float ballistic_coefficient()#
-
- Game Scenes:
Flight
Note
Requires Ferram Aerospace Research.
-
float thrust_specific_fuel_consumption()#
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.
-
float g_force()#