MASIMechJeb - MOARdV/AvionicsSystems GitHub Wiki

MASIMechJeb.cs

Contents

MASIMechJeb provides the interface for controlling and querying MechJeb from Avionics Systems.


MechJeb General Category

The General category provides some non-specific queries and actions (such as whether MechJeb functionality is available on a given craft).

mechjeb.AutopilotActive()

Returns 1 if any of the MechJeb autopilots MAS can control are active.

mechjeb.Available()

Returns 1 if MechJeb is installed and available on this craft, 0 if it is not available.

mechjeb.ComputerActive()

Returns 1 if any managed autopilots are engaged, or if SmartASS is not OFF.

mechjeb.Reset()

Resets / disables all auto pilots as well as SmartASS.


MechJeb Ascent Autopilot and Guidance Category

The Ascent Autopilot and Guidance methods provide an interface to MechJeb's Ascent Autopilot.

mechjeb.AscentAutopilotActive()

Returns 1 if the MJ Ascent Autopilot is enabled; 0 otherwise.

mechjeb.GetDesiredLaunchAltitude()

Returns the MJ Ascent Autopilot's targeted launch altitude in meters.

mechjeb.GetDesiredLaunchInclination()

Returns the MJ Ascent Autopilot's targeted orbital inclination in degrees.

mechjeb.GetForceRoll()

Returns 1 if MechJeb is installed and the ascent autopilot's Force Roll mode is enabled. Returns 0 otherwise.

mechjeb.GetTurnRoll()

Returns: Current turn roll setting.

Return the current ascent autopilot turn roll.

mechjeb.GetVerticalRoll()

Returns: Current vertical roll setting.

Return the current ascent autopilot vertical roll.

mechjeb.SetDesiredLaunchAltitude(double altitude)

Set the ascent guidance desired altitude. Altitude is in meters.

mechjeb.SetDesiredLaunchInclination(double inclination)

Set the desired launch inclination in the ascent guidance.

mechjeb.SetTurnRoll(double turnRoll)

  • turnRoll: The turn roll, in degrees.

Returns: 1 if the value was set, 0 otherwise.

Set the ascent autopilot's turn roll to the value specified.

mechjeb.SetVerticalRoll(double verticalRoll)

  • turnRoll: The vertical roll, in degrees.

Returns: 1 if the value was set, 0 otherwise.

Set the ascent autopilot's vertical roll to the value specified.

mechjeb.ToggleAscentAutopilot()

Returns: 1 if the autopilot was engaged, 0 if it was disengaged or unavailable.

Toggles the Ascent Autopilot on or off.

mechjeb.ToggleForceRoll()

Toggle the Ascent Autopilot's "Force Roll" option.


MechJeb Docking Autopilot Category

Interface for the MechJeb Docking Autopilot.

mechjeb.DockingAutopilotActive()

Returns: 1 or 0, as described in the summary.

Returns 1 if the Docking Autopilot is enabled. Returns 0 otherwise.

mechjeb.ToggleDockingAutopilot()

Returns: 1 if the autopilot was engaged, 0 if it was disengaged or unavailable.

Toggles the Docking Autopilot on or off.


MechJeb Landing Autopilot and Computer Category

The Landing Autopilot and Computer methods provide an interface to MechJeb's Landing Autopilot. It can also independently trigger the Landing Computer to provide landing predictions.

mechjeb.LandingAutopilotActive()

Returns: 1 if the landing autopilot is active, 0 otherwise

Returns 1 if the MechJeb landing autopilot is engaged.

mechjeb.LandingComputerActive()

Returns: 1 if the landing prediction computer is enabled; 0 otherwise.

Returns 1 if the MechJeb landing prediction computer is engaged.

mechjeb.LandingAltitude()

Returns: Terrain Altitude in meters at the predicted landing site; 0 if the orbit does not land.

When the landing prediction computer is engaged, returns the predicted altitude of the landing site. Returns 0 otherwise.

mechjeb.LandingLatitude()

Returns: Latitude in degrees; north is positive, south is negative; 0 if the prediciton computer is off or the orbit does not land.

When the landing prediction computer is engaged, returns the predicted latitude of the landing site. Returns 0 otherwise.

mechjeb.LandingLongitude()

Returns: Longitude in degrees. West is negative, east is positive; 0 if the orbit will not land.

When the landing prediction computer is engaged, returns the predicted longitude of the landing site. Returns 0 otherwise.

mechjeb.LandingTime()

Returns: Time in seconds until landing; 0 if the prediction computer is off or the orbit does not land.

When the prediction computer is engaged, returns the predicted time until landing.

mechjeb.ToggleLandingAutopilot()

Returns: 1 if the autopilot was switched on, 0 if it was switched off.

Toggles the MechJeb landing autopilot on/off.

mechjeb.ToggleLandingComputer()

Returns: 1 if the prediction computer was switched on, 0 if it was switched off.

Toggles the MechJeb landing prediction computer on/off independently of the landing autopilot.


MechJeb Landing Sites Category

The Landing Sites category provides a way to access landing sites registered with MechJeb.

The functions in this category do not require MechJeb to be fully installed - only the MechJeb LandingSites.cfg file needs to be installed. If any other config files contain MechJeb2Landing nodes, those sites will also be added to this database.

NOTE: At present, only Kerbin sites are included.

mechjeb.GetLandingSiteCount()

Returns: The number of known landing sites.

Returns the number of landing sites registered with MechJeb.

mechjeb.LandingSiteAltitude(double siteIndex)

  • siteIndex: A value between 0 and mechjeb.GetLandingSiteCount() - 1.

Returns: The altitude of the site, or 0 if an invalid site index was specified.

Returns the altitude of the selected landing site.

mechjeb.LandingSiteLatitude(double siteIndex)

  • siteIndex: A value between 0 and mechjeb.GetLandingSiteCount() - 1.

Returns: The latitude of the site, or 0 if an invalid site index was specified.

Returns the latitude of the selected landing site.

mechjeb.LandingSiteLongitude(double siteIndex)

  • siteIndex: A value between 0 and mechjeb.GetLandingSiteCount() - 1.

Returns: The longitude of the site, or 0 if an invalid site index was specified.

Returns the longitude of the selected landing site.

mechjeb.LandingSiteName(double siteIndex)

  • siteIndex: A value between 0 and mechjeb.GetLandingSiteCount() - 1.

Returns: The name of the site, or an empty string if an invalid site index was specified.

Returns the name of the selected landing site.


MechJeb Maneuver Planner and Node Executor Category

The Maneuver Planner and Node Executor section provides access to the MechJeb autopilot and maneuver node planner.

mechjeb.ChangeApoapsis(double newAp)

  • newAp: The new apoapsis in meters.

Returns: 1 on success, 0 on failure

Change apoapsis to the specified altitude in meters. Command is ignored if Ap < Pe or the orbit is hyperbolic and the vessel is already past the Pe.

mechjeb.ChangePeriapsis(double newPe)

  • newPe: The new periapsis in meters.

Returns: 1 on success, 0 on failure

Change Periapsis to the new altitude in meters. Command is ignored if Pe > Ap.

mechjeb.CircularizeAt(double newAlt)

  • newAlt: The altitude to circularize the orbit at, in meters.

Returns: 1 on success, 0 on failure

Circularize at the specified altitude, in meters. Command is ignored if an invalid altitude is supplied.

mechjeb.ManeuverNodeExecutorActive()

Returns: 1 if the node exeuctor is enabled; 0 otherwise.

Returns 1 if the maneuver node executor is active, 0 otherwise.

mechjeb.MatchVelocities()

Returns: 1 on success, 0 on failure

Instructs MechJeb to match velocities with the target at closest approach.

mechjeb.PlotTransfer()

Returns: 1 on success, 0 on failure

When a target is selected and the following conditions are met, this method will instruct MechJeb to plot an optimized Hohmann transfer to intercept the target.

If the target orbits a different body, an interplanetary transfer is calculated.

mechjeb.ToggleManeuverNodeExecutor()

Returns: 1 if the node exeuctor is enabled; 0 otherwise.

Enables / disables Maneuver Node Executor


MechJeb Performance Category

The Performance section provides metrics of vessel performance as computed my MechJeb.

mechjeb.DeltaV()

Returns: dV in m/s.

Returns the dV remaining for the vessel.

mechjeb.StageDeltaV()

Returns: dV in m/s.

Returns the dV remaining for the currently active stage.


MechJeb Rendezvous Autopilot Category

The Rendezvous Autopilot category contains methods to interact with the Rendezvous Autopilot.

mechjeb.RendezvousAutopilotActive()

Returns 1 if the rendezvous autopilot is engaged.

mechjeb.ToggleRendezvousAutopilot()

Returns: 1 if the autopilot was switched on, 0 if it was switched off.

Engages / disengages the MechJeb Rendezvous Autopilot


MechJeb SASS Category

MechJeb's SASS attitude control system can be queried and controlled using methods from this category.

mechjeb.GetSASSRollAngle()

Returns: The current roll angle for the SASS Force Roll control.

Reports the current SASS Force Roll angle.

mechjeb.GetSASSForceRollEnabled()

Returns: 1 if SASS Force Roll is enabled, 0 otherwise.

Reports if the SASS Force Roll control is enabled.

mechjeb.GetSASSMode()

Returns the number of the currently active SASS mode, or zero if MechJeb is unavailable.

  • OFF = 0,
  • KILLROT = 1,
  • NODE = 2,
  • SURFACE = 3,
  • PROGRADE = 4,
  • RETROGRADE = 5,
  • NORMAL_PLUS = 6,
  • NORMAL_MINUS = 7,
  • RADIAL_PLUS = 8,
  • RADIAL_MINUS = 9,
  • RELATIVE_PLUS = 10,
  • RELATIVE_MINUS = 11,
  • TARGET_PLUS = 12,
  • TARGET_MINUS = 13,
  • PARALLEL_PLUS = 14,
  • PARALLEL_MINUS = 15,
  • ADVANCED = 16,
  • AUTO = 17,
  • SURFACE_PROGRADE = 18,
  • SURFACE_RETROGRADE = 19,
  • HORIZONTAL_PLUS = 20,
  • HORIZONTAL_MINUS = 21,
  • VERTICAL_PLUS = 22,

mechjeb.GetSASSModeActive(double mode)

Returns 1 if the current SASS mode matches the listed value.

  • OFF = 0,
  • KILLROT = 1,
  • NODE = 2,
  • SURFACE = 3,
  • PROGRADE = 4,
  • RETROGRADE = 5,
  • NORMAL_PLUS = 6,
  • NORMAL_MINUS = 7,
  • RADIAL_PLUS = 8,
  • RADIAL_MINUS = 9,
  • RELATIVE_PLUS = 10,
  • RELATIVE_MINUS = 11,
  • TARGET_PLUS = 12,
  • TARGET_MINUS = 13,
  • PARALLEL_PLUS = 14,
  • PARALLEL_MINUS = 15,
  • ADVANCED = 16,
  • AUTO = 17,
  • SURFACE_PROGRADE = 18,
  • SURFACE_RETROGRADE = 19,
  • HORIZONTAL_PLUS = 20,
  • HORIZONTAL_MINUS = 21,
  • VERTICAL_PLUS = 22,

mechjeb.SetSASSForceRoll(bool enabled)

  • enabled: If true, Force Roll is enabled; if false, it is disabled.

Returns: 1 if Force Roll is now enabled, 0 if it is disabled or MechJeb is unavailable.

Enable or disable the SASS Force Roll control.

mechjeb.SASSOff()

Returns true if SASS is off

mechjeb.SetSASSMode(double mode)

  • mode: The mode from the table.

Returns: The selected mode, or 0 if MechJeb is unavailable.

Set the SASS pilot to the specified mode. Some modes may not be 'settable', such as AUTO or ADVANCED.

  • OFF = 0,
  • KILLROT = 1,
  • NODE = 2,
  • SURFACE = 3,
  • PROGRADE = 4,
  • RETROGRADE = 5,
  • NORMAL_PLUS = 6,
  • NORMAL_MINUS = 7,
  • RADIAL_PLUS = 8,
  • RADIAL_MINUS = 9,
  • RELATIVE_PLUS = 10,
  • RELATIVE_MINUS = 11,
  • TARGET_PLUS = 12,
  • TARGET_MINUS = 13,
  • PARALLEL_PLUS = 14,
  • PARALLEL_MINUS = 15,
  • ADVANCED = 16,
  • AUTO = 17,
  • SURFACE_PROGRADE = 18,
  • SURFACE_RETROGRADE = 19,
  • HORIZONTAL_PLUS = 20,
  • HORIZONTAL_MINUS = 21,
  • VERTICAL_PLUS = 22,

mechjeb.SetSASSRollAngle(double angle)

  • angle: The desired angle for SASS Force Roll.

Returns: 1 if the angle was set, 0 if it was not, or if MechJeb is not installed.

Set the SASS Force Roll angle to the value specified. This number is normalized to the range [-180, +180].

Note that this function does not automatically enable Force Roll, unlike the RasterPropMonitor equivalent controls.

mechjeb.ToggleSASSForceRoll()

Returns: 1 if Force Roll is now enabled, 0 if it is disabled or MechJeb is not installed.

Toggles the SASS Force Roll controls (enable / disable).


This documentation was automatically generated from source code at 20:39 UTC on 16/Aug/2020.