Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

Do you have enough reaction wheels on the craft to steer it? as far as I remember Stayputnik does not have any reaction controls or has very little.

Link to comment
Share on other sites

I am using 4 of the AV-R8 at the bottom, so it is definately steerable.

Same Rocket with HECS instead of Stayputnik workes just fine

you see there just very fast and wired oscillations, as if kos was fighting against sas...

perhaps a leftover of this issue?

https://github.com/KSP-KOS/KOS/issues/74

setting sasmode to stabilityassist didn't help either

- - - Updated - - -

I just remembered, that i hat also a wired issue back in 0.90

I think it was the same problem:

On revert steering didn't work

"SAS off." at the beginning of a code didn't help

but:

SAS on.

wait 1.

SAS off.

did the trick for me in 0.90.

think there must be some bug somewhere or an incompatibility with another mod.

Edited by BlueTiger12
Link to comment
Share on other sites

I THINK I have stumbled upon a bug... Let me explain.

mLfbAOC.png

I have this rocket, it's basically just a capscule, CX4181 Scriptable Control System, fueltank, engine(LV-T45), decoupler and an SRB(BACC).

If I empty the capscule(as in no pilot) the LV-T45 does not fire when staging occurs. It does fire when I have a pilot on board with the same code.


lock throttle to 1.
set mode to 1.

lock steering to up.

until 0
{
set myspeed to ship:verticalspeed.
wait 1.
if(myspeed > ship:verticalspeed)
{
stage.
}
}

Another thing I noticed, also without a pilot, is that the TT-38K Radial Decoupler does not eject at all when staged.

Is this just me doing something stupid, did I not read the documentation? Miss a meeting?

Link to craft

-

Kolbjorn

Link to comment
Share on other sites

I THINK I have stumbled upon a bug... Let me explain.

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

I have this rocket, it's basically just a capscule, CX4181 Scriptable Control System, fueltank, engine(LV-T45), decoupler and an SRB(BACC).

If I empty the capscule(as in no pilot) the LV-T45 does not fire when staging occurs. It does fire when I have a pilot on board with the same code.


lock throttle to 1.
set mode to 1.

lock steering to up.

until 0
{
set myspeed to ship:verticalspeed.
wait 1.
if(myspeed > ship:verticalspeed)
{
stage.
}
}

Another thing I noticed, also without a pilot, is that the TT-38K Radial Decoupler does not eject at all when staged.

Is this just me doing something stupid, did I not read the documentation? Miss a meeting?

Link to craft

-

Kolbjorn

No Kerbal or no Pilot (but scientist). If it's the former then unless you also have a probe core on your craft it is not supposed to fly, no?

Link to comment
Share on other sites

No Kerbal or no Pilot (but scientist). If it's the former then unless you also have a probe core on your craft it is not supposed to fly, no?

But it does fly, as long as I don't use radial decouplers or liquid fuel engines everything works great. Staging works, SRBs fire and steering is locked and guided according to the code(even if I run a gravity turn profile).

I was under the assumption(yes, I know, assuming things is a great way to kill kerbals) that the scriptable control system could work without a probe core, the only difference would be that I would have no control after liftoff (Which is great, if your program is without errors).

If it is intended that you also need a probe core, I will of course adjust my rockets to that, it just puzzled me that some things work and some don't.

Link to comment
Share on other sites

I think we just never tried that. You raise a good point about kOS parts - I too think that thay should also act as probe-cores just without any reaction wheels.

Link to comment
Share on other sites

I'm having a problem where the kos icon doesn't appear in the upper right hand corner of the screen, so every time i need to open the console i need to click the part thru a fairing and then procede to edit the script. Does anyone know how to fix this?

Thanks.

Link to comment
Share on other sites

Just checking, this came to me this morning and I tested it once and it seemed to work....for a pid controller for grav turn, I did current altitude/70,000(basically a percentage of the altitude) then that number * 90, then 90 minus that number, to give me what the pitch should be. Maybe a way to simplify it, but haven't messed with it much other thanthe one test. Does that sound about right? Example below: (typing from my phone and don't have the code in front of me but...)


Lock altPer to ship:altitude / 70000.
Lock pitchDown to altPer * 90.
Lock gravTurn to 90 - pitchDown.

Link to comment
Share on other sites

Here is what the gravity turn of my ship uses.

LOCK STEERING TO R(0,0,DefaultRoll) + HEADING(90,(90-(((SHIP:ALTITUDE-1000)/TurnEnd)^(TurnShape)*90))).

Default roll is usually 0, Turn end is altitude in meters for level flight, and turn shape is the % of the turn, similar to mechjeb. eg for a 65% turn, you would set it to 0.65.

Link to comment
Share on other sites

I'm having a problem where the kos icon doesn't appear in the upper right hand corner of the screen, so every time i need to open the console i need to click the part thru a fairing and then procede to edit the script. Does anyone know how to fix this?

Thanks.

Not sure. I think it depends on if you have Blizzys tool bar installed or not. If you do, then you might not have kOS checked in the "visible" section or whatever it is called. Me personally, I don't use the toolbar button, I usually assign an action group to open the kOS terminal. I use AG10, but before I had custom action groups unlocked I used either the brakes button, or abort button, which only works really if you are not using either one of those. A "safe" one to use in that case would be the light button.

Link to comment
Share on other sites

I'm having a problem where the kos icon doesn't appear in the upper right hand corner of the screen, so every time i need to open the console i need to click the part thru a fairing and then procede to edit the script. Does anyone know how to fix this?

Thanks.

That's funny because I've got two of them (although one is fubar and doesn't do anything)

MJ3vB2j.png

Link to comment
Share on other sites

Is there a way to interact with kos script when on map view? I'd like to use action groups but they seem to be disabled. When I press M to switch to the other view they work fine, but I can't see what I'm doing.

BTW I was trying to build a visual encounter planner tool. The idea is to draw the future position of both your vessel and your target using visible vectors and positionat(). But for that to be useful I need a way to interact with it to set the time to earlier/later. I'd like to do it somewhat how the hover script from the pid library.

Link to comment
Share on other sites

Is there a way to interact with kos script when on map view? I'd like to use action groups but they seem to be disabled. When I press M to switch to the other view they work fine, but I can't see what I'm doing.

BTW I was trying to build a visual encounter planner tool. The idea is to draw the future position of both your vessel and your target using visible vectors and positionat(). But for that to be useful I need a way to interact with it to set the time to earlier/later. I'd like to do it somewhat how the hover script from the pid library.

I'm surprised to find that the map view disables the action groups. At the moment there are not other sort of input methods so I think you're stuck. We keep saying we'd like to do input in a future update but development is slow because it first requires a lot of other embetterments first to do it proper and right.

Link to comment
Share on other sites

I'm surprised to find that the map view disables the action groups. At the moment there are not other sort of input methods so I think you're stuck. We keep saying we'd like to do input in a future update but development is slow because it first requires a lot of other embetterments first to do it proper and right.

Hmmm.... I'd be happy enough if I can do it dirty and wrong lol

Do you think there's a chance to capture roll/yaw or any other type of commands and change variables in the script? something equivalent to


set dt to TIME.
on ag1 { set dt to dt + 10. preserve. }.

maybe with a wait 2. so it won't go crazy.

really ANYTHING will do for me. mouse interaction. zoom level. gamepad buttons/axis.

I'll give a try later with raw command input. Any suggestions are welcome.

Link to comment
Share on other sites

Hmmm.... I'd be happy enough if I can do it dirty and wrong lol

Do you think there's a chance to capture roll/yaw or any other type of commands and change variables in the script? something equivalent to


set dt to TIME.
on ag1 { set dt to dt + 10. preserve. }.

maybe with a wait 2. so it won't go crazy.

really ANYTHING will do for me. mouse interaction. zoom level. gamepad buttons/axis.

I'll give a try later with raw command input. Any suggestions are welcome.

Yeeeey it works!




until ag8
{


print "interval is " + interval + " " at (3,3).
print "lapse is " + lapse + " " at (3,4).


print "yaw is " + SHIP:CONTROL:PILOTYAW + " " at (3,6).
print "pitch is " + SHIP:CONTROL:PILOTPITCH + " " at (3,7).


set interval to interval * 10^ SHIP:CONTROL:PILOTYAW.
set lapse to lapse + SHIP:CONTROL:PILOTPITCH*interval.
}

The only thing you need while on map view is to have the navball on screen.

Off to some cool scripting now :) *flies away on brand new kOS equipped rocket*

Link to comment
Share on other sites

Made a short video on kOS for my Two Minute Mods series. Of course - I couldn't cover much in under three minutes, but I hope I got the general thrust of things across! Feel free to share around, chuck into other posts, and so on.

Link to comment
Share on other sites

Made a short video on kOS for my Two Minute Mods series. Of course - I couldn't cover much in under three minutes, but I hope I got the general thrust of things across! Feel free to share around, chuck into other posts, and so on.

Nice video! That story about the person who got a job after mentioning kOS is inspiring and good to hear. :)

I've been playing with kOS off/on for a while, started back in 0.23 I guess, had a script written to launch a ship with 3 comm sats to 2,868km, get an orbit with 4 hour orbital period and release a sat each time it went around to AP. Then nivekk disapeared, and there was something that broke with an update I think, and I didn't use it again until 1.0.2. Had to rewrite my launch/circularize script, but it works better now as I have a PID setup for controlling throttle and gravity turn, plus the launch program has parameters for if the ship has a fairing, an antenna, or both antenna and dish. As part of the script, i have a 2nd script which executes manuvure nodes, and that comes in handy for all sorts of things. Also have a decent script that automatically closes solar panels, retracts dishes/antenna (and deploys them again once out of atmosphere, if aero braking), and deploys chutes when below a certain altitude/speed, so they don't get ripped/burned off. Now I need to work on a script for powered landing, and targeting landing/docking...lol

Link to comment
Share on other sites

Question:

I can ask vessel:isDead.

because (as per the doc) i may have found vessel, waited a while (wait 10) and then it is dead.

I have similar problem but with parts and my fuel management system.

Before launch my code analyses the ship and automagically works out, what to do with tanks and establishes an enabling order.

(order == bottom to top. comes in handy with biiiiiig lifters i want to fly later. or with these puppies that were light on reaction wheels when I had a 30 part limit)

it remembers that order.

Later during launch/staging. Some of the parts are now gone. Is there way to ask part if its dead ?

I tried comparing what was the parts stage number, with the rockets current stage number...

but some fuel parts on the first stage, had stage number 4.. when my rocket had 3 stages.

I have even seen them i think reported as stage 6 on my 3 stage rocket. :( (cant reproduce now :\)

My current plan is to store the UIDs as handles and refind the part every time i want to talk to it.

it would be nice if I could.

Is there way to ask part if its dead ?

Question:

Also does anyone know anything about the exact timing of when parts cease to exist when you stage them...

Question:

Also

Stage Numbers on parts are weird. (see how both small tanks are stage 4 and the solids they are sitting on are stage 3. huh?)

Is there some way in VAB to get the small fuel tanks to have the right numbers. (I have been looking at the craft file its a 'feature' of Thumpers.)

 // a slightly different ship had this in the file and then the attached small tanks were stage 6.... and the thumpers were 4.
part = solidBooster1-1_4294535298
......
istg = 4
dstg = 6

I had guessed the solids would have the wrong stage numbers too.

But to have physically coupled objects having different stage number is how?

sigh tree walking code here i come?

T7xiL18.png

Edited by Onchyophora
additional Q.
Link to comment
Share on other sites

I made a quad-engine drone program for kOS :)

kOS reddit thread

How cool is that :) A fly-by-wire implementation combined with smart hover capabilities. Pretty much exactly the things I have been working on in kOS :D

I am impressed by the flexibility and robustness of the script, judging by the videos.

Link to comment
Share on other sites

Does anyone know how to set something to steer towards its retrograde direction? I'm trying to make a simple de-orbiting program, for having useless stages de-orbit themselves.

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.

Link to comment
Share on other sites

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