Files
krpc-auto-landing/测试文件/参考系可视化.py
2026-01-30 18:50:52 +08:00

26 lines
738 B
Python

import time
import krpc
conn = krpc.connect(name='Orbital speed')
if not conn.space_center:
print("No active vessel found.")
exit()
vessel = conn.space_center.active_vessel
hybrid_ref = conn.space_center.ReferenceFrame.create_hybrid(
position=vessel.orbit.body.reference_frame,
rotation=vessel.surface_reference_frame
) # type: ignore
# 参考系为 (上, 北, 东)
flight_surface = vessel.flight(hybrid_ref)
drawing = conn.drawing
if not drawing:
print("Drawing service not available.")
exit()
drawing.add_direction_from_com((1, 0, 0), hybrid_ref, length=15)
drawing.add_direction_from_com((0, 1, 0), hybrid_ref, length=30)
drawing.add_direction_from_com((0, 0, 1), hybrid_ref, length=45)
while True:
pass