Jump to content

[KSP 1.12.x] kOS v1.4.0.0: kOS Scriptable Autopilot System


Dunbaratu

Recommended Posts

1 hour ago, hvacengi said:

The telnet part of the mod isn't exactly in my wheelhouse, but it sounds like you're pretty well versed in the underpinnings for telnet itself so I thought there might be some benefit pointing you towards the mapper for VT1000: https://github.com/KSP-KOS/KOS/blob/develop/src/kOS/UserIO/TerminalVT100Mapper.cs

You may also want to look at the telnet singleton server: https://github.com/KSP-KOS/KOS/blob/develop/src/kOS/UserIO/TelnetSingletonServer.cs

I know that when @Steven Mading worked on the telnet code, he spent a lot of time looking through the standards along with some of the unofficial implementations.  But there's always a chance we got something wrong.  If you find an issue before he is able to reply, please feel free to post it and let us know.

I was also hampered by the fact that I knew it wasn't done until Putty would work.  I was discovering ways that Putty refused to adhere to what the RFC's said it had to do, and I had to take on roles that should be done by the client side, despite being the server side.

There may also be a problem with VT100 specifically.  There's a pending PR where someone noticed the VT100 detection isn't implemented right.  As a test, see if claiming to be an XTERM terminal makes things behave better, @Crimsyn

 

 

Edited by Steven Mading
Link to comment
Share on other sites

Is there a way to make a thing like this work:

function get {
	parameter folder, file.
	copypath("0:/folder/file.ks","1:/file.ks").
}

(This obviously doesn't work and is there to illustrate my problem)

And a second thing I can'T get past is the fact that I really can't run functions from the terminal. Does it really always have to be in a programm that runs the function or a sub scribt with the functions?

Cheers, great mod, great fun, manny nerve wrecking moments :D

Link to comment
Share on other sites

3 minutes ago, maculator said:

Is there a way to make a thing like this work:


function get {
	parameter folder, file.
	copypath("0:/folder/file.ks","1:/file.ks").
}

(This obviously doesn't work and is there to illustrate my problem)

function get {

    parameter folder, file.

    copypath("0:/" + folder + "/" + file + ".ks", "1:/" + file + ".ks").

}

Edited by ElWanderer
Link to comment
Share on other sites

Okay, I fell stupid now. I thought the "" in copypath("0:/X","1:/X") were needed no matter what. so I tried something like copypath("""+"0:/"+....you get where this is heading.... :S

lol. My problem is that I have 0 experience in coding. The wiki really helps alot but sometimes I get stuck on the easiest things, sadly.

Edited by maculator
Link to comment
Share on other sites

Is KOS know to disable the switching of designs on the new parts?

Spoiler

ZqEqcSU.png

As far as I know KOS is the only mod that touches the fairings in my install. (Doesn't happen with all of the, oddly).

Anyways here is my log if it helps:

https://raw.githubusercontent.com/maculator/STUFF/master/LICENSE.md/LOG.txt

 

Edit it is loading the correct ones when the vessel spawns, just doesn't update the editor.

Edited by maculator
Link to comment
Share on other sites

6 minutes ago, maculator said:

As far as I know KOS is the only mod that touches the fairings in my install. (Doesn't happen with all of the, oddly).

kOS doesn't make any changes to fairings other than by adding the nametag module.  In my local install I have no problem setting the textures on any of the fairings (or other parts).  Looking through your logs I don't see any entries for ModulePartVariants, or for our name tag module, and the only exceptions I seem to find are related to kOS script errors.  If you remove kOS from the install, does it fix the fairings?

Link to comment
Share on other sites

4 minutes ago, maculator said:

Without KOS it works:

Try removing only the "kOS-module-manager.cfg" file inside the kOS folder.  That should at least narrow down whether or not the issue is with the part module for the name tag system.

Link to comment
Share on other sites

8 hours ago, Steven Mading said:

I was also hampered by the fact that I knew it wasn't done until Putty would work.  I was discovering ways that Putty refused to adhere to what the RFC's said it had to do, and I had to take on roles that should be done by the client side, despite being the server side.

There may also be a problem with VT100 specifically.  There's a pending PR where someone noticed the VT100 detection isn't implemented right.  As a test, see if claiming to be an XTERM terminal makes things behave better, @Crimsyn

 

 

I will check that out here tonight. It got way too late on me last night.

Link to comment
Share on other sites

I'm having trouble RCS-steering my Tundra Exploration rockets. Steering seems to counteract itself, resulting in veeeeery slow or no movement at all. The control pod's reaction wheels have virtually no torque, so steering has to rely solely on RCS. When I manually enable SAS, it starts moving. Since that shouldn't be used together with LOCK STEERING and results in heavily oversteering, i keep enabling and disabling SAS until orientation is close to where it should be.

Is this a bug or can I do something about it?

Link to comment
Share on other sites

6 hours ago, infinite_monkey said:

I'm having trouble RCS-steering my Tundra Exploration rockets. Steering seems to counteract itself, resulting in veeeeery slow or no movement at all. The control pod's reaction wheels have virtually no torque, so steering has to rely solely on RCS. When I manually enable SAS, it starts moving. Since that shouldn't be used together with LOCK STEERING and results in heavily oversteering, i keep enabling and disabling SAS until orientation is close to where it should be.

Is this a bug or can I do something about it?

I think the kOS steering manager is much less effective when a craft doesn't have much/any reaction wheel torque. It is optimised for "medium torque":

http://ksp-kos.github.io/KOS_DOC/commands/flight/cooked.html#advantages-disadvantages

You may be able to adjust the steering manager settings to something that works better for this particular craft.

Link to comment
Share on other sites

I got a quastion, if somebady wants to push me in the right direction (literally).

I got my small script to hold my planes altitude and direction:

Spoiler

clearscreen.
core:part:getmodule("kOSProcessor"):doevent("Open Terminal").
set terminal:charheight to 18.
set terminal:width to 30.
set terminal:height to 14.
set terminal:brightness to 1.

if alt:radar < 10 {
	print "we're landed... bye.".
	wait 2.
	shutdown.
} else {
	sas off.
	set alt_t to ship:altitude.
	print "target altitude: " + round(alt_t).
	set WhyDoesItHaveToBeThatComplicated to ship:bearing * -1.
	set angle to 0.
	lock angle2 to angle.
	print "heading " + round(WhyDoesItHaveToBeThatComplicated).
	lock steering to Heading(WhyDoesItHaveToBeThatComplicated, angle).
	until false {
		if ship:altitude > (alt_t + 100) {
			set angle to angle - 1.
			print "down " + angle.
			lock steering to heading(WhyDoesItHaveToBeThatComplicated, angle2).
		}
		if ship:altitude < (alt_t - 100) {
			set angle to angle + 1.
			print "up " + angle.
			lock steering to heading(WhyDoesItHaveToBeThatComplicated, angle2).
		}
		if ship:altitude > (alt_t - 100) and ship:altitude < (alt_t + 100) {
			print "hold " + angle.
			lock steering to heading(WhyDoesItHaveToBeThatComplicated, angle2).
		}
		lock steering to heading(WhyDoesItHaveToBeThatComplicated, angle2).
		print angle.
		print "wait".
		wait 10.
	}
}

 

And I really would like it to hold a sort of "global" direction, unaffected by the compass.

Right now it goes like this:

lock steering to Heading(WhyDoesItHaveToBeThatComplicated, angle2).

Is there a way to tell it to just hold the direction unaffected by compass?

I red through the documentation but that stuff is a bit much for me :S

Thank you!

Link to comment
Share on other sites

1 hour ago, maculator said:

Is there a way to tell it to just hold the direction unaffected by compass?

Depends exactly what you want. The following would orient to the current velocity vector, but  aimed at the horizon, also keeping the top of the aircraft upwards:

LOCK STEERING TO LOOKDIRUP(VXCL(UP:VECTOR,SRFPROGRADE:VECTOR), UP:VECTOR).

The vector exclude removes all up from the surface prograde vector, so the resultant vector points at the horizon. However, you may want to pitch up or down a certain amount, which would mean rotating the resulting vector. I've posted something like that before... now to see if I can find it.

Link to comment
Share on other sites

Thank you. I don't understand a thing for now, but I guess the wiki and some testing will help me. All I'm learning in KOS is based on small steps and alot of wiki consulting.

In my mini "P-Loop" pitch is handled by the loop, so I guess it should be fine.

Link to comment
Share on other sites

44 minutes ago, maculator said:

Thank you. I don't understand a thing for now, but I guess the wiki and some testing will help me. All I'm learning in KOS is based on small steps and alot of wiki consulting.

I looked up a previous solution I've given for your kind of question (https://www.reddit.com/r/Kos/comments/66pdll/question_about_steering_and_vectors/). It does involve even more vector manipulation than my previous example, I'm afraid:

// VELOCITY:SURFACE should be the same as SRFPROGRADE:VECTOR
LOCK horizon TO VXCL(UP:VECTOR,VELOCITY:SURFACE). 
LOCK STEERING TO 
    LOOKDIRUP(ANGLEAXIS(pitchAngle(),
                        VCRS(horizon,BODY:POSITION))*horizon,
              UP:VECTOR).

That pitches up (or possibly down), by whatever number the pitchAngle() function returns. The VCRS (vector cross) of the horizon and a vector pointed at the centre of the planet (straight down, I guess, should be equivalent to -UP:VECTOR) returns a vector that is at 90 degrees to both (pointed at the horizon to starboard), meaning it can be used as an axis to rotate our steering vector around, to pitch up or down.

Link to comment
Share on other sites

1 hour ago, maculator said:

What happend to the folder for storage "1"?! It's not in my scripts folder. 

"0" is the archive (ship/scripts), "1" is the local hard drive for the active CPU, in the game, so would get baked into your savefile.

Edited by ElWanderer
Link to comment
Share on other sites

I know. The thing is I noticed a misstake in my script and altered it. Now of course I didn't backup and I'm afraid to have made it worse. So long story short:

Thhe original script is running right now on a plane flying arround kerbin, the scrip in 0:/boot is altered and I wanted to copy the unaltered version to a backup, just in case. But there is no folder "1" inside scripts.

 

Edit:

I could swear there used to be a folder called "1"....

Spoiler

xiUqCAQ.png

 

Edited by maculator
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...