Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


Recommended Posts

LOCK STEERING TO RETROGRADE. 

that what I use and it works. Just need enough power to last until landed, and of course program it to deploy chutes when it's safe, unless of course you don't mind the useless stuff exploding lol. I try to get most of my stuff near ksc, and I also use the stage recovery mod, so I can get funds back for dropped stages during launch, so long as it doesn't reach orbit. Just have to have enough chutes so it would slow down, but it doesn't actually deploy the chutes, just gives you funds back based on distance from ksc, once the dropped stage is unloaded.

Note: if you're doing this to help land, it's important to use ship:SRFRETROGRADE instead. RETROGRADE is the term kOS uses for the orbital retrograde, which becomes really wrong as you approach the ground.

Link to post
Share on other sites
Note: if you're doing this to help land, it's important to use ship:SRFRETROGRADE instead. RETROGRADE is the term kOS uses for the orbital retrograde, which becomes really wrong as you approach the ground.

That's fine, as this program is for de-orbiting spent stages in sandbox, to help keep the debris count down. I'm not worried about keeping it from being destroyed.

Link to post
Share on other sites
Note: if you're doing this to help land, it's important to use ship:SRFRETROGRADE instead. RETROGRADE is the term kOS uses for the orbital retrograde, which becomes really wrong as you approach the ground.

Ahh good to know. Though like Alex I'm just using it to deorbit. I generally setup a node that puts the red x (from the trajectory mod) on ksc and burn.

Link to post
Share on other sites

Amazing! Specially on predicting terrain changes, it seems pretty accurate specially when you see it working on the crippled drone.

I'm just wondering, how many hours did you put into the math, the craft and the script?

I needed things like kos to get me interested in control back when I was in college. The math part + seeing graphics and numbers on screen always seemed boring, and the uni couldn't afford building things.

Link to post
Share on other sites

@Ozin I gave it a try on your ir and stock crafts but they wobbled a lot. I even got crashes when heading to the island waypoint, it would fly relatively steady for some minutes and all of a sudden start overshooting the target height (25m) until it crashed into the water. Processing was at 3.1 Hz though, is that ok? My laptop is super slow.

Did you publish the craft file for the fan drone from the video? I couldn't open the third vessel since I don't have those mods.

BTW I'm still awed by the video!

Link to post
Share on other sites

So I noticed my launch script is not working anymore in 1.0.4. STAGE:LIQUIDFUEL seems to now return the total amount of fuel including the next stage so my script never activates the next stage. Anybody else has noticed this problem? Workarounds?

EDIT: Nevermind. Not related to 1.0.4 it seems. I also added a procedural fairing to my rocket, I think that's causing the problem. I found some references to this bug online...

Edited by Codexus
Link to post
Share on other sites
So I noticed my launch script is not working anymore in 1.0.4. STAGE:LIQUIDFUEL seems to now return the total amount of fuel including the next stage so my script never activates the next stage. Anybody else has noticed this problem? Workarounds?

EDIT: Nevermind. Not related to 1.0.4 it seems. I also added a procedural fairing to my rocket, I think that's causing the problem. I found some references to this bug online...

Can't you use the flameout field? I guess it was created for staging scripts.

Link to post
Share on other sites

Wonder if "safe to deploy?" Is something that our scripts can access already (maybe using partstagged:getmodule) or if it would be better to wait until it's officially added? Of course I guess we could also just check the speed the ship is going before deploying.

Link to post
Share on other sites
I don't suppose there is any kind of auto-completion available for NP++?

Auto-completion no. But there is language definition for NP++ that colors keywords,brackets,variables, comments and such. It is helpful, especialy if you still learning kOS.

Link for it is buried somwhere in this thread, just search for it.

Link to post
Share on other sites

Eh, something ain't right with those npp styles - the bgColor for both, for all keywords and other style elements, are all set to "FFFFFF". Had to set it up myself but oh well, I'm happy I've got some syntax highlighting now :)

Link to post
Share on other sites
Does this work on 1.0.4 yet?

Works fine as far as I know. Only thing that I am aware of is just that it pops up the incompatibility warning, which doesn't mean it won't work, just that the version number in the version file doesn't match current KSP version. Though I haven't tested it yet so can't be 100% sure...maybe 99% lol

Link to post
Share on other sites
Wonder if "safe to deploy?" Is something that our scripts can access already (maybe using partstagged:getmodule) or if it would be better to wait until it's officially added? Of course I guess we could also just check the speed the ship is going before deploying.

Anything you see in the right-click menu in the game you can access via the partmodules, including the new chute deploy field Squad added in the recent release. Not sure what you mean by "officially added"

Link to post
Share on other sites

I'm just starting with using kOS, and I'm aiming to automate my launches with it.

I'm right now trying to launch using the following procedures, but don't know how to tell kOS so it can do it properly. Any help is appreciated.

1. Lock steering to UP until 40m/s surface velocity, then toggle stage (activate first stage engine), wait 3 seconds then toggle stage again (release launch clamps)

2. Then turn due east 5 degrees off surface prograde until 70 degrees due east

3. Lock heading 70 degrees due east until surface prograde matches the heading

4. Release steering and wait until ship vacuum TWR = 2.90

5. Toggle AG1 (This shuts down part of the multiple engines on the stage) then wait until stage remaining duration < 1 second

6. Set heading to keep surface prograde

7. When stage remaining duration = 0 second, toggle stage, wait 0.5 second then toggle stage again (ignite second stage)

6. Wait until Apoapsis = 60000m then set heading to keep orbital prograde

8. Wait until Apoapsis = 75000m then set throttle to 0

9. Wait until ship altitude > 60000m then toggle AG2 (deploy solar panels and antenna)

10. Set up maneuver for circularization at 75000m orbit (<= no idea how)

11. Toggle AG3 (Locks engine gimbal for second stage engine to reduce wobble)

12. Wait until maneuver burn time (can this be pulled from KER?)

13. Execute burn

14. Toggle SAS on and end.

If anyone can give me advice on how to do all this, and also give me some links to read on what is being done on the code you give (like variable meanings and what uses they have) that would be great.

Also I'd like to know if kOS can handle RealFuels resources the same way as LiquidFuel is handled in the kOS official tutorial page.

Thanks in advance :)

set gear to off.
set throttle to max.
lock heading to up.
clearscreen.

stage. wait 3 seconds.
stage.

wait until verticalspeed = 40 then until (90,70){
lock heading to srfprograde + (0,5).
wait 0.1.
}

if (90,70) and velocity < 1000 {
lock heading to (90,70).
}

when srfprograde = (90,70) then {
unlock heading.
}

wait until maxthrust/mass = 2.90 then {
set AG1 to on.
}

until altitude > 50000 {
if stage:?? then {
set heading to srfprograde.
if stage:?? then {
stage.
wait 0.5 second.
stage.
}
}
}

This is what I have come up with so far. I'm sure it's all wrong so plz tell me what to fix. Also I didn't know how to specify stage remaining duration so I left that part with ??.

Edited by ebigunso
Link to post
Share on other sites

I just upgraded from 17.2 to 17.3

did I do something wrong i wound up with two copies of the part CX4181 available in the SPH/VAB

I also have two name tags for each part...

Its creeping into the craft files as the crafts have module definitions for two kos name tags.

I am worried about going on and corrupting the save files.

Link to post
Share on other sites
I just upgraded from 17.2 to 17.3

did I do something wrong i wound up with two copies of the part CX4181 available in the SPH/VAB

I also have two name tags for each part...

Its creeping into the craft files as the crafts have module definitions for two kos name tags.

I am worried about going on and corrupting the save files.

it sounds like you have two installs of kOS. maybe one inside of the other? it would be consistent with these errors

Link to post
Share on other sites
I'm just starting with using kOS, and I'm aiming to automate my launches with it.

I'm right now trying to launch using the following procedures, but don't know how to tell kOS so it can do it properly. Any help is appreciated.

1. Lock steering to UP until 40m/s surface velocity, then toggle stage (activate first stage engine), wait 3 seconds then toggle stage again (release launch clamps)

2. Then turn due east 5 degrees off surface prograde until 70 degrees due east

3. Lock heading 70 degrees due east until surface prograde matches the heading

4. Release steering and wait until ship vacuum TWR = 2.90

5. Toggle AG1 (This shuts down part of the multiple engines on the stage) then wait until stage remaining duration < 1 second

6. Set heading to keep surface prograde

7. When stage remaining duration = 0 second, toggle stage, wait 0.5 second then toggle stage again (ignite second stage)

6. Wait until Apoapsis = 60000m then set heading to keep orbital prograde

8. Wait until Apoapsis = 75000m then set throttle to 0

9. Wait until ship altitude > 60000m then toggle AG2 (deploy solar panels and antenna)

10. Set up maneuver for circularization at 75000m orbit (<= no idea how)

11. Toggle AG3 (Locks engine gimbal for second stage engine to reduce wobble)

12. Wait until maneuver burn time (can this be pulled from KER?)

13. Execute burn

14. Toggle SAS on and end.

If anyone can give me advice on how to do all this, and also give me some links to read on what is being done on the code you give (like variable meanings and what uses they have) that would be great.

Also I'd like to know if kOS can handle RealFuels resources the same way as LiquidFuel is handled in the kOS official tutorial page.

Thanks in advance :)

set gear to off.
set throttle to max.
lock heading to up.
clearscreen.

stage. wait 3 seconds.
stage.

wait until verticalspeed = 40 then until (90,70){
lock heading to srfprograde + (0,5).
wait 0.1.
}

if (90,70) and velocity < 1000 {
lock heading to (90,70).
}

when srfprograde = (90,70) then {
unlock heading.
}

wait until maxthrust/mass = 2.90 then {
set AG1 to on.
}

until altitude > 50000 {
if stage:?? then {
set heading to srfprograde.
if stage:?? then {
stage.
wait 0.5 second.
stage.
}
}
}

This is what I have come up with so far. I'm sure it's all wrong so plz tell me what to fix. Also I didn't know how to specify stage remaining duration so I left that part with ??.

no help yet? :(

Link to post
Share on other sites
no help yet? :(

No idea what you're asking. The code given is too pseudo-code-ish to follow. I have no idea what you mean by this, for example:


if (90,70) and [...]

What sort of boolean condition is "(90,70)"?

Link to post
Share on other sites

As you see in the list of procedures I gave, I'm trying to aim my craft at heading (90,70) at that part. So by the procedures of before, craft orientation should be slowly pointing down towards the east from the initial upward position, so I'm trying to stop it's turn once it reaches that heading.

I'm all new to programming and kOS so I know it's all wrong, and I've been testing it in KSP today but it's giving me errors beyond my imagination :S

I'm really confused here.

If I'm not clear enough, when I pitch over 5 degrees initially, the surface prograde vector will follow the vehicle's pointing direction so it will eventually go down towards heading (90,70) if I keep my heading 5 degrees to the east of my surface prograde vector.

To put it simply, I'm initiating a gravity turn. This thing has fins to stabilize so it keeps it's course.

http://youtu.be/GmquusdH-xw

Here is a video showing a manual launch following the above given procedures. This is what I want to achieve with kOS.

TWR can be seen to the right of the navball, and apoapsis height to the left of the altitude indicator.

Also here is a slightly more refined and extended version of the code I gave before. It'd be great if some advice could be given to make this work properly.

set gear to off.
set throttle to max.
lock heading to up.
clearscreen.

stage. wait 3. //seconds
stage.

wait until verticalspeed = 40.

until heading (90,70){
lock heading to srfprograde + (0,5).
wait 0.1. //seconds
}
print "Starting pitch over..."

if heading = (90,70) and velocity < 1000 {
lock heading to (90,70).
}

when srfprograde = (90,70) then {
unlock heading.
print "Pitch over complete."
print "Waiting for next procedure..."
}

wait until maxthrustat(0)/mass = 2.70 then {
print "Standing by for partial thrust mode activation..."
}

wait until maxthrustat(0)/mass = 2.90 then {
set AG1 to on.
print "Partial thrust mode activated."
}

until altitude > 50000 {
if engine:fuelflow = stage:LqdOxygen then {
set heading to srfprograde.
print "Staging..."
if engine:ignition = false then {
stage.
wait 0.5. //seconds
stage.
print "Second stage ignition complete."
}
}
}

when altitude > 40000 and apoapsis > 60000 {
set heading to prograde.
}

when apoapsis > 75200 {
set throttle to 0.
}

wait until altitude > 60000 then {
set AG2 to on.
set AG3 to on.
}

Also I have one problem while using kOS right now, the list engines command shows that the craft has no engines aboard while in reality it does. I use the latest kOS in KSP ver1.0.2.

Does anyone have an idea what is going on here?

Edited by ebigunso
Link to post
Share on other sites
it sounds like you have two installs of kOS. maybe one inside of the other? it would be consistent with these errors

Clever man. Especially when I add one more trick. Once you mentioned inside folders indicating the extra kos could be anywhere at any depth in gamedata.

I found it not inside itself. becuase my first trick was to reinstall but be 100% sure deleted first. So no not inside one another.

At some poitn i dropped a KOS on partangle display folder (click and drag drop itis.)

So NOTE for anyone else with the same symptoms the second insall can be anywhere in the game data tree.

Search for the file kos.version to find it.

Now tyo some how back out the changes to any craft and save files... Yuk.

I think I might get source code control happening for my craft files.

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...