Files
kttd/console.py

44 lines
1.3 KiB
Python

from time import sleep
from simple_pid import PID
import numpy as np
import krpc
from maneuvers.utils import get_required_rcs_thrust
conn = krpc.connect()
sc = conn.space_center
vessel = sc.active_vessel
target = sc.target_vessel
target.velocity(vessel.reference_frame)
conn.drawing.add_direction(target.velocity(vessel.reference_frame), vessel.reference_frame)
get_required_rcs_thrust(vessel, target.velocity(vessel.reference_frame))
from maneuvers.utils import magnitude
kill_relative_velocity_rcs(vessel, target)
mj = conn.mech_jeb
sa = mj.smart_ass
reference_frame = sc.ReferenceFrame.create_relative(target.reference_frame, rotation=(1., 0., 0., 0.))
conn.drawing.add_direction((0, 1, 0), reference_frame)
from time import sleep
import krpc
from maneuvers.utils import magnitude
conn = krpc.connect()
sc = conn.space_center
vessel = sc.active_vessel
target = sc.target_vessel
mj = conn.mech_jeb
sa = mj.smart_ass
sa.autopilot_mode = conn.mech_jeb.SmartASSAutopilotMode.target_plus
sa.update(False)
sa.autopilot_mode = conn.mech_jeb.SmartASSAutopilotMode.target_minus
sa.update(False)
while True:
print(magnitude(vessel.angular_velocity(target.reference_frame)))
sleep(.1)
from mission_control import ShuttleKerbin
s = ShuttleKerbin("KKS Gagarin")
s.recover_probe()