Skip to content

Instantly share code, notes, and snippets.

@alterbaron
alterbaron / gist:6407325
Created Sep 1, 2013
KSP 2D Ascent Trajectory Optimization with PSOPT
View gist:6407325
// KSP 2D Ascent Trajectory Optimization Problem
#include "psopt.h"
//////////////////////////////////////////////////////////////////////////
/////////////////// Define the end point (Mayer) cost function //////////
//////////////////////////////////////////////////////////////////////////
adouble endpoint_cost(adouble* initial_states, adouble* final_states,
adouble* parameters,adouble& t0, adouble& tf,
adouble* xad, int iphase)
@alterbaron
alterbaron / landingcalc.m
Created May 24, 2013
Useful calculation routines and landing phase angle calculator for Kerbal Space Program
View landingcalc.m
function [phi_out] = landingcalc( orbit_alt, landing_pe )
% Returns the landing phase angle, where the ship starts in a circular
% orbit and drops its PE down to landing_pe.
% Set to true to log a bunch of details.
details = false;
% Kerbin planetary data from Wiki
dt = 1;
m = 1.0;