/** * MechJeb Maneuver Program * * Task-oriented interface for maneuver planning via kOS.MechJeb2.Addon */ import type { KosConnection } from '../../transport/kos-connection.js'; import { type ManeuverResult } from './shared.js'; export type { ManeuverResult } from './shared.js'; /** * Result from setTarget operation with confirmation details. */ export interface SetTargetResult { success: boolean; /** Confirmed target name from kOS (may differ from requested name) */ name?: string; /** Target type: "Body" or "Vessel" */ type?: string; /** Error message if success is false */ error?: string; } /** * Detailed information about the current target. */ export interface GetTargetInfo { hasTarget: boolean; name?: string; type?: string; /** Distance to target in meters */ distance?: number; /** Full formatted details string */ details?: string; } /** * Result from clearTarget operation. */ export interface ClearTargetResult { /** Whether the command was sent successfully */ success: boolean; /** Whether HASTARGET reports false after the command */ cleared: boolean; /** Warning message if target may not have been cleared */ warning?: string; } /** * Maneuver Program - controls MechJeb maneuver planner * * Uses kOS.MechJeb2.Addon's MANEUVERPLANNER suffixes: * ADDONS:MJ:MANEUVERPLANNER:CHANGEPE(altitude, timeRef) * ADDONS:MJ:MANEUVERPLANNER:CHANGEAP(altitude, timeRef) * ADDONS:MJ:MANEUVERPLANNER:CIRCULARIZE(timeRef) */ export declare class ManeuverProgram { private conn; constructor(conn: KosConnection); /** * Adjust periapsis by creating a maneuver node. * * NOTE: Cannot raise periapsis above current apoapsis (orbital mechanics). * MechJeb will clamp and return tiny dV if you try. * * @param altitude Target periapsis altitude in meters * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW', 'ALTITUDE' */ adjustPeriapsis(altitude: number, timeRef?: string): Promise; /** * Adjust apoapsis by creating a maneuver node. * * @param altitude Target apoapsis altitude in meters * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW', 'ALTITUDE' */ adjustApoapsis(altitude: number, timeRef?: string): Promise; /** * Circularize orbit at a specific point. * * @param timeRef When to circularize: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW', 'ALTITUDE' */ circularize(timeRef?: string): Promise; /** * Set the navigation target (celestial body or vessel). * * Uses an atomic kOS command with built-in confirmation polling: * - Sets the target * - Waits up to 10s for HASTARGET to become true * - Returns confirmed target name and type from kOS * * @param name Target name (e.g., "Mun", "Minmus", or vessel name) * @param type 'auto' tries body first then vessel, 'body' for celestial bodies, 'vessel' for ships */ setTarget(name: string, type?: 'auto' | 'body' | 'vessel'): Promise; /** * Internal implementation of setTarget with quick confirmation. */ private setTargetInternal; /** * Clear the current navigation target (if any) * * WARNING: There is a known kOS bug where `SET TARGET TO ""` does not * always clear the target on the first attempt. See docs/kos-clear-target.md. * This method brings KSP to foreground first (target switching is locked when backgrounded), * then tries five times with delays to work around the intermittent bug. */ clearTarget(): Promise; /** * Check if a navigation target is currently set */ hasTarget(): Promise; /** * Debug helper to get target state with full details * Optimized: single atomic query */ getTargetDebugInfo(): Promise<{ hasTarget: boolean; rawOutput: string; targetName?: string; }>; /** * Get the current target name */ getTarget(): Promise; /** * Get detailed information about the current target. * * Returns target name, type, distance, and type-specific details: * - Bodies: radius, orbital altitude * - Vessels: relative velocity */ getTargetInfo(): Promise; /** * Sanitize kOS output for error messages. * Removes command echoes, control characters, and extracts meaningful failure reasons. */ private sanitizeError; /** * Plan a Hohmann transfer to the current target. * * Requires a target to be set (use setTarget first). * Creates 1-2 maneuver nodes depending on capture setting. * * @param timeRef When to execute: 'COMPUTED' (optimal), 'PERIAPSIS', 'APOAPSIS' * @param capture If true, includes capture burn (2 nodes). If false, transfer only (1 node) */ hohmannTransfer(timeRef?: string, capture?: boolean): Promise; /** * Fine-tune closest approach to target. * * Optimizes periapsis for body targets or closest approach for vessel targets. * Timing is calculated automatically by MechJeb (no timeRef parameter). * * @param finalPeA Target periapsis (bodies) or closest approach (vessels) in meters */ courseCorrection(finalPeA: number): Promise; /** * Change orbital inclination. * * Creates a maneuver node to change the orbital inclination to a new value. * Most efficient at equatorial crossings (ascending/descending nodes). * * @param newInclination Target inclination in degrees * @param timeRef When to execute: 'EQ_ASCENDING', 'EQ_DESCENDING', 'EQ_NEAREST_AD', 'EQ_HIGHEST_AD', 'X_FROM_NOW' */ changeInclination(newInclination: number, timeRef?: string): Promise; /** * Ellipticize orbit to specified periapsis and apoapsis. * * Creates a maneuver node to change orbit shape while keeping it elliptical. * * @param peA Target periapsis altitude in meters * @param apA Target apoapsis altitude in meters * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW', 'ALTITUDE' */ ellipticize(peA: number, apA: number, timeRef?: string): Promise; /** * Change longitude of ascending node (LAN). * * Creates a maneuver node to change where the orbit crosses the equatorial plane. * * @param newLAN Target LAN in degrees (0-360) * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW' */ changeLAN(newLAN: number, timeRef?: string): Promise; /** * Change longitude of periapsis. * * Creates a maneuver node to rotate the orbit in its plane. * * @param newLong Target longitude of periapsis in degrees (0-360) * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW' */ changeLongitude(newLong: number, timeRef?: string): Promise; /** * Create a resonant orbit for satellite constellation deployment. * * Creates a maneuver node to put the vessel in an orbit that returns * to the same position after a specific number of orbital periods. * * @param numerator Numerator of the resonance ratio * @param denominator Denominator of the resonance ratio * @param timeRef When to execute: 'APOAPSIS', 'PERIAPSIS', 'X_FROM_NOW' */ resonantOrbit(numerator: number, denominator: number, timeRef?: string): Promise; /** * Kill relative velocity with target. * * Creates a maneuver node to match velocity with the current target. * Useful for rendezvous operations. * * @param timeRef When to execute: 'CLOSEST_APPROACH', 'X_FROM_NOW', etc. */ killRelVel(timeRef?: string): Promise; /** * Query a numeric value from MechJeb (e.g., "23.80 m/s") */ private queryNumber; /** * Query a time value from MechJeb (e.g., "31m 10s") */ private queryTime; } //# sourceMappingURL=maneuver.d.ts.map