Jump to content

kOS automated launch


xrayfishx

Recommended Posts

For quite some time now I've been trying to create a kOS script that would automatically launch my spacecraft. I'm having a couple of issues here that I need help with:

1) With Realism Overhaul most engines have a ridiculous amount of thrust vectoring capability compared to stock engines. It seems that kOS is completely incapable of only steering a little, it just seems to push the stick all the way towards what it's supposed to be pointing at which doesn't work too well when I'm using an engine that turns 8 degrees in any direction. I could be wrong about kOS's inner workings here, but the fact is, my rocket is spinning and not really pointing in any certain direction. Is there a way to keep it going in the right direction?

2) Speaking of going in the right direction, the direction system is not very intuitive. It even says so in the wiki. So can anyone explain to me how it works, because the wiki couldn't make it very clear to me.

3) I'm often getting random syntax errors even when I'm absolutely sure there's nothing wrong. For example, in my script there was the following line:

set tVal to 1.

Apparently something's wrong with it. Even when I copy-pasted another exactly the same line (except working) over it to clear out any possible spelling errors, there didn't seem to be any and either way it still didn't work. Could the problem be some other line interacting with it somehow?


set tVal to 1.

//Launch prep
lock throttle to tVal.
lock steering to up + R(0,0,180).

//Launch
stage.

//Pitch Program
wait until altitude > 300.
lock steering to up + R(5,0,180).
wait until altitude > 3000.
lock steering to up + R(10,0,180).

wait until altitude > 5000.
lock steering to up + R(15,0,180).

wait until altitude > 7000.
lock steering to up + R(20,0,180).

wait until altitude > 10000.
lock steering to up + R(25,0,180).

wait until altitude > 15000.
lock steering to up + R(30,0,180).

wait until altitude > 20000.
lock steering to up + R(35,0,180).

wait until altitude > 25000.
lock steering to up + R(40,0,180).

wait until altitude > 30000.
lock steering to up + R(45,0,180).

wait until altitude > 35000.
lock steering to up + R(50,0,180).

wait until altitude > 40000.
lock steering to up + R(55,0,180).

wait until altitude > 45000.
lock steering to up + R(60,0,180).

wait until altitude > 55000.
lock steering to up + R(65,0,180).

wait until altitude > 70000.
lock steering to up + R(70,0,180).

wait until altitude > 95000.
lock steering to up + R(75,0,180).

wait until altitude > 170000.
lock steering to up + R(80,0,180).

wait until altitude > 200000.
lock steering to up + R(85,0,180).

wait until altitude > 210000.
lock steering to up + R(90,0,180).

set tVal to 0.

wait until eta:apoapsis < 60
set tVal to 1.
wait until periapsis > 250000
set tVal to 0.
unlock throttle.
//Throttle Control

Edited by xrayfishx
Link to comment
Share on other sites

First off, I very much like "lock steering to heading()" as the more convenient approach.


these two are the same:
lock steering to heading(90,90).
lock steering to up + R(90,0,0).

These, too:
lock steering to heading(90,50).
lock steering to up + R(90,40,0).


//Whether you use heading or up+R, you don't have to put in fixed numbers:
set direction to 90.
lock pitch to 90 - (altitude/1000). //not very good, just an example. mind the LOCK.
lock steering to heading(direction,pitch).
//or
lock steering to up+R(direction,-pitch,0).

As to kOS controls making a mess of things, I'm sad to say that this is quite common. Having an excessive amount of reaction wheels helps most of the time, but sometimes... well, I have no idea what's going on.

Edited by Laie
Link to comment
Share on other sites

First off, I very much like "lock steering to heading()" as the more convenient approach.


these two are the same:
lock steering to heading(90,90).
lock steering to up + R(90,0,0).

These, too:
lock steering to heading(90,50).
lock steering to up + R(90,40,0).


//Whether you use heading or up+R, you don't have to put in fixed numbers:
set direction to 90.
lock pitch to 90 - (altitude/1000). //not very good, just an example. mind the LOCK.
lock steering to heading(direction,pitch).
//or
lock steering to up+R(direction,-pitch,0).

As to kOS controls making a mess of things, I'm sad to say that this is quite common. Having an excessive amount of reaction wheels helps most of the time, but sometimes... well, I have no idea what's going on.

Is there a way to make kOS set a target in a certain direction and then make MJ or RT2 autopilot aim for it? As I said in OP I use RO so reaction wheels aren't really an option.

Link to comment
Share on other sites

Is there a way to make kOS set a target in a certain direction and then make MJ or RT2 autopilot aim for it? As I said in OP I use RO so reaction wheels aren't really an option.

If you want more realism you probably need to be *really* realistic and use raw steering using SHIP:CONTROL and make the steering correction code yourself, instead of relying on LOCK STEERING which is a bit of an unrealistic crutch to help new users along.

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...