
legend (, "best", bbox_to_anchor = ( 1.0, 1.0 ), prop = fontP, frameon = False ) # Small font, best location plt. text ( max ( t ) * 0.9, 1.2, 'Goal g-force', fontsize = 8 ) plt.

axhline ( y = 1, linewidth = 1, alpha = 0.5, color = 'r', linestyle = '-', label = 'goal' ) plt. ylabel ( 'Throttle %' ) # Bottom subplot, gforce plt. legend (, "best", prop = fontP, frameon = False ) # Small font, best location plt. plot ( t, throttle, t, dthrottle_p, t, dthrottle_d ) plt. legend (, "best", prop = fontP, frameon = False ) # Middle subplot, throttle & dthrottle plt. title ( 'Craft Altitude over Time' ) plt. text ( max ( t ) * 0.9, 105, 'Goal Altitude', fontsize = 8 ) plt. axhline ( y = 100, linewidth = 1, alpha = 0.5, color = 'r', linestyle = '-', label = 'goal' ) plt. Boosters are optional and TWR should be between 1.4. plot ( t, altitude, t, verticalspeed, t, acceleration ) plt. kOS Scripts Name, Description Ascent Code, Basic launch algorithm for launching rockets to a 250km orbit. set_size ( 'small' ) def loadData ( filename ): return genfromtxt ( filename, delimiter = ' ' ) def plotData ( data ): rcParams = 10, 6 # Set figure size to 10" wide x 6" tall t = data altitude = data verticalspeed = data acceleration = data # magnitude of acceleration gforce = data throttle = data * 100 dthrottle_p = data * 100 dthrottle_d = data * 100 # Top subplot, position and velocity up to threshold plt. Import matplotlib.pyplot as plt import numpy as np from numpy import genfromtxt from matplotlib.font_manager import FontProperties from pylab import rcParams fontP = FontProperties () fontP. Setup & Helper functions ¶įirst let's set up some helper functions for loading data and plotting. This has the effect of trying to move gforce to 1.0, matching the gravitational force.


#Kerbal space program kos how to#
There you will find details about commands and how to use them. Where thrott is the throttle percentage from 0 to 1 or no thrust to full thrust. Once you know how kOS generally works the wiki is really the most important site.
#Kerbal space program kos update#
As a first step for hovering, we'll have our controller change in velocity by limiting our g force to 0 via $gforce$ is our onboard gravitational acceleration magnitude using our graviola detector.Īnd in the running controller loop, we update $thrott = thrott + \Delta thrott$ SET thrott to thrott + dthrott. Towards this, we're going to implement, you guessed it, a PID controller. Our intrepid little spaceship consists of a single engine, some landing legs and a parachute in case (when) our controller goes haywire. So we're going to try and write a kOS script for Kerbal Space Program (KSP) to control a single-stage rocket engine to hover at a set altitude. Kerbal Space Program kOS Hover PID planner ¶
