MechJeb#

Provides functionality to interact with the MechJeb mod. Tested with MechJeb 2.15.4.0. Originally written by Genhis. The service acts on the MechJeb of the active vessel, which needs a part with MechJeb. Its classes follow MechJeb’s windows: a setting is found under the window that shows it.

Example#

The following example launches the active vessel into a 100 km orbit, inclined at 6 degrees, with Ascent Guidance, and waits for the ascent to finish:

using System;
using KRPC.Client;
using KRPC.Client.Services.MechJeb;
using KRPC.Client.Services.SpaceCenter;

class MechJebExample
{
    public static void Main ()
    {
        using (var connection = new Connection (name: "MechJeb Example")) {
            var vessel = connection.SpaceCenter ().ActiveVessel;
            var ascent = connection.MechJeb ().AscentGuidance;

            ascent.DesiredOrbitAltitude = 100000;
            ascent.DesiredInclination = 6;
            ascent.Settings.Autostage = true;
            ascent.Enabled = true;

            vessel.Control.ActivateNextStage ();

            var evnt = connection.AddEvent (() => !ascent.Enabled);
            lock (evnt.Condition) {
                evnt.Wait ();
            }

            Console.WriteLine ("Launch complete");
        }
    }
}