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:
import { connect } from "@krpc-org/krpc";
const conn = await connect({ name: "MechJeb Example" });
const vessel = await conn.spaceCenter.getActiveVessel();
const ascent = await conn.mechJeb.getAscentGuidance();
await ascent.setDesiredOrbitAltitude(100000);
await ascent.setDesiredInclination(6);
await (await ascent.getSettings()).setAutostage(true);
await ascent.setEnabled(true);
await (await vessel.getControl()).activateNextStage();
const event = await conn.addEvent(({ ascent }) => !ascent.enabled, {
ascent,
});
await event.wait();
console.log("Launch complete");
await conn.close();