MechJeb#
Provides functionality to interact with the MechJeb mod’s dev builds. Tested with MechJeb dev-2.16.0.0-2120 and kRPC 0.8.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.
Note
This is a best-effort replacement of kRPC’s MechJeb service, from krpc-mechjeb-dev. Report problems there.
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 krpc
from krpc.ksp.spacecenter import SpaceCenterConnection
from krpc.services.krpc import KRPCConnection
from krpc_mechjeb_dev import MechJebConnection
class Connection(KRPCConnection, SpaceCenterConnection, MechJebConnection):
"""A connection with the MechJeb module of krpc-mechjeb-dev."""
conn = krpc.connect[Connection](name="MechJeb Example")
vessel = conn.space_center.active_vessel
ascent = conn.mech_jeb.ascent_guidance
ascent.desired_orbit_altitude = 100000
ascent.desired_inclination = 6
ascent.settings.autostage = True
ascent.enabled = True
vessel.control.activate_next_stage()
event = conn.add_event(lambda: not ascent.enabled)
with event.condition:
event.wait()
print("Launch complete")