Jump to content

The kos project


Recommended Posts

Hello everybody !

I start this thread to post my start with the use of K-OS, i'm a total newby to that mod and i will try to explain every step of my experence.

I will run the last update of K-OS 0.12.

You can find the mod here, on curse

Some site to see the commands and examples on the github,the wiki where you can find some help for the XYZ syst in ksp , the reddit , even if a little dead the kosstore.

I've seen some very nice script on kOS The Automated Mission Challenge.

I want to code a autopilot that bring a shuttle to the orbit choosen under FAR( did someone manage to get data from FAR ??) .

I will start to make just a screen that pop bunch of data to see how Kos works.inspire by this thread.

This is the flight plan that i want to code:


// I stage (0m,0m/s,0.0.0) up
// 1 roll program (0-500m,?m/s,-up+r(0.0.270) )
// 2 (500m-5km ?m/s,up+r(0.350.270) ) reduce trottle at max Q
// 3 (5k-10k ?m/s,up+r(0.315.270) )
// II stage (15k,800m/s,up +r(0.290.270) - 50k ?m/s,up+r(0.270.270)
// 1 Raise AP (35k to 50k)
// 2 wait to ap ( the good time to fall back a little )
// 3 transfer burn
// III stage ( Pe <50k Pe = orbiteCible )
// 1 shutdown main engine & get away from the FT
//ag 1 ou 2 ??
// 2 Circularitation burn
// IV Stage Bilan(log avec resultat et correction possible)
//end program

I will post all the script here !

let's code :)

To get your script running to must type :

switch to archive.
list.
run main.

in my case the main is located in ( i'm playing on a mac) : /Users/Nico/Library/Application\ Support/Steam/SteamApps/common/Kerbal\ Space\ Program/Plugins/PluginData/Archive

You can also say

copy main from archive.
edit main. // to edit the code ( don't work with Kos v0.12)
run main.

i've got problem to edit the files from the game don't know why but i just got the g force on the craft ^^

print ship:sensors:grav:mag.// wil get you the value of g
print ship:sensors:grav. // a vector v(x,y,z)

work of the day just modification on a example that you can find here :

set gear to false.
set sas to false.
set rcs to false.
lock grav to ship:sensors:grav:mag.
lock gforce to grav/ship:sensors:acc:mag.

print "g force is "+ gforce.
if maxthrust = 0 {stage.}.
lock TWR to (maxthrust/mass*grav).
print "twr is"+ TWR.
set ground to alt:radar.
print alt:radar.
lock steering to up.
lock throttle to 1.
print "launching.".
wait until alt:radar > 10.
lock steering to up + R(0,0,90).
print "roll program.".
print alt:radar.
wait until alt:radar > 100.
print "slowing down.".
print alt:radar.
lock throttle to 0.
wait until verticalspeed < 0.1.
print "hovering.".
print alt:radar.
lock throttle to mass*grav*(1-verticalspeed*0.2)/maxthrust.
wait 5.
print "landing.".
set decent to true.
lock throttle to (mass*grav*(1-(verticalspeed+( alt:radar-ground-0.5)/4)*0.2)/maxthrust).
if verticalspeed < 1 and decent {gear on.}.
wait until alt:radar < ground+2.
lock throttle to 0.
print "landed.".

Edited by Cakeofruit
Link to comment
Share on other sites

I have always wanted to try KOS. I will keep an eye on this thread to see what I can see :)

I have gotten my feet wet writing PID control algorithms recently, and really was wondering how in-depth the KOS language goes... I wonder if I could write my own control code, that'd certainly be neat! (instead of just using built in stuff, which is what I had always assumed it had... like built in functions)

Link to comment
Share on other sites

News of the week end:

After reading all the KOS release thread i get some tips

It better to use only one lock with a variable that you set when you wanna change the value

like this:

set x to 0.
lock gHere to ship:sensors:grav:mag.
Lock throttle to x.
set x to (mass*ghere)/maxthrust.

Get value from the structure !! :

clearscreen.

list engines in motori.

for m in motori
{
print "Engine: " + m.
print "Max Thrust: " + m:maxthrust.
print "Thrust: " + m:thrust.
print "Thrust Limit: " + m:thrustlimit.
print " ".
}.

this code is from Brusura thx a lot

I'm currently doing a info display for kos to try to learn how it's working

The next phase will be to make a manuvernode system for the ascent to see if my math work and then make the autopilot .

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...