Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

Is the version on kerbal Spaceport right? It says it's version 0.5 on the spaceport website, however when I download and install it, the following all produce "Unrecognized term" errors just like they would have before the update:

print sin ( 45 ) .

print cos ( 45 ) .

print abs ( -1 ) .

I wiped my install and re-installed fresh from the download just to be absolutely sure. Then I removed the CX-4181 part from the craft and put a new one on from the toolbox panel, just in case there's a part change it needed. Same result.

I just wanted to post this again to make sure Kevin sees it. The spaceport version still says it was updated on Sep 8, which was what it said when I had this error.

Link to comment
Share on other sites

I just wanted to post this again to make sure Kevin sees it. The spaceport version still says it was updated on Sep 8, which was what it said when I had this error.

It looks like you've got some spaces in there, try removing them. I saw this before and haven't gotten to fixing it. But I'll double check the version when I can.

Link to comment
Share on other sites

Is it just me or does K-OS look very COBOL-ish in its english like statements and statement delimiter? ;) now we just need some DIVISIONs for effect.. lol (I joke......... kinda) ;)

Does COBOL use periods? I've never seen any COBOL code before.. I must Google this

Link to comment
Share on other sites

When you open the terminal, what version does it give?

kOS Operating System Build 34562
KerboScript v0.5

Proceed.


kOS Operating System Build 38545
KerboScript v0.4

Proceed.

And that was with the download I got that was called: kOS_0_5 from spaceport. The zip file says its' 0.5 but when extracted I get what you see there.

Link to comment
Share on other sites


kOS Operating System Build 38545
KerboScript v0.4

Proceed.

And that was with the download I got that was called: kOS_0_5 from spaceport. The zip file says its' 0.5 but when extracted I get what you see there.

Okay I just downloaded and installed it to check and it does seem to have the right number... is this the first version you've downloaded or are you updating from a previous one? Is anybody else having this problem?

Link to comment
Share on other sites

Kevin,

Awesome mod!! While working on my PID control algorithm I really wanted some telemetry. So I added a LOG function which appends a message to a file on the archive volume (if it is within range). This will be very useful for debugging and making graphs. If you are not in range of KSP, then the messages are lost to the depths of space. Glad to have a use for those antenna.

I sent a pull request on github for you. Let me know if you'd like me to change it to better fit your vision or throw it away if you don't like it. Just thought others might enjoy.

Example

delete speedlog from volume archive.
until altitude > 50000 {
LOG speedlog "Alt:" + altitude + " Spd:" + surfacespeed.
wait 1.
}.

Cheers

Link to comment
Share on other sites

Hello, I have a problem where saved edits to scripts are lost when I revert a flight to launch. I have to save the script, return to the space center, then go back to the flight to make it save.

Edited by Nate072
Link to comment
Share on other sites

Hello, I have a problem where saved edits to scripts are lost when I revert a flight to launch. I have to save the script, return to the space center, then go back to the flight to make it save.

Here is the deal. There is and 'Archive' volume (volume 0). This is persistent and the files are common to all ships.

Then on each ship there are a number of volumes. These are part of the ship and if you revert so does anything that is stored on them.

You can copy files to and from volumes. I think the idea here is you copy in the programs you want from the archive to the ship and then those fly with the ship.

So if you are developing and you want to avoid this, you have a couple options.

1. Copy the program to archive after you change it. Copy it back after you revert.

2. Just switch to archive and edit/run from there. Useful during development but when flying a real mission you will want to copy to a ship volume as you loose access to the archive at 75000m unless you put antenna and dish on your ship.

3. Do what you are doing now but quicksave after you edit. Then instead of reverting, just quickload.

The key is, except for the archive, your programs are part of your ship and they save/load/revert right along with it.

Link to comment
Share on other sites

I've just been using archive for everything. I've been using the kOS IDE someone developed. Mostly I've just been working on launch programs and so far have only been testing things on 0.21, as I've been waiting for RT2 to become complete...eventually ;):)

Link to comment
Share on other sites

Okay I just downloaded and installed it to check and it does seem to have the right number... is this the first version you've downloaded or are you updating from a previous one? Is anybody else having this problem?

Updating. But then I deleted the .dll file from the plugins directory and redownloaded and resintalled it just to be absolutely sure the DLL came from the new download.

Same effect. It still says 0.4 in the terminal window.

Link to comment
Share on other sites

This plugin has enormous potential, I've been wanting something like this forever. :)

My main goal is to make a program for a semi-autonomous rover that I can just point at a target a hundred kilometers away and say "go there" with some hope of it making it. I've got a basic little start, but I'm running into a few problems. Here's the program as it currently stands:


lock wheelsteering to target.
set maxspeed to 5.
until target:distance < 100
{
if ABS(target:bearing) < 90 AND surfacespeed < maxspeed
{
brakes off.
lock wheelthrottle to 1.
}.
if surfacespeed > maxspeed
{
unlock wheelthrottle.
}.
if ABS(target:bearing) > 90
{
lock wheelthrottle to -1.
}.
if surfacespeed > maxspeed * 1.1
{
brakes on.
}.

if ALT:RADAR > 1
{
SAS ON.
}.
if ALT:RADAR < 1
{
SAS OFF.
}.
}.
brakes on.
unlock wheelthrottle.
unlock wheelsteering.

Problem one: I had to retype that program because for some reason KSP_win\Plugins\PluginData\Archive is completely empty. Is that where the programs are supposed to be stored? It's being stored *somewhere*, I can quit the game and come back and it's still here, so I'm probably just missing something basic. :)

Problem two: I wanted to detect if the rover was hurtling through the air and slam on SAS to kill any tumble. The KerboScript page of the KOS wiki mentions a "status" statistic with "flying" and "landed" values, but when I try checking them the compiler complains about unrecognized values. The radar solution is an okay substitute in the meantime, I guess.

Problem three: I targeted a lander I'd placed about 80 kilometers away from KSC and sent my test rover toward it running this program. Everything seemed to be going okay until it reached a gentle upslope incline, at which point the wheelsteering went completely bonkers - it flickered rapidly back and forth, nearly flipping the rover, and then eventually settled down with the rover turned 90 degrees away and switching endlessly between forward and reverse as it tried (and failed) to reorient toward the target. I tried switching the rover's control module from a forward-facing probe body to an upward-facing one instead, to see if it was the frame of reference that was causing trouble, but that also caused similar freakouts (except it kept switching between forward and reverse while keeping approximately oriented toward the target - going up an incline seemed to flip its sense of direction over). I think something in the maths behind wheelsteering and target direction isn't happy about sloped terrain (specifically, upslopes. It seems to handle downslopes okay).

And finally, I guess a feature request. I'd like to be able to detect my rover's pitch so that I can adjust its maximum speed based on how steep the terrain it's traversing is, but I can't figure out a way to get the ships current heading to extract that. Getting the current heading would also help me make a more intelligent anti-tumble routine than simply switching the SAS on, I could have the rover use torque or emergency RCS to flip itself to a level orientation while still pointing in the direction of travel so the wheels catch the ground smoothly. I know you're working on better rotation support, will something like that be included?

Oh, and something a little more "out there" - a way to get a heading toward a predefined latitude and longitude target? That way I could set up a whole chain of waypoints between two destinations and program a rover to take a safe path between them.

Edited by FaceDeer
Link to comment
Share on other sites

Okay I just downloaded and installed it to check and it does seem to have the right number... is this the first version you've downloaded or are you updating from a previous one? Is anybody else having this problem?

No problem here, definitely says 0.5 on bootup.

Link to comment
Share on other sites

Alright so I just started fiddling around with launching multiple ships at a time (because it's awesome) and I am making a program to launch two satellites into orbit at once. The program will launch the rockets, drop boosters when needed, circularize at 120,000m drop the fairing shell, drop the probe, and turn retrograde to deorbit the mainsail.

Here's what I have

clearscreen.
print "3...". wait 1.
print "2...". wait 1.
print "1...". wait 1.

lock steering to up + R(0,0,180).
lock throttle to 1.

print "Ignition!".
stage.


wait until altitude > 10000.
print "Beginning gravity turn".

lock steering to up + R(0,-50,180).

wait until stage:liquidfuel < 1100.
print "Initiating stage separation.".
stage.
print "Stage separation complete.".



wait until apoapsis > 120000.
lock throttle to 0.
lock steering to prograde.
print "Waiting until Apoapsis Reached.".

wait until eta:apoapsis < 15.
print "Circularisation burn in 3...". wait 1.
print "2...". wait 1.
print "1...". wait 1.

lock throttle to 1.
print "Ignition.".
Wait until periapsis > 110000.

print "Circularization burn complete. Killing throttle.".

Lock throttle to 0.

wait 5.

print "Ejecting fairing case.". Wait 1.
stage.

print "Separating probe.". wait 2.
stage.
lock steering to retrograde.

print "Initiating retro burn in 5...". wait 1.
print "4...". wait 1.
print "3...". wait 1.
print "2...". wait 1.
print "1...". wait 1.

lock throttle to 1.
wait until stage:liquidfuel < 1.
print "Retro Burn Complete. Program terminated.".

This program works perfectly, but only for the rocket currently in focus. The out of focus rocket refuses to stage and I can't figure out why. If I switch to it in flight and manually stage when necessary it works but the program won't do it.

Any ideas?

EDIT: Made a few test vehicles with no success. I made a video of the problem including the test script I was running here:

Also a little request for future versions: Can we get stage:solidfuel so we can eject solid rocket boosters more easily?

Edited by Glockshna
Link to comment
Share on other sites

Also a little request for future versions: Can we get stage:solidfuel so we can eject solid rocket boosters more easily?

It's already in there. I use the following code in my "generic" launch script:

if stage:solidfuel > 0 {
when stage:solidfuel = 0 then {
print "SRB separation.".
stage.
}.
}.

Link to comment
Share on other sites

It's already in there. I use the following code in my "generic" launch script:

if stage:solidfuel > 0 {
when stage:solidfuel = 0 then {
print "SRB separation.".
stage.
}.
}.

interesting. Whenever I use that in my scripts it just skips over it as if it doesn't exist. That's not as big of a deal as the stage separation issue I'm having though.

Link to comment
Share on other sites

Not sure if this has been mentioned, but would it be possible to assign specific parts a name or tag by right clicking them? Here's the idea: right click a part and you can name it to whatever you want to be called up by kOS or have the ability to assign that part to a group. So for example: Right-click an outer engine and rename it as "engine2" or "engine2:outer", the latter assigns the engine to the "outer" group. Then you can independently throttle that engine (presumably), or disable that group's gimbals, or if you do it to fuel tanks, transfer fuel from one specific part to another, activate specific solar panels or antennae, etc etc.

Possible?

Link to comment
Share on other sites

I just launched my first rocket with kOS, it's awesome! But I did notice something rather annoying while testing.

This was part of part of my program:

lock steering to up + R(0,-60,-180.

Notice that I forgot the ) to close the angles. I'd expect it to return a syntax error and abort the script, but it actually crashes the game!

Edited by Dappa
Link to comment
Share on other sites

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