MASFlightComputerProxy2 - MOARdV/AvionicsSystems GitHub Wiki

MASFlightComputerProxy2.cs

Contents

The fc group contains the core interface between KSP, Avionics Systems, and props in an IVA. It consists of many 'information' functions that can be used to get information as well as numerous 'action' functions that are used to do things.

Due to the number of methods in the fc group, this document has been split across three pages:

NOTE 1: If a function listed below includes an entry for 'Supported Mod(s)', then that function will automatically use one of the mods listed to generate the data. In some cases, it is possible that the function does not work without one of the required mods. Those instances are noted in the function's description.

NOTE 2: Many descriptions make use of mathetmatical short-hand to describe a range of values. This short-hand consists of using square brackets [ and ] to denote "inclusive range", while parentheses ( and ) indicate exclusive range.

For example, if a parameter says "an integer between [0, fc.ExperimentCount())", it means that the parameter must be an integer greater than or equal to 0, but less than fc.ExperimentCount().

For another example, if a parameter says "a number in the range [0, 1]", it means that the number must be at least zero, and it must not be larger than 1.


Maneuver Node Category

Methods for querying and controlling maneuver nodes are in this category.

fc.AddManeuverNode(double progradedV, double normaldV, double radialdV, double timeUT)

  • progradedV: ΔV in the prograde direction at the time of the maneuver, in m/s.
  • normaldV: ΔV in the normal direction at the time of the maneuver, in m/s.
  • radialdV: ΔV in the radial direction at the time of the maneuver, in m/s.
  • timeUT: UT to schedule the maneuver, in seconds.

Returns: 1 if the manuever node was created, 0 on any errors.

Replace any scheduled maneuver nodes with this maneuver node.

fc.ClearManeuverNode()

Returns: 1 if any nodes were cleared, 0 if no nodes were cleared.

Clear all scheduled maneuver nodes.

fc.ManeuverNodeAp()

Returns: New Ap in meters, or 0 if no node is scheduled.

Returns the apoapsis of the orbit that results from the scheduled maneuver.

fc.ManeuverNodeBurnTime()

Returns: Approximate burn time in seconds, or 0 if no node is scheduled.

Returns an estimate of the maneuver node burn time, in seconds.

fc.ManeuverNodeDV()

Returns: ΔV in m/s, or 0 if no node is scheduled.

Delta-V remaining for the next scheduled node.

fc.ManeuverNodeDVNormal()

Returns: ΔV in m/s; negative values indicate anti-normal.

The normal component of the next scheduled maneuver.

fc.ManeuverNodeDVPrograde()

Returns: ΔV in m/s; negative values indicate retrograde.

The prograde component of the next scheduled maneuver.

fc.ManeuverNodeDVRadial()

Returns: ΔV in m/s; negative values indicate anti-radial.

The radial component of the next scheduled maneuver.

fc.ManeuverNodeEcc()

Returns: New eccentricity, or 0 if no node is scheduled.

Returns the eccentricity of the orbit that results from the scheduled maneuver.

fc.ManeuverNodeExists()

Returns 1 if there is a valid maneuver node; 0 otherwise

fc.ManeuverNodeInc()

Returns: New inclination in degrees, or 0 if no node is scheduled.

Returns the inclination of the orbit that results from the scheduled maneuver.

fc.ManeuverNodeNextBody()

Returns the index to the body that the vessel will encounter after a change in SoI caused by a scheduled maneuver node. If there is no maneuver node, or the vessel does not change SoI because of the maneuver, returns -1 (current body).

fc.ManeuverNodeNextSoI()

Returns: 0 if the orbit does not transition. 1 if the vessel will encounter a body, -1 if the vessel will escape the current body.

Returns 1 if the SoI change after a scheduled maneuver is an 'encounter', -1 if it is an 'escape', and 0 if the scheduled orbit does not change SoI.

fc.ManeuverNodePe()

Returns: New Pe in meters, or 0 if no node is scheduled.

Returns the periapsis of the orbit that results from the scheduled maneuver.

fc.ManeuverNodeRelativeInclination()

Returns: New relative inclination in degrees, or 0 if there is no maneuver node, no target, or the target orbits a different body.

Returns the relative inclination of the target that will result from the scheduled maneuver.

fc.ManeuverNodeTargetClosestApproachDistance()

Returns: Closest approach to the target, or 0.

Closest approach to the target after the next maneuver completes, in meters. If there is no maneuver scheduled, or no target, returns 0.

fc.ManeuverNodeTargetClosestApproachSpeed()

Returns: Relative speed of the target at closest approach after the maneuver, m/s.

Relative speed of the target at closest approach after the scheduled maneuver, in m/s. If there is no maneuver scheduled, or no target, returns 0.

fc.ManeuverNodeTargetClosestApproachTime()

Returns: Time until closest approach after the maneuver.

Time when the closest approach with a target occurs after the scheduled maneuver, in seconds. If there is no maneuver scheduled, or no target, returns 0.

fc.ManeuverNodeTime()

Returns time in seconds until the maneuver node; 0 if no node is valid.

fc.ManeuverNodeTimeToNextSoI()

Returns: Time until the next SoI after the scheduled maneuver, or 0

Returns the time to the next SoI transition in the scheduled maneuver, in seconds. If the planned orbit does not change SoI, or no node is scheduled, returns 0.

fc.ManeuverNodeTotalDV()

Returns: ΔV in m/s, or 0 if no node is scheduled.

Total Delta-V required for the next scheduled node. This value does not account for any maneuvering.


Mass Category

Vessel mass may be queried with these methods.

fc.Mass(bool wetMass)

  • wetMass: wet mass if true, dry mass otherwise

Returns: Vessel mass in tonnes.

Returns the mass of the vessel in tonnes.


Math Category

Provides MAS-native methods for common math primitives. These methods generally duplicate the functions in the Lua math table, but by placing them in MAS, MAS can use native delegates instead of having to call into Lua (which is slower).

This region also contains other useful mathematical methods.

fc.Abs(double value)

Returns: The absolute value of value.

Returns the absolute value of value.

fc.Between(double value, double lowerBound, double upperBound)

  • value: The value to test.
  • lowerBound: The lower bound (inclusive) of the range to test.
  • upperBound: The upper bound (inclusive) of the range to test.

Returns: 1 if value is between lowerBound and upperBound, 0 otherwise.

Returns 1 if value is at least equal to lowerBound and not greater than upperBound. Returns 0 otherwise.

In other words,

  • If value >= lowerBound and value <= upperBound, return 1.
  • Otherwise, reutrn 0.

fc.BitwiseAnd(double value1, double value2)

  • value1: An integer value.
  • value2: An integer value.

Returns: value1 AND value2

Converts value1 and value2 to 32 bit integers and applies a bitwise-AND operation.

fc.BitwiseOr(double value1, double value2)

  • value1: An integer value.
  • value2: An integer value.

Returns: value1 OR value2

Converts value1 and value2 to 32 bit integers and applies a bitwise-OR operation.

fc.BitwiseNegate(double value)

  • value: An integer value.

Returns: ~value

Converts value to a 32 bit value and applies a bitwise-negation operation.

fc.BitwiseXor(double value1, double value2)

  • value1: An integer value.
  • value2: An integer value.

Returns: value1 XOR value2

Converts value1 and value2 to 32 bit integers and applies a bitwise-XOR operation.

fc.Ceiling(double value)

  • value: The value to round

Rounds a number up to the next integer.

fc.Clamp(double value, double a, double b)

  • value: The value to clamp.
  • a: The first bound.
  • b: The second bound.

Returns: The clamped value.

Clamps value to stay within the range a to b, inclusive. a does not have to be less than b.

fc.Floor(double value)

  • value: The value to round

Rounds a number down to the next integer.

fc.InverseLerp(double value, double range1, double range2)

  • value: The value to evaluate.
  • range1: The first bound of the range.
  • range2: The second bound of the range.

Returns: A value in the range [0, 1] as described in the summary.

Provides an "inverse lerp" of value, returning a value between 0 and 1 depending on where value falls between range1 and range2.

If range1 == range2, or if value < range1, it returns 0.

If value > range2, it returns 1.

fc.Max(double a, double b)

  • a: The first value to test.
  • b: The second value to test.

Returns: a if a is larger than b; b otherwise.

Return the larger value

fc.Min(double a, double b)

  • a: The first value to test.
  • b: The second value to test.

Returns: a if a is smaller than b; b otherwise.

Return the smaller value

fc.NormalizeAngle(double angle)

  • angle: The de-normalized angle to correct.

Returns: A value between 0 (inclusive) and 360 (exclusive).

Normalizes an angle to the range [0, 360).

fc.NormalizeLongitude(double angle)

  • angle: The de-normalized angle to correct.

Returns: A value between -180 (inclusive) and +180 (exclusive).

Normalizes an angle to the range [-180, 180).

fc.NormalizePitch(double angle)

  • angle: The angle to convert

Returns: A value between -90 and +90, inclusive.

Converts an angle to a pitch value in the range of [-90, +90].

fc.PseudoLog10(double sourceValue)

  • sourceValue: An input number

Returns: A Log10-like representation of the input value.

Apply a log10-like curve to the value.

The exact formula is:

if (abs(sourceValue) < 1.0)
  return sourceValue;
else
  return (1 + Log10(abs(sourceValue))) * Sign(sourceValue);
end

fc.RoundZero(double sourceValue)

Round the given value towards zero (round down for positive values, round up for negative values).

fc.SafeDivide(double numerator, double denominator)

  • numerator: The numerator
  • denominator: The denominator

Returns: numerator / denominator, or 0 if the denominator is zero.

Divides numerator by denominator. If the denominator is zero, this method returns 0 instead of infinity or throwing a divide-by-zero exception.

fc.SafeModulo(double numerator, double denominator)

  • numerator: The numerator
  • denominator: The denominator

Returns: A value between 0 and denominator, or 0 if the denominator is zero.

Returns the remainder of numerator divided by denominator. If the denominator is zero, this method returns 0 instead of infinity or throwing a divide-by-zero exception.


Meta Category

Meta variables and functions are variables provide information about the game, as opposed to the vessel. They also include the fc.Conditioned() functions, which can provide some realism by disrupting lighting under low power or high G situations.

fc.AssemblyLoaded(string assemblyName)

Returns: 1 if the named assembly is loaded, 0 otherwise.

Checks for the existence of the named assembly (eg, fc.AssemblyLoaded("MechJeb2")). This can be used to determine if a particular mod has been installed when that mod is not directly supported by Avionics Systems.

fc.CancelTimeWarp(bool instantCancel)

  • instantCancel: If true, time warp is immediately set to x1. If false, time warp counts downward like in normal gameplay.

Returns: 1 if time warp was successfully adjusted, 0 if it could not be adjusted.

Cancel time warp.

fc.ColorComponent(string namedColor, double channel)

  • namedColor: The named color to look up.
  • channel: The channel to return (0, 1, 2, or 3).

Returns: A value between [0, 255].

Returns the requested color channel for the namedColor specified. The parameter channel may be 0 (for red), 1 (for green), 2 (for blue), or 3 (for alpha).

Invalid channels or invalid named colors will result in a 255 being returned.

fc.ColorTag(double red, double green, double blue)

  • red: Red channel value, [0, 255]
  • green: Green channel value, [0, 255]
  • blue: Blue channel value, [0, 255]

Returns: The color tag that represents the requested color.

Converts the supplied RGB value into a MAS text color tag (eg, fc.ColorTag(255, 255, 0) returns "[#ffff00]"). This value is slightly more efficient if you do not need to change the alpha channel.

All values are clamped to the range 0 to 255.

fc.ColorTag(double red, double green, double blue, double alpha)

  • red: Red channel value, [0, 255]
  • green: Green channel value, [0, 255]
  • blue: Blue channel value, [0, 255]
  • alpha: Alpha channel value, [0, 255]

Returns: The color tag that represents the requested color.

Converts the supplied RGBA value into a MAS text color tag (eg, fc.ColorTag(255, 255, 0, 255) returns "[#ffff00ff]").

All values are clamped to the range 0 to 255.

fc.ColorTag(string namedColor)

  • namedColor: The named color to look up.

Returns: The color tag that represents the named color.

Looks up the Named Color namedColor, and returns its value as a color tag. For instance, fc.ColorTag("COLOR_XKCD_KSPUNNAMEDCYAN") will return "[#5fbdb9ff]".

If an invalid color is selected, this function returns bright magenta "[#ff00ff]".

fc.Conditioned(double value)

  • value: A numeric value or a boolean

Returns: value if the conditions above are not met.

Applies some "realism" conditions to the variable to cause it to return zero under the following conditions:

  1. When there is no power available (the config-file-specified power variable is below 0.0001), or

  2. The craft is under high g-loading. G-loading limits are defined in the per-pod config file. When these limits are exceeded, there is a chance (also defined in the config file) of the variable being interrupted. This chance increases as the g-forces exceed the threshold using a square-root curve, or

  3. The optional variable powerOnVariable in MASFlightComputer returns 0 or less.

The variable fc.Conditioned(1) behaves the same as the RasterPropMonitor ASET Props custom variable CUSTOM_ALCOR_POWEROFF, with an inverted value (CUSTOM_ALCOR_POWEROFF returns 1 to indicate "disrupt", but fc.Conditioned(1) returns 0 instead).

For boolean parameters, true is treated as 1, and false is treated as 0.

fc.Conditioned(double value, double defaultValue)

  • value: A numeric value or a boolean
  • defaultValue: The value that is returned if the conditions described in the summary are not met.

Returns: value if the conditions above are not met.

Applies some "realism" conditions to the variable to cause it to return 'defaultValue' under the following conditions:

  1. When there is no power available (the config-file-specified power variable is below 0.0001), or

  2. The craft is under high g-loading. G-loading limits are defined in the per-pod config file. When these limits are exceeded, there is a chance (also defined in the config file) of the variable being interrupted. This chance increases as the g-forces exceed the threshold using a square-root curve, or

  3. The optional variable powerOnVariable in MASFlightComputer returns 0 or less.

This variant of 'fc.Conditioned()' is intended to be used with ANIMATION or other nodes where the 'off' position is not the same as the 0 position. If the off position should be 0, use the single-parameter fc.Conditioned.

fc.DebugValue(double index)

  • index: An integer between 0 and the length of the debug array.

Returns: Contents of the debug value, or an empty string.

Returns the value of a debug 'register' in MAS.

NOTE: The debug registers are used for development and debugging purposes. Bugs filed against this method will be summarily dismissed.

fc.FlightUIMode()

Returns: A mode number as described above, or -1 if the mode cannot be queried.

Returns the current Flight UI Mode.

The Flight UI mode is the UI typically in the lower-left corner of the screen during flight when not in IVA. It may be one of the following values:

  • 0 - Staging Mode
  • 1 - Docking Mode
  • 2 = Map Mode
  • 3 = Maneuver Edit Mode
  • 4 = Maneuver Info Mode

fc.FormatString(string format, object arg0)

  • format: The C# format string, with at most one variable field (eg, <=0=>).
  • arg0: The argument to formatString

Returns: The formatted string, or an empty string if an invalid parameter was supplied.

Applies parameter to formatString, returning the result.

The formatString parameter uses the MAS custom delimeters <= and =>. Only one variable may be substituted using formatString.

Ex 1: fc.FormatString("<=0:0.0=>", fc.GetAltitude())

Ex 2: fc.FormatString(fc.Select(fc.GetPersistentAsNumber("Precision"), "<=0:0.0=>", "<=0:0.000=>"), fc.GetAltitude())

fc.GetThrottleKeyPressed()

Returns: 1 if any throttle keys are being pressed, 0 otherwise.

Returns 1 if any of the throttle keys (full throttle, cut throttle, throttle up, throttle down) were pressed on the keyboard since the last Fixed Update, or if any of those keys are still being pressed.

fc.HoursPerDay()

Returns: 6 for Kerbin time, 24 for Earth time, or another value for modded installations.

Returns the number of hours per day on Kerbin. With a stock installation, this is 6 hours or 24 hours, depending on whether the Kerbin calendar or Earth calendar is selected. Mods may change this to a different value.

fc.KerbinTime()

Returns 1 if the KSP UI is configured for the Kerbin calendar (6 hour days); returns 0 for Earth days (24 hour).

fc.LogMessage(string message)

  • message: The string to write. Strings may be formatted using the Lua string library, or using the .. concatenation operator.

Log messages to the KSP.log. Messages will be prefixed with [MASFlightComputerProxy].

fc.MapIconU(double iconId)

  • iconId: The Icon Id - either fc.TargetTypeId() or one of the numbers listed in the description.

Returns: The U shift to select the icon from the '%MAP_ICON%' texture.

Returns the U texture shift required to display the map icon listed below. This function is intended to be used in conjunction with the '%MAP_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Invalid (not one of the below types)
  • 1 - Ship target
  • 2 - Plane target
  • 3 - Probe target
  • 4 - Lander target
  • 5 - Station target
  • 6 - Relay target
  • 7 - Rover target
  • 8 - Base target
  • 9 - EVA target
  • 10 - Flag target
  • 11 - Debris target
  • 12 - Space Object target
  • 13 - Unknown target
  • 14 - Celestial Body (planet)
  • 15 - Ap Icon
  • 16 - Pe Icon
  • 17 - AN Icon
  • 18 - DN Icon
  • 19 - Maneuver Node Icon
  • 20 - Ship location at intercept
  • 21 - Target location at intercept
  • 22 - Enter an SoI
  • 23 - Exit an SoI
  • 24 - Point of Impact (?)

Note that entries 0 - 14 correspond to the results of fc.TargetTypeId().

fc.MapIconV(double iconId)

  • iconId: The Icon Id - either fc.TargetTypeId() or one of the numbers listed in the description.

Returns: The V shift to select the icon from the '%MAP_ICON%' texture.

Returns the V texture shift required to display the map icon listed below. This function is intended to be used in conjunction with the '%MAP_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Invalid (not one of the below types)
  • 1 - Ship target
  • 2 - Plane target
  • 3 - Probe target
  • 4 - Lander target
  • 5 - Station target
  • 6 - Relay target
  • 7 - Rover target
  • 8 - Base target
  • 9 - EVA target
  • 10 - Flag target
  • 11 - Debris target
  • 12 - Space Object target
  • 13 - Unknown target
  • 14 - Celestial Body (planet)
  • 15 - Ap Icon
  • 16 - Pe Icon
  • 17 - AN Icon
  • 18 - DN Icon
  • 19 - Maneuver Node Icon
  • 20 - Ship location at intercept
  • 21 - Target location at intercept
  • 22 - Enter an SoI
  • 23 - Exit an SoI
  • 24 - Point of Impact (?)

Note that entries 0 - 14 correspond to the results of fc.TargetTypeId().

fc.MASVersion()

Returns: MAS Version in string format.

Returns the version number of the MAS plugin, as a string, such as 1.0.1.12331.

fc.NavballB(double iconId)

  • iconId: The icon as explained in the description.

Returns: The B value to use in passiveColor or activeColor.

Returns the B color value for the navball marker icon selected. This function is intended to be used in conjunction with the '%NAVBALL_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Prograde
  • 1 - Retrograde
  • 2 - Radial Out
  • 3 - Radial In
  • 4 - Normal +
  • 5 - Normal - (anti-normal)
  • 6 - Maneuver Node
  • 7 - Target +
  • 8 - Target - (anti-target)

If an invalid number is supplied, this function treats is as "Prograde".

fc.NavballG(double iconId)

  • iconId: The icon as explained in the description.

Returns: The G value to use in passiveColor or activeColor.

Returns the G color value for the navball marker icon selected. This function is intended to be used in conjunction with the '%NAVBALL_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Prograde
  • 1 - Retrograde
  • 2 - Radial Out
  • 3 - Radial In
  • 4 - Normal +
  • 5 - Normal - (anti-normal)
  • 6 - Maneuver Node
  • 7 - Target +
  • 8 - Target - (anti-target)

If an invalid number is supplied, this function treats is as "Prograde".

fc.NavballR(double iconId)

  • iconId: The icon as explained in the description.

Returns: The R value to use in passiveColor or activeColor.

Returns the R color value for the navball marker icon selected. This function is intended to be used in conjunction with the '%NAVBALL_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Prograde
  • 1 - Retrograde
  • 2 - Radial Out
  • 3 - Radial In
  • 4 - Normal +
  • 5 - Normal - (anti-normal)
  • 6 - Maneuver Node
  • 7 - Target +
  • 8 - Target - (anti-target)

If an invalid number is supplied, this function treats is as "Prograde".

fc.NavballU(double iconId)

  • iconId: The icon as explained in the description.

Returns: The U value to use in uvShift.

Returns the U texture shift to select the navball marker icon as listed below. This function is intended to be used in conjunction with the '%NAVBALL_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Prograde
  • 1 - Retrograde
  • 2 - Radial Out
  • 3 - Radial In
  • 4 - Normal +
  • 5 - Normal - (anti-normal)
  • 6 - Maneuver Node
  • 7 - Target +
  • 8 - Target - (anti-target)

If an invalid number is supplied, this function treats is as "Prograde".

fc.NavballV(double iconId)

  • iconId: The icon as explained in the description.

Returns: The V value to use in uvShift.

Returns the V texture shift to select the navball marker icon as listed below. This function is intended to be used in conjunction with the '%NAVBALL_ICON%' texture in MASMonitor IMAGE nodes.

  • 0 - Prograde
  • 1 - Retrograde
  • 2 - Radial Out
  • 3 - Radial In
  • 4 - Normal +
  • 5 - Normal - (anti-normal)
  • 6 - Maneuver Node
  • 7 - Target +
  • 8 - Target - (anti-target)

If an invalid number is supplied, this function treats is as "Prograde".

fc.PlayAudio(string sound, double volume, bool stopCurrent)

  • sound: The name (URI) of the sound to play.
  • volume: The volume to use for playback, between 0 and 1 (inclusive).
  • stopCurrent: If 'true', stops any current audio clip being played.

Returns: Returns 1 if the audio was played, 0 if it was not found or otherwise not played.

Play the audio file specified in sound, at the volume specified in volume. If stopCurrent is true, any current sound clip is canceled first. If stopCurrent is false, and an audio clip is currently playing, this call to PlayAudio does nothing.

fc.PlayMorseSequence(string sequence, double volume, bool stopCurrent)

  • sequence: The sequence of letters to play as a Morse Code.
  • volume: The volume to use for playback, between 0 and 1 (inclusive).
  • stopCurrent: If 'true', stops any current audio clip being played.

Play the sequence of letters as a Morse Code sequence. Letters play automatically, and a space ' ' inserts a pause in the sequence. All other characters are skipped.

fc.RecoverVessel()

Returns: 1 if the craft can be recovered (although it is also recovered immediately), 0 otherwise.

Recover the vessel if it is recoverable. Has no effect if the craft can not be recovered.

fc.RunMonitorStartupScript()

Returns: The number of scripts executed.

Run the startupScript on every monitor and prop in the pod that has a defined startupScript.

fc.ScrollingMarquee(string inputString, double maxChars, double scrollRate)

  • inputString: The string to use for the marquee.
  • maxChars: The maximum number of characters in the string to display.
  • scrollRate: The frequency, in seconds, that the marquee advances.

Returns: A substring of no more than maxChars length.

The ScrollingMarquee function takes a string, input, and it returns a substring of maximum length maxChars. The substring that is returned changes every scrollRate seconds if the string length is greater than maxChars, allowing for a scrolling marquee effect. Using this method with the Repetition Scrolling font can simulate an LED / LCD display.

Note that characters advance one character width at a time - it is not a smooth sliding movement.

fc.SetWarp(double warpRate, bool instantChange)

  • warpRate: The desired warp rate, such as '50'.
  • instantChange: Should the rate be changed instantly?

Returns: The warp rate selected. This may not be the exact value requested.

Attempt to set time warp rate to warpRate. Because KSP has specific supported rates, the rate selected may not match the rate requested. Warp rates are not changed when physics warp is enabled (such as while flying in the atmosphere).

fc.SIFormatValue(double value, double totalLength, double minDecimal, string delimiter, bool forceSign, bool showPrefix)

  • value: The number to format.
  • totalLength: The total length of the string.
  • minDecimal: The minimum decimal precision of the string.
  • delimiter: A custom delimiter, or an empty string "" to indicate no delimiter
  • forceSign: Require a space for the sign, even if the value is positive
  • showPrefix: Whether the SI prefix should be appended to the string.

Returns: The formatted string.

Provides a custom SI formatter with more control than the basic SIP format.

NOT IMPLEMENTED: Custom delimiter.

fc.VesselRecoverable()

Returns: 1 if the craft can be recovered, 0 otherwise.

Returns 1 if the vessel is recoverable, 0 otherwise.

fc.WarpTo(double UT)

  • UT: The Universal Time to warp to. Must be in the future.

Returns: 1 if the warp to time is successfully set, 0 if it was not.

Warp to the specified universal time. If the time is in the past, or the warp is otherwise not possible, nothing happens.


Orbit Parameters Category

Information on the vessel's current orbit are available in this category.

fc.Apoapsis()

Returns the orbit's apoapsis (from datum) in meters.

fc.CircularOrbitSpeed(double altitude)

  • altitude: Altitude in meters

Returns: The orbital speed in m/s needed for a circular orbit.

Returns the speed in m/s required to have a circular orbit at the provided altitude.

fc.Eccentricity()

Return the eccentricity of the orbit.

fc.Inclination()

Returns: Inclination in degrees.

Return the vessel's orbital inclination.

fc.NextBodyName()

Returns: Name of the body, or an empty string if the orbit does not change SoI.

Returns the name of the body that the vessel will be orbiting after the next SoI change. If the craft is not changing SoI, returns an empty string.

fc.TimeToNextSoI()

Returns the time to the next SoI transition. If the current orbit does not change SoI, returns 0.

fc.NextSoI()

Returns: 0 if the orbit does not transition. 1 if the vessel will encounter a body, -1 if the vessel will escape the current body.

Returns 1 if the next SoI change is an 'encounter', -1 if it is an 'escape', and 0 if the orbit is not changing SoI.

fc.OrbitPeriod()

Returns: Orbital period, seconds. Zero if the craft is not in flight.

Returns the orbital period, in seconds.

fc.Periapsis()

Returns the orbits periapsis (from datum) in meters.

fc.SemiMajorAxis()

Returns: SMA in meters.

Returns the semi-major axis of the current orbit. When the SMA matches a body's synchronous orbit SMA, the vessel is in a synchronous orbit.


Orientation Category

Variables related to the vessel's orientation in space, relative to a target, or relative to the surface, are here.

fc.AngleOfAttack()

Returns: The angle of attack, in degrees

Returns the angle of attack of the vessel. If FAR is installed, FAR's results are used.

fc.FlightPathAngle(double altitude)

  • altitude: The altitude above datum / sea level, in meters, at which the angle will be computed.

Returns: The flight path angle, in degrees, or 0.

Returns the angle between the prograde vector of the orbit and the horizon when the vessel crosses the specified altitude. If an invalid altitude is specified, returns 0.

This computation is based on unpowered flight, and it does not account for any effects caused by atmospheric lift. It also does not account for surface-relative motion, so it is not a good indicator for impact angle.

fc.Heading()

Return heading relative to the surface in degrees [0, 360)

fc.HeadingPrograde()

Return the heading of the surface velocity vector relative to the surface in degrees [0, 360)

fc.HeadingRate()

Returns: A value in the range of [-180, 180).

Return the instantaneous rate of change of the vessel heading in degrees per second.

Note that extreme rates may be misreported.

fc.Pitch()

Return pitch relative to the surface [-90, 90]

fc.PitchActivePrograde()

Pitch of the vessel relative to the current SAS prograde mode (orbit, surface, or target).

fc.PitchAntiNormal()

Pitch of the vessel relative to the orbit anti-normal vector.

fc.PitchAntiTarget()

Pitch of the vessel relative to the vector pointing away from the target.

fc.PitchDockingAlignment()

Returns the pitch component of the angle between a target docking port and a reference (on Vessel) docking port; 0 if the target is not a docking port or if the reference transform is not a docking port.

fc.PitchManeuver()

Pitch of the vessel relative to the next scheduled maneuver vector.

fc.PitchNormal()

Pitch of the vessel relative to the orbit normal vector.

fc.PitchRate()

Returns the pitch rate of the vessel in degrees/sec

fc.PitchPrograde()

Pitch of the vessel relative to the orbital prograde vector.

fc.PitchRadialIn()

Pitch of the vessel relative to the orbital Radial In vector.

fc.PitchRadialOut()

Pitch of the vessel relative to the orbital Radial Out vector.

fc.PitchRetrograde()

Pitch of the vessel relative to the orbital retrograde vector.

fc.PitchSAS()

Returns: Pitch in the range [+90, -90]

Pitch of the vessel relative to the current active SAS mode. If SAS is not enabled, or the current mode is Stability Assist, returns 0.

fc.PitchSurfacePrograde()

Pitch of the vessel relative to the surface prograde vector.

fc.PitchSurfaceRetrograde()

Pitch of the vessel relative to the surface retrograde vector.

fc.PitchTarget()

Pitch of the vessel relative to the vector pointing at the target.

fc.PitchTargetPrograde()

Pitch of the vessel relative to the target relative prograde vector.

fc.PitchTargetRetrograde()

Pitch of the vessel relative to the target relative retrograde vector.

fc.PitchWaypoint()

Pitch of the vessel relative to the active waypoint. 0 if no active waypoint.

fc.ReferenceTransformType()

Returns: A number as specified in the summary.

Returns a number identifying what the current reference transform is:

  • 1: The current IVA pod (if in IVA)
  • 2: A command pod or probe control part.
  • 3: A docking port
  • 4: A Grapple Node (Claw)
  • 0: Unknown.

fc.Roll()

Returns roll relative to the surface, in degrees. [-180, 180]

fc.RollDockingAlignment()

Returns: The relative roll between the vessel and the currently-targeted docking port, or 0.

Returns the roll angle in degrees between the vessel's reference transform and a targeted docking port. If the target is not a docking port, returns 0. Some docks have alignment requirements. To determine whether these docks are suitably aligned for docking, use fc.TargetDockError().

fc.RollRate()

Returns the roll rate of the vessel in degrees/sec

fc.Sideslip()

Returns: Sideslip in degrees.

Returns the vessel's current sideslip. If FAR is installed, it will use FAR's computation of sideslip.

fc.SlopeAngle()

Returns: Slope of the terrain below the vessel, or 0 if the slope cannot be read.

Returns the slope of the terrain directly below the vessel. If the vessel's altitude is too high to read the slope, returns 0.

fc.YawActivePrograde()

Yaw of the vessel relative to the current SAS prograde mode (orbit, surface, or target).

fc.YawAntiNormal()

Yaw of the vessel relative to the orbit's anti-normal vector.

fc.YawAntiTarget()

Yaw of the vessel relative to the vector pointing away from the target.

fc.YawDockingAlignment()

Returns the yaw angle between the vessel's reference transform and a targeted docking port. If the target is not a docking port, returns 0;

fc.YawManeuver()

Yaw of the vessel relative to the next scheduled maneuver vector.

fc.YawNormal()

Yaw of the vessel relative to the orbit's normal vector.

fc.YawRate()

Returns the yaw rate of the vessel in degrees/sec

fc.YawPrograde()

Yaw of the vessel relative to the orbital prograde vector.

fc.YawRadialIn()

Yaw of the vessel relative to the radial in vector.

fc.YawRadialOut()

Yaw of the vessel relative to the radial out vector.

fc.YawRetrograde()

Yaw of the vessel relative to the orbital retrograde vector.

fc.YawSAS()

Returns: Yaw in the range [+180, -180]

Yaw of the vessel relative to the current active SAS mode. If SAS is not enabled, or the current mode is Stability Assist, returns 0.

fc.YawSurfacePrograde()

Yaw of the vessel relative to the surface prograde vector.

fc.YawSurfaceRetrograde()

Yaw of the vessel relative to the surface retrograde vector.

fc.YawTarget()

Yaw of the vessel relative to the vector pointing at the target.

fc.YawTargetPrograde()

Yaw of the vessel relative to the target relative prograde vector.

fc.YawTargetRetrograde()

Yaw of the vessel relative to the target relative retrograde vector.

fc.YawWaypoint()

Yaw of the vessel relative to the active waypoint. 0 if no active waypoint.


Periodic Variables Category

Periodic variables change value over time, based on a requested frequency.

fc.PeriodCount(double period, double countTo)

  • period: The period required to increase the counter, in cycles/second (Hertz).
  • countTo: The exclusive upper limit of the count.

Returns: An integer between [0 and countTo).

Returns a periodic variable that counts upwards from 0 to 'countTo'-1 before repeating, with each change based on the 'period'. Note that the counter is not guaranteed to start at zero, since it is based on universal time.

fc.PeriodRandom(double period)

  • period: The period between updates, in cycles/second (Hertz).

Returns: A number between 0 and 1, inclusive. 0 if period is not a positive value.

Returns a random number in the range [0, 1] that updates based on period.

Note that all props using the same period will see the same value from this function.

fc.PeriodSine(double period)

  • period: The period of the change, in cycles/second (Hertz).

Returns: A number between -1 and +1.

Returns a periodic variable that follows a sine-wave curve.

fc.PeriodStep(double period)

  • period: The period of the change, in cycles/second (Hertz).

Returns: 0 or 1

Returns a stair-step periodic variable (changes from 0 to 1 to 0 with no ramps between values).


Persistent Vars Category

Persistent variables are the primary means of data storage in Avionics Systems. As such, there are many ways to set, alter, or query these variables.

Persistent variables may be numbers or strings. Several of the setter and getter functions in this category will convert the variable automatically from one to the other (whenever possible), but it is the responsibility of the prop config maker to make sure that text and numbers are not intermingled when a specific persistent variable will be used as a number.

fc.AddPersistent(string persistentName, double amount)

  • persistentName: The name of the persistent variable to change.
  • amount: The amount to add to the persistent variable.

Returns: The new value of the persistent variable, or the name of the variable if it could not be converted to a number.

This method adds an amount to the named persistent. If the variable did not already exist, it is created and initialized to 0 before adding amount. If the variable was a string, it is converted to a number before adding amount.

If the variable cannot converted to a number, the variable's name is returned, instead.

fc.AddPersistentClamped(string persistentName, double amount, double minValue, double maxValue)

  • persistentName: The name of the persistent variable to change.
  • amount: The amount to add to the persistent variable.
  • minValue: The minimum value of the variable. If adding amount to the variable causes it to be less than this value, the variable is set to this value, instead.
  • maxValue: The maximum value of the variable. If adding amount to the variable causes it to be greater than this value, the variable is set to this value, instead.

Returns: The new value of the persistent variable, or the name of the variable if it could not be converted to a number.

This method adds an amount to the named persistent. The result is clamped to the range [minValue, maxValue].

If the variable did not already exist, it is created and initialized to 0 before adding amount. If the variable was a string, it is converted to a number before adding amount.

If the variable cannot converted to a number, the variable's name is returned, instead.

fc.AddPersistentWrapped(string persistentName, double amount, double minValue, double maxValue)

  • persistentName: The name of the persistent variable to change.
  • amount: The amount to add to the persistent variable.
  • minValue: The minimum value of the variable. If adding amount would make the variable less than minValue, MAS sets the variable to maxValue minus the difference.
  • maxValue: The maximum value of the variable. If adding amount would make the variable greather than maxValue, MAS sets the variable to minValue plus the overage.

Returns: The new value of the persistent variable, or the name of the variable if it could not be converted to a number.

This method adds an amount to the named persistent. The result wraps around the range [minValue, maxValue]. This feature is used, for instance, for adjusting a heading between 0 and 360 degrees without having to go from 359 all the way back to 0. maxValue is treated as an alias for minValue, so if adding to a persistent value makes it equal exactly maxValue, it is set to minValue instead. With the heading example above, for instance, you would use fc.AddPersistentWrapped("SomeVariableName", 1, 0, 360).

To make a counter that runs from 0 to 2 before wrapping back to 0 again, fc.AddPersistentWrapped("SomeVariableName", 1, 0, 3).

If the variable did not already exist, it is created and initialized to 0 before adding amount. If the variable was a string, it is converted to a number before adding amount.

If the variable cannot converted to a number, the variable's name is returned, instead.

If minValue and maxValue are the same, amount is treated as zero (nothing is added).

fc.AppendPersistent(string persistentName, string addon, double maxLength)

  • persistentName: The name of the persistent variable to change.
  • amount: The amount to add to the persistent variable.
  • maxLength: The maximum number of characters allowed in the string. Characters in excess of this amount are not added to the persistent.

Returns: The new string.

Append the string addon to the persistent variable persistentName, but only up to the specified maximum length. If the persistent does not exist, it is created and initialized to addon. If the persistent is a numeric value, it is converted to a string, and then addon is added.

fc.AppendPersistentDigit(string persistentName, double digit, double maxLength)

  • persistentName: The name of the persistent variable to change.
  • digit: An integer in the range [0, 9].
  • maxLength: The maximum number of digits that persistentName may contain.

Returns: The new value. If the number was not updated, the old value is returned.

Treat the persistent value persistentName as a number. The integer digit is appended to the end of the number, but only if the resulting string length remains less than or equal to maxLength.

This behiavor mimics the effect of typing a number on a calculator or other numeric input. digit must be an integer between 0 and 9 (inclusive), or this function has no effect.

This method does not support adding a decimal point. The conventional fc.AppendPersistent() must be used for that capability.

fc.ClearBits(string persistentName, double bits)

  • persistentName: The name of the persistent variable to change.
  • bits: An integer representing the bits to clear.

Returns: Result of the bit-wise AND.

Clears 0 or more bits in the number stored in persistentName.

The value in persistentName is converted to a 32 bit integer, as is bits. bits is converted to its bitwise negation, and A bit-wise AND is applied, and the resulting value is stored in persistentName.

If persistentName does not exist yet, or it is a string that cannot be converted to an integer, it is set to 0 before the AND.

fc.GetPersistent(string persistentName)

  • persistentName: The name of the persistent variable to query.

Returns: The value of the persistent, or its name if it does not exist.

Return value of the persistent. Strings are returned as strings, numbers are returned as numbers. If the persistent does not exist yet, the name is returned.

fc.GetPersistentAsNumber(string persistentName)

  • persistentName: The name of the persistent variable to query.

Returns: The numeric value of the persistent, or 0 if it either does not exist, or it cannot be converted to a number.

Return the value of the persistent as a number. If the persistent does not exist yet, or it is a string that can not be converted to a number, return 0.

fc.GetPersistentExists(string persistentName)

  • persistentName: The persistent variable name to check.

Returns: 1 if the variable contains initialized data, 0 if it does not.

Returns 1 if the named persistent variable has been initialized. Returns 0 if the variable does not exist yet.

fc.InitializePersistent(string persistentName, object value)

  • persistentName: The name of the persistent variable to initialize.
  • value: The new number or text string to use for this persistent.

Returns: 1 if the persistent value was created, 0 if it already exists.

Set the persistent value in persistentName to value, but only if the persistent value does not already exist. If the persistent already exists, this function does nothing.

This function can be used to replace a script construct like

if GetPersistentExists("MyPersistent") == 0 then
  SetPersistent("MyPersistent", 42)
endif

with a single initialization call.

fc.SetBits(string persistentName, double bits)

  • persistentName: The name of the persistent variable to change.
  • bits: An integer representing the bits to set.

Returns: Result of the bit-wise OR.

Sets 0 or more bits in the number stored in persistentName.

The value in persistentName is converted to a 32 bit integer, as is bits. A bit-wise OR is applied, and the resulting value is stored in persistentName.

If persistentName does not exist yet, or it is a string that cannot be converted to an integer, it is set to 0 before the OR.

fc.SetPersistent(string persistentName, object value)

  • persistentName: The name of the persistent variable to change.
  • value: The new number or text string to use for this persistent.

Returns: value

Set a persistent to value. value may be either a string or a number. The existing value of the persistent is replaced.

fc.SetPersistentBlended(string persistentName, double value, double maxChangePerSecond)

  • persistentName: The name of the persistent variable to change.
  • value: The new value for this variable.
  • maxChangePerSecond: The maximum amount the existing variable may change per second.

Returns: The resulting value.

Set a persistent to value, but allow the persistent to change by at most maxChangePerSecond from its initial value.

If the persistent did not already exist, or if it was a string that could not be converted to a number, it is set to value immediately.

For other cases, the persistent's value is updated by adding or subtracting the minimum of (maxChangePerSecond * timestep) or Abs(old value - value).

While this method is a "setter" method, it is best applied where its results are displayed, such as a number on an MFD, or controlling the animation of a prop. This will ensure that the number continually updates, whereas using this method in a collider action will cause it to only update the value when the collider is hit.

fc.TogglePersistent(string persistentName)

  • persistentName: The name of the persistent variable to change.

Returns: 0 or 1.

Toggle a persistent between 0 and 1.

If the persistent is a number, it becomes 0 if it was already a positive number, and it becomes 1 if it was previously <= 0.

If the persistent is a string, it is converted to a number, and the same rule is applied.

If the persistent did not previously exist, or it is a string that cannot be converted to a number, it is treated as if it were zero.


Position Category

The Position category provides information about the vessel's position relative to a body (latitude and longitude) as well as landing predictions and the like.

The landing predictions will use Kerbal Engineer Redux if that mod is installed. If KER is not available, MAS will fall back to using the MechJeb Landing Predictions module if it is enabled. Otherwise, MAS uses a very rudimentary predictor that assumes the planet has no atmosphere. Because of these limitations, the results will change during atmospheric braking, and they may be wildly inaccurate in mountainous terrain.

fc.LandingAltitude()

Returns: Predicted altitude (meters ASL) of the point of landing.

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns the predicted altitude of the landing position.

See the category description for limitations on this function.

fc.LandingLatitude()

Returns: Latitude of estimated landing point, or 0 if the orbit does not lithobrake.

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns the predicted latitude of the landing position.

See the category description for limitations on this function.

fc.LandingLongitude()

Returns: Longitude of estimated landing point, or 0 if the orbit does not lithobrake.

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns the predicted longitude of the landing position.

See the category description for limitations on this function.

fc.LandingSpeed()

Returns: Impact speed in m/s, or 0 if the vessel will not intersect the planet.

Returns an estimate of the speed of the vessel at landing, based on current speed and current thrust.

This is purely an estimate, and it does not account for atmospheric drag or maximum available thrust.

If the vessel will not lithobrake, or if the current thrust is adequate, the speed estimate is 0.

fc.LandingTime()

Returns: Estimated time until landing, or 0 if the orbit does not lithobrake.

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns the predicted time until landing in seconds.

See the category description for limitations on this function.

fc.LandingPredictorActive()

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns 1 if landing predictions are valid. If Kerbal Engineer Redux is installed, MAS will use KER's predictions. Otherwise, if MechJeb is installed, MAS will use MechJeb's landing computer (if it is active). If neither of those options are available, MAS uses its own internal predictor.

fc.Latitude()

Return the vessel's latitude.

fc.Longitude()

Return the vessel's longitude.

fc.MASLandingAltitude()

Returns: Predicted altitude (meters ASL) of the point of landing.

Returns the predicted altitude of the landing position.

This version will not use any mods to compute the landing site.

See the category description for limitations on this function.

fc.MASLandingLatitude()

Returns: Latitude of estimated landing point, or 0 if the orbit does not lithobrake.

Returns the predicted latitude of the landing position.

This version will not use any mods to compute the landing site.

See the category description for limitations on this function.

fc.MASLandingLongitude()

Returns: Longitude of estimated landing point, or 0 if the orbit does not lithobrake.

Returns the predicted longitude of the landing position.

This version will not use any mods to compute the landing site.

See the category description for limitations on this function.

fc.MASLandingTime()

Returns: Estimated time until landing, or 0 if the orbit does not lithobrake.

Returns the predicted time until landing in seconds.

This version will not use any mods to compute the landing site.

See the category description for limitations on this function.


Power Production Category

Queries and controls related to power production belong in this category.

For all of these components, if the player has changed the ElectricCharge field in the MAS config file, these components will track that resource instead.

The Fuel Cell methods track any ModuleResourceConverter that outputs ElectricCharge, unless a different resource converter tracker has been installed with a higher priority. For general-purpose ModuleResourceConverter tracking, refer to Resource Converter category.

fc.AlternatorCount()

Returns: Number of alternator modules.

Returns the number of alternators on the vessel.

fc.AlternatorOutput()

Returns: Units of ElectricCharge/second

Returns the current net output of the alternators.

fc.FuelCellCount()

Returns: Number of fuel cells.

Returns the number of fuel cells on the vessel. Fuel cells are defined as ModuleResourceConverter units that output ElectricCharge (or whatever the player-selected override is in the MAS config file).

fc.FuelCellOutput()

Returns: Units of ElectricCharge/second.

Returns the current output of installed fuel cells.

fc.GeneratorCount()

Returns: Number of generator.s

Returns the number of generators on the vessel. Generators are and ModuleGenerator that outputs ElectricCharge.

fc.GeneratorOutput()

Returns: Output in ElectricCharge/sec.

Returns the current output of installed generators.

fc.GetFuelCellActive()

Returns: 1 if any fuel cell is switched on; 0 otherwise.

Returns 1 if at least one fuel cell is enabled; 0 otherwise.

fc.SetFuelCellActive(bool active)

Returns: 1 if fuel cells are now active, 0 if they're off or they could not be toggled.

Sets the fuel cells on or off per the 'active' parameter. Fuel cells that can not be manually controlled are not changed.

fc.SetSolarPanelDeploy(bool deploy)

  • deploy: 'true' to extend solar panels, 'false' to retract them (when possible).

Returns: 1 if at least one panel is moving; 0 otherwise.

Deploys / undeploys solar panels.

fc.SolarPanelCount()

Returns: The number of solar panel modules on the vessel.

Returns the number of solar panels on the vessel.

fc.SolarPanelDamaged()

Returns: 1 is all solar panels are damaged; 0 otherwise.

Returns 1 if any solar panels are damaged.

fc.SolarPanelDeployable()

Returns: 1 if any solar panel is retracted and available to deploy; 0 otherwise.

Returns 1 if at least one solar panel may be deployed.

fc.SolarPanelEfficiency()

Returns: The efficiency value, 0 or larger.

Returns the net efficiency of solar panels. This value can provide some information about blocked solar panels, or non-rotating solar panels that are not optimally positioned. Because the amount of energy delivered depends on the distance from the star, maximum efficiency can be larger than 1 (or less than 1).

fc.SolarPanelMoving()

Returns: -1, 0, or +1.

Returns -1 if a solar panel is retracting, +1 if a solar panel is extending, or 0 if no solar panels are moving.

fc.SolarPanelOutput()

Returns: Solar panel output in ElectricCharge/sec.

Returns the current output of installed solar panels.

fc.SolarPanelPosition()

Returns: Panel Position (a number between 0 and 1).

Returns a number representing the average position of undamaged deployable solar panels.

  • 0 - No solar panels, no undamaged solar panels, or all undamaged solar panels are retracted.
  • 1 - All deployable solar panels extended.

If the solar panels are moving, a number between 0 and 1 is returned. Note that unretractable panels will always return 1 once they have deployed.

fc.SolarPanelRetractable()

Returns: 1 if a solar panel is deployed, and it may be retracted; 0 otherwise.

Returns 1 if at least one solar panel is retractable.

fc.ToggleFuelCellActive()

Returns: 1 if fuel cells are now active, 0 if they're off or they could not be toggled.

Toggles fuel cells from off to on or vice versa. Fuel cells that can not be manually controlled are not toggled.

fc.ToggleSolarPanel()

Returns: 1 if at least one panel is moving; 0 otherwise.

Deploys / undeploys solar panels.


Procedural Fairings Category

This section contains the functions used to interact with the stock procedural fairings system.

fc.DeployFairings()

Returns: 1 if any fairings deployed, 0 otherwise.

Deploys all stock procedural fairings that are currently available to deploy.

fc.FairingsCanDeploy()

Returns: 1 if any fairings can deploy, 0 otherwise.

Returns 1 if at least one installed stock procedural fairing is available to deploy.

fc.FairingsCount()

Returns: The total number of stock p-fairings on the vessel.

Returns the number of stock procedural fairings installed on the vessel.


Radar Category

The Radar category provides the interface for controlling MASRadar modules installed on the craft.

fc.RadarActive()

Returns: 1 if any radar is switched on; 0 otherwise.

Returns 1 if any radars are turned on; 0 otherwise.

fc.RadarCount()

Returns: The count of the number of radar units installed on the vessel, 0 or higher.

Returns the number of radar modules available on the vessel.

fc.SetRadarActive(bool active)

  • active: 'true' to enable docking radars, false otherwise.

Returns: 1 if radars are now active, 0 otherwise.

Activate or deactivate docking radars.

fc.ToggleRadar()

Returns: 1 if radars are now active, 0 otherwise.

Toggle any installed radar from active to inactive.


Random Category

Random number generators are in this category.

fc.Random()

Returns: A uniformly-distributed pseudo-random number in the range [0, 1].

Return a random number in the range of [0, 1]

fc.RandomNormal(double mean, double stdDev)

  • mean: The desired mean of the normal distribution.
  • stdDev: The desired standard deviation of the normal distribution.

Returns: A pseudo-random number that emulates a normal distribution. See the summary for more detail.

Return an approximation of a normal distribution with a mean and standard deviation as specified. The actual result falls in the range of (-7, +7) for a mean of 0 and a standard deviation of 1.

fc.RandomNormal uses a Box-Muller approximation method modified to prevent a 0 in the u component (to avoid trying to take the log of 0). The number was tweaked so for all practical purposes the range of numbers is about (-7, +7), as explained above.


RCS Category

The RCS controls may be accessed in this category along with status variables.

fc.AnyRCSDisabled()

Returns: 1 if any ports are disabled; 0 if all are enabled or there are no RCS ports.

Returns 1 if any RCS ports are disabled on the vessel.

fc.CurrentRCSThrust()

Returns: A value between 0.0 and 1.0.

Returns the current thrust percentage of all enabled RCS thrusters. This number counts only active RCS ports. Even so, it is possible for the result to be less than 1.0. For instance, if some thrusters are firing at less than full power to maintain orientation while translating, the net thrust will be less than 1.0.

The result does not account for thrust reductions in the atmosphere due to lower ISP, so sea level thrust will be a fraction of full thrust.

fc.EnableAllRCS()

Returns: 1 if any disabled RCS ports were enabled, 0 if there were no disabled ports.

Enables any RCS ports that have been disabled.

fc.RCSHasActions()

Returns: 1 if any actions are assigned to the RCS group.

Returns 1 if the RCS action group has any actions attached to it. Note that RCS thrusters don't neccessarily appear here.

fc.GetRCS()

Returns: 1 if the RCS group is enabled, 0 otherwise.

Returns 1 if RCS is on, 0 otherwise.

fc.GetRCSActive()

Returns 1 if any RCS thrusters are firing, 0 otherwise.

fc.GetRCSRotate()

Returns 1 if any RCS thrusters are configured to allow rotation, 0 otherwise.

fc.GetRCSThrustLimit()

Returns: A weighted average between 0 (no thrust) and 1 (full rated thrust).

Returns the thrust-weighted average of the RCS thrust limit for all enabled RCS thrusters.

fc.GetRCSTranslate()

Returns 1 if any RCS thrusters are configured to allow translation, 0 otherwise.

fc.HasRCS()

Returns 1 if there is at least once RCS module on the vessel.

fc.SetRCS(bool active)

  • active: true to enable RCS, false to disable RCS.

Returns: 1 if the RCS group is enabled, 0 otherwise.

Set the state of RCS.

fc.SetRCSRotate(bool active)

  • active: Whether RCS should be used for rotation.

Returns: The number of RCS modules updated (0 if none, more than 0 if any RCS are installed).

Enable or disable RCS rotation control.

fc.SetRCSTranslate(bool active)

  • active: Whether RCS should be used for translation.

Returns: The number of RCS modules updated (0 if none, more than 0 if any RCS are installed).

Enable or disable RCS translation control.

fc.SetRCSThrustLimit(double limit)

  • limit: A value between 0 (no thrust) and 1 (full thrust).

Returns: The RCS thrust limit, clamped to [0, 1].

Set the maximum thrust limit of the RCS thrusters.

fc.ToggleRCS()

Returns: 1 if the RCS group is enabled, 0 otherwise.

Toggle RCS off-to-on or vice versa.

fc.ToggleRCSRotate()

Returns: 1 if rotation is now on, 0 otherwise.

Toggle RCS rotation control.

fc.ToggleRCSTranslate()

Returns: 1 if translation is now on, 0 otherwise.

Toggle RCS translation control.


Reaction Wheels Category

Methods for controlling and reporting information from reaction wheels are in this category.

Unlike other categories, the reaction wheels methods can be used to inspect the reaction wheels installed in the current pod (when currentPod is true), or the methods can be used to inspect all reaction wheels not in the current pod (when currentPod is false). To inspect values for all reaction wheels (current pod and rest of vessel), sum the results together (with the exception of ReactionWheelState).

fc.GetReactionWheelActive()

Returns 1 if at least one reaction wheel is on the vessel and active. Returns 0 otherwise.

fc.GetReactionWheelAuthority()

Returns: Reaction wheel authority in the range of [0, 1].

Returns the current reaction wheel authority as a percentage of maximum.

fc.GetReactionWheelDamaged()

Returns 1 if at least one reaction wheel is damaged. Returns 0 otherwise.

fc.ReactionWheelPitch()

Returns: The net pitch, between -1 and +1.

Returns the net pitch being applied by reaction wheels as a value between -1 and +1. Note that if two wheels are applying pitch in opposite directions, this value will cancel out and reprot 0.

fc.ReactionWheelRoll()

Returns: The net roll, between -1 and +1.

Returns the net roll being applied by reaction wheels as a value between -1 and +1. Note that if two wheels are applying roll in opposite directions, this value will cancel out and reprot 0.

fc.ReactionWheelTorque()

Returns: A number between 0 (no torque) and 1 (maximum torque).

Returns the total torque percentage currently being applied via reaction wheels.

fc.ReactionWheelYaw()

Returns: The net yaw, between -1 and +1.

Returns the net yaw being applied by reaction wheels as a value between -1 and +1. Note that if two wheels are applying yaw in opposite directions, this value will cancel out and reprot 0.

fc.SetReactionWheelActive(bool active)

  • active: If true, reaction wheels are activated. If false, they are deactivated.

Returns: 1 if any reaction wheels are installed, otherwise 0.

Enable or disable reaction wheels.

fc.SetReactionWheelAuthority(double authority)

  • authority: The new authority percentage, between 0 and 1. Value is clamped if it is outside that range.

Returns: The new reaction wheel authority, or 0 if no wheels are available.

Update all active reaction wheels' authority.

fc.ToggleReactionWheel()

Returns: 1 if any reaction wheels are installed, otherwise 0.

Toggle the reaction wheels.


This documentation was automatically generated from source code at 19:51 UTC on 22/Aug/2020.

⚠️ **GitHub.com Fallback** ⚠️