Auto-Pilot#

Vehicle.AutoPilot is the game’s flight computer, which steers the vehicle to a target attitude with its reaction wheels, engines and RCS. This script points the active vehicle 30 degrees above the eastern horizon, then prograde:

auto_pilot = vehicle.auto_pilot
auto_pilot.target_pitch_and_heading(30, 90)
auto_pilot.engage()
auto_pilot.wait()
print(f"Pointing {auto_pilot.error:.1f} degrees from the target")
auto_pilot.mode = ksa.AutoPilotMode.prograde
auto_pilot.wait()
auto_pilot.disengage()

Targets and Modes#

Mode sets what the auto-pilot points the vehicle at:

  • Attitude points it at TargetPitch, TargetHeading and TargetRoll. Setting any of these, TargetPitchAndHeading or TargetDirection selects this mode. A target roll of NaN leaves the roll free.

  • Hold holds the vehicle’s rotation relative to the stars.

  • The other modes track a direction: orbital or surface prograde and retrograde, normal and anti-normal, and radial in and out. They follow the direction as it changes.

Error and RollError give how far the vehicle is from the target, in degrees. Wait returns once they are within twice the flight computer’s deadband.

TargetDirection converts a direction in any frame to a pitch and heading when it is called, so the target stays fixed relative to the surface. See Reference Frames.

Executing Burns#

AutoBurn has the flight computer execute the next planned burn: it points the vehicle along the burn, fires the engines at the ignition time, and stops when the burn is complete or the engines run out of propellant. Executing a Burn walks through it.

Manual Rotation#

KSA’s pitch, yaw and roll inputs are on and off flags, which the game clears unless the player is flying the vehicle. A script steers with the auto-pilot instead.