Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

I keep getting a "power starved" condition after a few minutes of flight even though I have loads of ec and I am connected to the KSC.

Is this a common problem?

Link to comment
Share on other sites

On 12/1/2016 at 3:28 PM, hvacengi said:

I only see one output_log.txt, and it has the error for "run", not the error you mentioned for steering.  Not a huge deal at this point I suppose, since I'll be able to test it myself when I get home from work.

As Drew points out, kOS itself does not provide the support for RasterPropMonitor, so we don't really know how gui objects are instantiated there.  I honestly cannot see this working well in the raster window, simply because of scale.  That doesn't mean that we can't look at keeping a certain level of abstraction available so that it might theoretically be possible.  But I wouldn't expect that to exist in the first incarnation.  After the GUI system is working we can look at pulling out the necessary components so that it can support any kind of UI system available.

Sorry for such a late reply, but take a look at what I've done. kOSPropMonitor is certainly not just theoretical. It works quite well, though scale is a thing.

I'm here to inquire about when I should make my next release. It seems that every time I get back here, I release the thing right before you guys break it :)
I'm still reviewing my code and kOS, and it looks like everything is pretty much OK from this preliminary stage.

I'm assuming now no one really know from what Steve said, so I'll definitely be working off public release for now. I'll likely have to do a little bit once you merge dev in, but it's nothing I can't handle once I remember to come back and work on this again.

 

Cheers.

Edited by dsonbill
Link to comment
Share on other sites

Is it possible to have kOS do a pre-launch check of all your stages?  During Pre-Launch it would do things like:

  1. check all your engines to verify they have (the right) fuel.
  2. check all your engines to verify that a 'stage' event will actually decouple and start the engine.
  3. do a cursory check of your staging to verify you don't decouple un-ignited engines. 
  4. check your crewed vessels have parachutes.
  5. check for antennas.
  6. check for launch clamps...
  7. (RO) check your crew has supplies.
  8. check your vessel for adequate electricity
  9. and on and on... checking the items you are most likely to forget or mess up.
Link to comment
Share on other sites

12 minutes ago, Probus said:

Is it possible to have kOS do a pre-launch check of all your stages?  During Pre-Launch it would do things like:

  1. check all your engines to verify they have (the right) fuel.
  2. check all your engines to verify that a 'stage' event will actually decouple and start the engine.
  3. do a cursory check of your staging to verify you don't decouple un-ignited engines. 
  4. check your crewed vessels have parachutes.
  5. check for antennas.
  6. check for launch clamps...
  7. (RO) check your crew has supplies.
  8. check your vessel for adequate electricity
  9. and on and on... checking the items you are most likely to forget or mess up.

Some of things on list could be possible, for some I don't have a clue.
For example, it is possible list all part suffixes and resorces with kOS. It should not be too hard to compare engine fuel needs with resources available. Even if you can't get proper fuel needs for engine, you can create fixed list with hand written resources per engine that can be used for comparison.

To get possible info per stage when that stage is not happened yet I don't know. Someone with better knowlage of kOS would have to answer this. I don't have idea how that could be accomplished, but someone else might.

Antennas and electricity can be checked, launch clamps too. Supplies, crew parachutes and other mod depended stuff can be checked if values that they use are visible trough right click part info in flight.

It would be much easier to create script customized for each craft design, but then you would probably have already decently designed craft that will not need such script in first place.

Compleately universal script that would cover all possible mods and craft designs ? I assume it will be very difficult to achieve with kOS.
It might be easier to create custom plugin/dll that will be used inside VAB/SPH while you build craft. Similar to existing stock engineer info, just with extended information from mods.

Link to comment
Share on other sites

30 minutes ago, kcs123 said:

Completely universal script that would cover all possible mods and craft designs ? I assume it will be very difficult to achieve with kOS.
It might be easier to create custom plugin/dll that will be used inside VAB/SPH while you build craft. Similar to existing stock engineer info, just with extended information from mods.

That's a good idea. Have complimentary mods for the VAB and kOS. Extensive Engineering Report would be a good start. 

Is there a way to have your kOS script start automatically when the ship loads?

Edited by Probus
Edit: boot.ks looks like it does the trick.
Link to comment
Share on other sites

19 minutes ago, Probus said:

Is there a way to have your kOS script start automatically when the ship loads?

yes
boot script
but you need to assign it in the VAB

look at linuxgurugamer mods
wernher checker
EERC
 

25 minutes ago, Probus said:

Edit: boot.ks looks like it does the trick.

this was canceld

Link to comment
Share on other sites

17 hours ago, Steven Mading said:

Here?

The github site for the project?

/r/kos on reddit?

There's a few ways.  Why, what did you want to say?

 

i want to get a kRISC disassembler.

i'll try on reddit, thanks for the suggestion.

Edited by sturdy-chainsaw
Link to comment
Share on other sites

hello fellow kerbonauts

i'm having a bit of a strugle with a program that stabilises my dragon 2 derivate when landing (by using thrustlimiting). I cannot properly subtract the difference of the UP direction to the direction that im going in. i tried to do this by doing UP-FACING but that didn't work out well. Can you guys tell me the best way to keep the craft facing perfectly up (or retrograde for when i'm burning at higher altitude) by using differential throttling?

 

thanks in advance :)

Link to comment
Share on other sites

1 hour ago, kerboman25 said:

hello fellow kerbonauts

i'm having a bit of a strugle with a program that stabilises my dragon 2 derivate when landing (by using thrustlimiting). I cannot properly subtract the difference of the UP direction to the direction that im going in. i tried to do this by doing UP-FACING but that didn't work out well. Can you guys tell me the best way to keep the craft facing perfectly up (or retrograde for when i'm burning at higher altitude) by using differential throttling?

 

thanks in advance :)

UP and FACING are directions, the addition and subtraction of which is a bit of a mystery to me. It might work better if you take their vectors e.g. LOCK diff_vector TO UP:VECTOR - FACING:VECTOR.

Edit: but this doesn't answer your question about differential throttling, sorry.

Edited by ElWanderer
didn't read the previous post properly :(
Link to comment
Share on other sites

On 4/21/2017 at 5:03 PM, sturdy-chainsaw said:

 

i want to get a kRISC disassembler.

i'll try on reddit, thanks for the suggestion.

You'll be better off looking at Object code (OOP) and how to interface this to C-Sharp.

IOW.. dynamically obtaining function addresses.

Or just ask the KOS developers for their source code.

:cool:

Link to comment
Share on other sites

  • 2 weeks later...

I'm new to kOS and to programming and I'm finding the learning curve very steep. I've made a couple of simple scripts relating to launching to test myself, which don't work, and I don't understand why.

The first one is designed to hold the ship to the launch tower until it has built up enough thrust to climb away. The terminal doesn't say anything but the second 'STAGE.' never gets executed and the rocket just sits on the launchpad burning all its fuel, even though the TWR goes as high as 4.

SET g TO body:mu / (altitude + body:radius)^2.
SET myEngine TO SHIP:PARTSTAGGED("Firststage")[0].
SET twr TO myEngine:THRUST / (g * ship:mass).
STAGE.
WAIT UNTIL twr > 1.
STAGE.

The second one (actually a pair of scripts - 'launch.ks' imports 'ascent.ks') is a modification of a launch script from CheersKevin's YouTube series (https://github.com/gisikw/ksprogramming/commit/380d9bbf3b19268da081aa17eb8ca3ff910ab1b6). The terminal says 'number of arguments passed in didn't match the number of DECLARE PARAMETERS. Called with not enough arguments', highlighting 'PARAMETER profile' and the corresponding variable 'ap'. I guess it doesn't recognize 'ap' as being the 'profile'?

launch.ks: https://pastebin.com/VyxZGfR3

ascent.ks: https://pastebin.com/0kQh83we

If anyone could help with either of these I'd be very grateful. I've spent a long time trying and failing to understand how these things work.

Link to comment
Share on other sites

You should, instead of setting twr once, use the LOCK command, which re-evaluates that expression repeatedly. Will make the post more detailed when I'm back at my desktop.

EDIT TIME:

So, while I'm not sure on how the second line is working (you can always try something like PRINT myEngine to make sure it's what you think it is), the bug is pretty obvious. At line 3, it sets the variable twr to the current value of myEngine:THRUST / (g * ship:mass).

It then never updates itself. SET is a one-time thing.

There are two solutions:

#1, replace line 3 with "LOCK twr TO myEngine:THRUST / (g * ship:mass). You may then want to add an UNLOCK command after line 5 so that you don't waste CPU cycles continuing to compute that. The difference between SET and LOCK is that LOCK is evaluated at every tick.

#2: Run the SET command in a loop, as so:

SET g TO body:mu / (altitude + body:radius)^2.
SET myEngine TO SHIP:PARTSTAGGED("Firststage")[0].
SET twr TO 0. // Give it a dummy initial value before running the loop.
STAGE.
UNTIL twr > 1 {
	SET twr TO myEngine:THRUST / (g * ship:mass).
	WAIT 0.1. // Wait 0.1 seconds in between runs through the loop. General good practice since kOS takes more electricity the more evaluations it does.
}
STAGE.

As to why launch.ks fails... the first command is "RUN ascent.ks"... without any parameters, and the ascent.ks script expects three parameters.

Edited by Starman4308
Clarification and expansion
Link to comment
Share on other sites

Wow, thanks for the quick response. The solution to the TWR issue worked great - I guess the lesson for me is to make sure sure I know exactly what terms like SET and LOCK mean before I use them.

56 minutes ago, Starman4308 said:

the first command is "RUN ascent.ks"... without any parameters, and the ascent.ks script expects three parameters.

I'm afraid I don't know what you mean - CheersKevin's script starts off with a RUN command too, without parameters. How do I add these parameters? Sorry if I'm being dense.

Link to comment
Share on other sites

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