Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

So I got the four necessary mods, downloaded the .craft. All installed fine but when I opened it in the SPH the legs were missing. The knee and ankle joints were there but nothing in between. Could someone give me a mirror download or some advice (I.e should I use earlier versions of IR or tweakscale, etc)

Thanks in advance for your time,

Eerf

I think your message may have gotten off the bus a couple of stops early. It's impossible to say what the problem might be without knowing the craft you are trying to use.

If the parts were actually missing, the craft wouldn't load. So it's a bit confusing how you can open it and some parts don't appear.

Give us a few more hints and we can definitely help.

Link to comment
Share on other sites

Hello all,

I am a moderator on the /r/kOS subreddit. I have been spending the last couple weeks working out the kinks in this challenge to post on the subreddit. To get more exposure I wanted to post it on here so that others might find interest in it! I have also posted this on the Challenges section of the KSP Forum so you might have already seen this.

The challenge will require you to code an autopilot script and design a ship to fly to Mun and Land with 3 different difficulty of objectives.

Here is the link to the Google Doc with the description on it. Its quite lengthy but I believe it covers much of any issues that might arise with this competition.

If you have any issues/questions/comments please let me know!

Deadline for submissions is April 4th at 11:59pm (UTC -6).

Good luck! :D

Edited by TheGreatFez
Link to comment
Share on other sites

Why this code not work?

First stage fires immediately after "10".

After "1" fires second stage

and then everything goes right.


when stage:liquidfuel < 0.001 then {
stage.
preserve.
}

clearscreen.

set countdown to 10.
until countdown = 0 {
print countdown.
set countdown to countdown - 1.
wait 1.
}

lock throttle to 1.0.
lock steering to heading(0,90).
stage.

wait until altitude > 1000.
lock steering to heading(0,90) + r(0,-20,0).

wait until altitude > 10000.
lock steering to heading(0,90) + r(0,-45,0).

wait until altitude > 40000.
lock steering to heading(0,90) + r(0,-90,0).

wait until apoapsis > 100000.
lock throttle to 0.0.
lock steering to prograde.

set warp to 4.

wait until eta:apoapsis < 25.
set warp to 0.

wait until eta:apoapsis < 15.
lock throttle to 1.0.

wait until periapsis > 99000.
lock throttle to 0.0.

Edited by Wuwuk
Link to comment
Share on other sites

Why this code not work?

First stage fires immediately after "10".

stage:liquidfuel is always zero when you first start because the current stage is the pre-launch stage with no active engines yet - you haven't hit stage so you haven't enabled your first engine. Therefore your WHEN condition is already true immediately.

Link to comment
Share on other sites

stage:liquidfuel is always zero when you first start because the current stage is the pre-launch stage with no active engines yet - you haven't hit stage so you haven't enabled your first engine. Therefore your WHEN condition is already true immediately.

How to fix it?

- - - Updated - - -

This code from official tutorial,

does not work:


LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
LOCK THROTTLE TO 1.
STAGE.
WHEN SHIP:ALTITUDE > 10000 THEN {
LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
}
UNTIL SHIP:ALTITUDE > 20000 {
IF STAGE:LIQUIDFUEL < 0.1 {
STAGE.
}
}
LOCK THROTTLE TO 0.
WAIT UNTIL FALSE.

I can not create working loop stage logic.

Help me with working exsample.

Edited by Wuwuk
Link to comment
Share on other sites

How to fix it?

Stick the when condition after the countdown loop.

This code from official tutorial,

does not work:

Works for me, what’s it doing for you?

It will only work with linear rockets (engines set to fire one after the other). So wont work with boosters or asparagus staging as there is still liquid fuel in the stage.

Link to comment
Share on other sites

I can not create working loop stage logic.

Help me with working exsample.

Here's one possible staging script:




set stagemaxthrust to ship:maxthrust.
when status <> "PRELAUNCH" and (ship:maxthrust<stagemaxthrust or ship:maxthrust<1) then {
print "Stage!".
stage.
set stagemaxthrust to ship:maxthrust.
preserve.
}

Link to comment
Share on other sites

Works for me, what’s it doing for you?

It will only work with linear rockets (engines set to fire one after the other). So wont work with boosters or asparagus staging as there is still liquid fuel in the stage.

This code doing for me this:

dont staging after successful launch,

i don't know why.

My rocket is linear and only liquid fuel on it.

Link to comment
Share on other sites

Here's one possible staging script:




set stagemaxthrust to ship:maxthrust.
when status <> "PRELAUNCH" and (ship:maxthrust<stagemaxthrust or ship:maxthrust<1) then {
print "Stage!".
stage.
set stagemaxthrust to ship:maxthrust.
preserve.
}

Thanks, this code works.

Where did you get - status <> "PRELAUNCH"?

On the official site I have not found "PRELAUNCH".

But i don't know why

"UNTIL" loops like this:


UNTIL SHIP:ALTITUDE > 10000 {
IF STAGE:LIQUIDFUEL < 0.1 {
STAGE.
}
}

Don't work for me.

KSP 0.90 and kOS 0.16.2.

- - - Updated - - -

Why this code work:


WHEN STATUS <> "PRELAUNCH" AND SHIP:MAXTHRUST < 1 THEN {
STAGE.
PRINT "Stage".
}

but this code is not:


WHEN STATUS <> "PRELAUNCH" AND STAGE:LIQUIDFUEL < 0.01 THEN {
STAGE.
PRINT "Stage".
}

Edited by Wuwuk
Link to comment
Share on other sites

but this code is not:


WHEN STATUS <> "PRELAUNCH" AND STAGE:LIQUIDFUEL < 0.01 THEN {
STAGE.
PRINT "Stage".

I'm having trouble reproducing your error, even when copy and pasting from your posts. Any chance of the full script and craft files so I can try running it exactly as you have it?

Link to comment
Share on other sites

Here is the code im running:

DECLARE RANGE1.

DECLARE RANGE2.
DECLARE DELAY1.
DECLARE DELAY2.

SET LEFT1 TO SHIP:PARTSTAGGED("LEFT1")[0].
SET LEFT2 TO SHIP:PARTSTAGGED("LEFT2")[0].
SET LEFT3 TO SHIP:PARTSTAGGED("LEFT3")[0].
SET LEFTSTR1 TO SHIP:PARTSTAGGED("LEFTSTR1")[0].
SET LEFTSTR2 TO SHIP:PARTSTAGGED("LEFTSTR2")[0].

SET RIGHT1 TO SHIP:PARTSTAGGED("RIGHT1")[0].
SET RIGHT2 TO SHIP:PARTSTAGGED("RIGHT2")[0].
SET RIGHT3 TO SHIP:PARTSTAGGED("RIGHT3")[0].
SET RIGHTSTR1 TO SHIP:PARTSTAGGED("RIGHTSTR1")[0].
SET RIGHTSTR2 TO SHIP:PARTSTAGGED("RIGHTSTR2")[0].

UNTIL SHIP:ALTITUDE > 20000

{

IF GEAR = 1
UNTIL GEAR = 0

{

SET RANGE1 TO 20*SHIP:CONTROL:PILOTMAINTHROTTLE.
SET RANGE2 TO -20*SHIP:CONTROL:PILOTMAINTHROTTLE.
SET DELAY1 TO .35 - 0.045*SHIP:CONTROL:PILOTMAINTHROTTLE.
SET DELAY2 TO .15 - 0.125*SHIP:CONTROL:PILOTMAINTHROTTLE.


LEFTSTR1:GETMODULE("MUMECHTOGGLE"):SETFIELD("MIN ROTATE", RANGE2).
LEFTSTR1:GETMODULE("MUMECHTOGGLE"):SETFIELD("MAX ROTATE", RANGE1).

LEFTSTR2:GETMODULE("MUMECHTOGGLE"):SETFIELD("MIN ROTATE", RANGE2).
LEFTSTR2:GETMODULE("MUMECHTOGGLE"):SETFIELD("MAX ROTATE", RANGE1).

RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):SETFIELD("MIN ROTATE", RANGE2).
RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):SETFIELD("MAX ROTATE", RANGE1).

RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):SETFIELD("MIN ROTATE", RANGE2).
RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):SETFIELD("MAX ROTATE", RANGE1).

///////////////////////////////////////

LEFT1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
LEFT2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
LEFT3:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).

RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 1).
RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 1).
LEFTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
LEFTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).

WAIT DELAY1.

LEFT1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
LEFT2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
LEFT3:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).

WAIT DELAY2.

RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 0).
RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 0).
LEFTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
LEFTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).

RIGHT1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
RIGHT2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
RIGHT3:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).

LEFTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 1).
LEFTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 1).
RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).
RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 1).

WAIT DELAY1.

RIGHT1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
RIGHT2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
RIGHT3:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).

WAIT DELAY2.

LEFTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 0).
LEFTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE +", 0).
RIGHTSTR1:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).
RIGHTSTR2:GETMODULE("MUMECHTOGGLE"):DOACTION("MOVE -", 0).

}.
}.

craft file. you will need infernal robotics, tweakscale, kOS and mechjeb.

https://www.dropbox.com/s/31n4keupexdr22p/WALKER-1.craft?dl=0

http://i.imgur.com/jLj244b.png

-set up the servo speeds as shown

-activate smart a.s.s. to lock craft direction UP

-set attitude adjustment to "use stock sas"

-select "control from here" on the probe core as shown

-make sure gear is deactivated before running the script (look for the indicator top center of screen, it should not be highlighted)

-set throttle to 0

-activate action group 0. this will recenter the leg servos. the craft will not work without this activated. deactivate to allow craft to crouch down for pilot to enter and exit the craft.

-run script

-"g" toggles leg pumping

-throttle controls speed, at 0 the craft walks in place , 1 should be top speed (although in practice this isnt the case as i have yet to tweak the timing properly)

-"j" and "l" are for turning (adjust speed of the "COURSE" group to change turning speed)

-"i" and "k" are for pointing the toes up or down. this is for going up or down hill, as well as fine tuning speed.

-":" and " ' " will shift the weight of the craft backwards and forwards. im not sure why i put this in, but it helps a little to fine tune the balance

-"h" and "n" rotate the turret

here's another little program that i made while putting this together, this gives you some useful info for doing stuff:

SET partslist to ship:PARTSTAGGED("left1").
/// tag the part you want to test, replace "left1" with the tag.

for x in partsList {
print x:GETMODULE("mumechtoggle"):allevents.
print x:GETMODULE("mumechtoggle"):allactions.
print x:GETMODULE("mumechtoggle"):allfields.
}.

Hi Parallax :)

I really appreciate your creations, and imo your channel should be up there with the likes of Scott and Danny. I love this walker, and so came here to download it. I already had kOS, IR, mechjeb and tweakscale but when I opened the .craft in theSPH, it had no legs! The feet, ankle joints, knee joints and the hips were there but the upper and lower legs were missing. I can't put anything in between, because I have to put things between two attachment nodes, and obviously you can only directly attach a part to ONE node. May you please supply me with the version names of the four modes or any other information which could aid me in overcoming this issue. Thank you for your time in advance,

Eerf

Link to comment
Share on other sites

Thanks, this code works.

Where did you get - status <> "PRELAUNCH"?

On the official site I have not found "PRELAUNCH".

Hmm, I'll post an issue on that. There is no explanation of ship:status

Link to comment
Share on other sites

I'm having trouble reproducing your error, even when copy and pasting from your posts. Any chance of the full script and craft files so I can try running it exactly as you have it?

Ok, as soon as I get home from work,

i put full script and craft file.

Link to comment
Share on other sites

TDW

This code not work for me:

when/then loop works,

until loop does nothing.

After out of fuel in stage 1, my rocket dont stage.


LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
LOCK THROTTLE TO 1.
STAGE.
WHEN SHIP:ALTITUDE > 1000 THEN {
LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
}
UNTIL SHIP:ALTITUDE > 10000 {
IF STAGE:LIQUIDFUEL < 0.01 {
STAGE.
}
}
LOCK THROTTLE TO 0.
WAIT UNTIL FALSE.

This is my craft file:

https://drive.google.com/open?id=0B9Xq8cdv26bQRlNNZHlEeEZocDg&authuser=0

Link to comment
Share on other sites

@Wuwuk

You need to set the permissions on the file to allow sharing :wink:. Right click the file (on your google drive) and select share then advanced and change it from privet to either "anyone with the link" or "public on the web"

Link to comment
Share on other sites

@Wuwuk

You need to set the permissions on the file to allow sharing :wink:. Right click the file (on your google drive) and select share then advanced and change it from privet to either "anyone with the link" or "public on the web"

OK, i did it.

Try again.

Link to comment
Share on other sites

OK, i did it.

Try again.

Ok there are 2 things going on here.

1st there is something odd going on with the way ksp has saved stage info for the parts. You can see this if you use

list parts in foo. for part in foo {print part:name+"  "+part:stage.}.

Most of it doesn't matter too much for most of it but the 2 lower fuel tanks think they are in stage 4 and 6 respectively. This means that ksp is counting the middle tank towards the stage:liquidfuel of the stage below (can be seen in the resource panel).

Note: this is a stock bug and there is probably not a lot the kOS devs can do about it.

I have tried building an identical vessel to yours several times but cant seem to get the same stage number bug. Did you use something 'fancy' when making it (change root, copy and past parts etc.)?

The second part of this is that the (when I built the rocket from scratch to fix the staging issue) is that the engine does not use the last little bit of fuel. This is probably because there is not enough to run the engine for a full physics tick. to fix this you can either increase the threshold or use

IF stage:liquidfuel <= 0.01 { STAGE.}.

. The other option is to use another means of deciding when to stage.

A slight modification to your code


LOCK STEERING TO R(0,0,-90) + HEADING(90,90).
LOCK THROTTLE TO 1.
SET maxT to 0.
WHEN SHIP:ALTITUDE > 1000 THEN {
LOCK STEERING TO R(0,0,-90) + HEADING(90,45).
}
UNTIL SHIP:ALTITUDE > 10000 {
IF SHIP:MAXTHRUST < maxT or maxt = 0 {
STAGE.
}
SET maxT TO SHIP:MAXTHRUST.
WAIT 0.1.
}
LOCK THROTTLE TO 0.
WAIT UNTIL FALSE.

Is a far more versatile solution as it will quite happily stage solid or liquid stages, asparagus, cases where the activate engine icon is not in the same stage as the decouple icon and it shouldn't be interfered with by the stock game doing odd stuff to the stage numbering of parts. If you increase the altitude on the until loop it will also stage a Kerbal-X correctly (just need to stick a kOS core on the top and put the launch clamps in the same stage as the first set of engines).

Link to comment
Share on other sites

The second part of this is that the (when I built the rocket from scratch to fix the staging issue) is that the engine does not use the last little bit of fuel. This is probably because there is not enough to run the engine for a full physics tick.

I have found that often what can help with this problem is to check for *either* type of fuel running out.

If you have a sliver of liquidfuel left but zero oxidizer, then the last liquidfuel won't burn because there's no oxidizer to go with it. So the check should really be that you use a boolean 'or' to check check for *either one of them* being zero, not just one.

The exact amount of oxyidizer and liquidfuel is meant to be just the right amount to make them both hit zero at precisely the same instant, but I suspect that what causes the problem is a slight amount of floating point rounding error. It's a very small amount, but it accumulates over thousands upon thousands of calculations because KSP is running the calculation again and again 25 times per second.

Say, you burn 0.5 units of liquid fuel per second, which means it pairs with burning 0.61111111 (repeat forever) units of oxidizer per second. Well, that's really being calculated in 1/25 of a second timesteps so it's really 0.02 units of liquidfuel and 0.024444 (repeat forever) units of oxidizer per 1/25th of a second.

You can't *actually* represent 0.0244444 (repeat forever) as a finite binary floating point number. You can only get close with roundoff error.

So over time, the amount of oxidizer being burnt isn't *exactly* right for the amount of liquidfuel being burnt. It's as close as floating point numbers will allow, but that's not 100% precise. Given enough time, that small error accumulates into something noticable, and you end up running out of one type of fuel before the other type.

Link to comment
Share on other sites

OK.

Thanks to your advice, I have created a working script.

Reaching the orbit.

Here it is:


CLEARSCREEN.

SET countdown TO 10.
UNTIL countdown = 0 {
PRINT countdown.
SET countdown TO countdown - 1.
WAIT 1.
}

LOCK THROTTLE TO 1.0.
LOCK STEERING TO HEADING(0,90).
STAGE.

SET st TO 4.
SET st_max TO SHIP:MAXTHRUST.
WHEN STATUS <> "PRELAUNCH" AND (SHIP:MAXTHRUST < st_max OR SHIP:MAXTHRUST < 1) THEN {
PRINT "Stage".
STAGE.
SET st_max TO SHIP:MAXTHRUST.
SET st TO st - 1.
IF st > 0 {
PRESERVE.
}
}

WAIT UNTIL SHIP:ALTITUDE > 1000.
LOCK STEERING TO HEADING(0,90) + R(0,-20,0).

WAIT UNTIL SHIP:ALTITUDE > 10000.
LOCK STEERING TO HEADING(0,90) + R(0,-45,0).

WAIT UNTIL SHIP:ALTITUDE > 40000.
LOCK STEERING TO HEADING(0,90) + R(0,-90,0).

WAIT UNTIL APOAPSIS > 100000.
LOCK THROTTLE TO 0.0.
LOCK STEERING TO PROGRADE.

WAIT UNTIL ETA:APOAPSIS < 35.
SET WARP TO 0.

WAIT UNTIL ETA:APOAPSIS < 10.
LOCK THROTTLE TO 1.0.
PRINT "Burning to orbit".

WAIT UNTIL PERIAPSIS > 99000.
LOCK THROTTLE TO 0.0.
WAIT 1.
PANELS ON.

But there was another problem,

this time with the script descent from orbit.

Here it is:


lock steering to retrograde.

wait until eta:apoapsis < 35.
set warp to 0.
wait until eta:apoapsis < 10.
lock throttle to 1.0.

wait until periapsis < 30000.
lock throttle to 0.0.
stage.

wait until altitude < 4000.
stage.

Everything is going well,

until the moment when there is

engine shutdown.

Throttle gets to zero,

but the engine does not turn off.

Until it runs out of fuel,

with the engine and the throttle nothing to be done.

This is a bug?

This is my craft file:

https://drive.google.com/open?id=0B9Xq8cdv26bQdXdDdVgyNHpHY1k&authuser=0

Link to comment
Share on other sites

Everything is going well,

until the moment when there is

engine shutdown.

Throttle gets to zero,

but the engine does not turn off.

Until it runs out of fuel,

with the engine and the throttle nothing to be done.

This is a bug?

At work so can't test but is the issue is that the throttle hits 0 the jumps up to 50%? If so this is because when the program ends it sets the throttle back to whatever it was when you started the script. Since 0.24 (I think) ksp sets the throttle to 50% at lunch. You're options are to remember to manually throttle down before every launch or download the mod Default Throttle which let's you change the what throttle rockets start on the pad with.

Edited by TDW
Link to comment
Share on other sites

At work so can't test but is the issue is that the throttle hits 0 the jumps up to 50%? If so this is because when the program ends it sets the throttle back to whatever it was when you started the script. Since 0.24 (I think) ksp sets the throttle to 50% at lunch lunch. You're options are to remember to manually throttle down before every launch or download the mod Default Throttle (can't find a link atm) which let's you change the what throttle rockets start on the pad with.

Throttle gets to zero,

but engine not shut down and game

bug (does not control the throttle

and the ship, even if you abort the kOS program "Ctrl+C",

before until it ran out of fuel and will not happen the last "stage"

on the script).

As I come home from work, I'll try to take a screenshot.

Here are screenshots:

dea7d5a4a92c5ca677aa872373a886bd.jpeg 70851cf07ac7233a1397364ac5ab8b03.jpeg 433accf93975cbfc235c8bd58857d50c.jpeg b5f25e92b7dc2dbf9515adf083dbb09e.jpeg.

It looks as if "stage" stuck.

Edited by Wuwuk
Link to comment
Share on other sites

@Wuwuk

Ok so you are staging in the same physics tick as you lock the throttle to 0. If you add a "wait 0.1." between lock throttle to 0 and stage then it will work. The reason you cant shut it down is because it is no longer part of the ship.

Link to comment
Share on other sites

Hi there, I've started with this mod, which seems to give some nice nearly infinite posibilities for my gameplay. So I`ve written my first script. But I´m not a programmer and I would be glad to get some suggestions for better scripting skills. Though I'm aware the functions in that script are elementary and I've some plans for improvement.

BUT I'm having a weird issue related to Throttle Controlled Avionics - Continued mod. Which has to be solved first, because it ruins some launches. It might be a bug or related to my code but it also happens with easier code and on the whole reproducing isn't reliable. Sometimes it occurs after VAB>Launch, revert to launch, sometimes it doesn't occur for several reverts.

Steps to try to reproduce:

If running the script below or something easier like lock throttle to 1 and wait until bla then lock throttle to 0, after first stage command the thrustlimiter of the engine goes weird. It also occurs if no function with thrustlimit is implemented. I've added mod by mod for determining which one is the culprit and updated/redownloaded all mods. This scirpt works as intended as long as TCA isn't installed. So it might be the culprit or in relationship with KOS, because I've used TCA a long time without problems. Output.log doesn't show any errors.

// Script to ascent in an efficient way


SAS off.

SET vTHROTTLE to 100.
SET wMass TO SHIP:WETMASS.
SET g0 TO BODY:MU/((ALTITUDE+BODY:RADIUS)^2).
SET vTWR TO wMass*g0*1.56.
PRINT "Wetmass [t] = " +ROUND(wMass,2).
PRINT "Gravitational acceleration [m/s^2] = " +ROUND(g0,3).
PRINT "Thrustlimit [kN]: " +ROUND(vTWR,1).

SET countdown TO 5.
PRINT "Launch in:".
UNTIL countdown = 0 {
PRINT "..." + countdown.
SET countdown TO countdown -1.
WAIT 1.
}

PRINT "Main throttle up.".
LOCK THROTTLE TO vTHROTTLE.
LOCK STEERING TO UP + R(0,0,180).
WAIT 1.
STAGE.
PRINT "Lift off!".

LIST engines IN engLIST.
FOR i IN engLIST {
SET i:THRUSTLIMIT TO vTWR/maxTHRUST*100.
PRINT "THRUSTLIMIT [%] = " +i:THRUSTLIMIT.
}

WHEN ALT:RADAR > 46 THEN {
LOCK STEERING TO UP + R(0,-2,180).
PRINT "Starting gravity turn.".
WHEN ALT:RADAR > 150 THEN {
LOCK STEERING TO SRFPROGRADE + R(0,0,270).
PRINT "Aiming prograde.".
WHEN ALTiTUDE > 30000 THEN {
LOCK STEERING TO PROGRADE + R(0,0,270).
}
}
}

WAIT UNTIL APOAPSIS > 80000.
LOCK THROTTLE TO 0.
PRINT "Desired apoapsis has been reached.".

WAIT UNTIL SHIP:ALTITUDE > 69078.
PRINT "Apoapsis is stable at " + ROUND(APOAPSIS).
UNLOCK all.

Q: How can I change i in LIST engines? Engines seem to be listed only if staged/active. Is there a way to list engines before staging?

Javascript is disabled. View full album

Perhaps anyone could give some help pls?!?

EDIT: I've been testing some things and it seems the issue is related to LOCK STEERING TO UP. If it is in the code below the problem appears. I`ve tested to insert another wait between lock throttle and lock steering but same behaviour.

// TCA vs KOS TEST

LOCK THROTTLE TO 1.
LOCK STEERING TO UP.
WAIT 1.
STAGE.

WAIT UNTIL APOAPSIS > 80000.

Edited by funk
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...