Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

7 minutes ago, RS25forlife said:

print orbit:velocity does not print it in m/s

It's in m/s, but it's a vector. To get the scalar value (magnitude) use :mag suffix of the vector
print orbit:velocity:mag.

Link to comment
Share on other sites

32 minutes ago, RS25forlife said:

Thank you! Do you also happen to know how to get KOS to print orbital velocity in m/s? print orbit:velocity does not print it in m/s. This is for the sake of an equation that needs the orbital velocity in m/s.

orbit:velocity is a pair of velocities - orbital and surface (like the two navball modes of the same name).

To get the one you mean you need to specify an additional suffix, ':ORBIT', or ':SURFACE".

you want orbit:velocity:orbit  (imo we really should have called it "orbit:velocity:orbital" not "oribt", but we didn't.)

BUT, be warned, that *is* is m/s... but it's a vector, of course, not a scalar.  To get it as a scalar if all you want is the magnitude, append a `:MAG` suffix on the end, like so:

orbit:velocity:orbit:mag

 

Link to comment
Share on other sites

1 hour ago, BeafSalad said:

Has anyone recompiled v0.20.1 for use in ksp 1.1.3 ?

If you look a couple of pages back you'll find this post:

A final release is coming, but the release candidate found more bugs than we were hopping for and required additional work to repair.

Link to comment
Share on other sites

3 minutes ago, hvacengi said:

If you look a couple of pages back you'll find this post:

A final release is coming, but the release candidate found more bugs than we were hopping for and required additional work to repair.

I am aware of the release candidate and have tried it only to find a bug that cripples some of my scripts. I was asking if anyone has done a unofficial build of v0.20.1 for ksp 1.1.3. I know you guys are too busy with the v1.0.0 release. As far as I am aware the only thing broken in 1.1.3 is the time warp and I am sure I read somewhere that a recompile works.

I have just been atempting it myself with msbuild as I do not want to mess around with Visual Studio but I am getting many errors and have been unsuccessful as yet.

Link to comment
Share on other sites

1 hour ago, BeafSalad said:

I am aware of the release candidate and have tried it only to find a bug that cripples some of my scripts. I was asking if anyone has done a unofficial build of v0.20.1 for ksp 1.1.3. I know you guys are too busy with the v1.0.0 release. As far as I am aware the only thing broken in 1.1.3 is the time warp and I am sure I read somewhere that a recompile works.

I have just been atempting it myself with msbuild as I do not want to mess around with Visual Studio but I am getting many errors and have been unsuccessful as yet.

I had no trouble building kOS in VS2015, you'll just need to update the assembly references to point at the relevant files in KSP\KSP_x64_Data\Managed.

And yes, the simple recompile should fix timewarp while you wait for 1.0.0.  I opted to not post my build here to avoid complicating things for the developers in the middle of the 1.0.0 release, but I did consider it.  (Timewarp broke because Squad added a new "optional" parameter to the function, but optional parameters in MSIL aren't actually optional at runtime -- they merely instruct the compiler what value it should put there instead.)

Link to comment
Share on other sites

20 hours ago, dewin said:

I had no trouble building kOS in VS2015, you'll just need to update the assembly references to point at the relevant files in KSP\KSP_x64_Data\Managed.

And yes, the simple recompile should fix timewarp while you wait for 1.0.0.  I opted to not post my build here to avoid complicating things for the developers in the middle of the 1.0.0 release, but I did consider it.  (Timewarp broke because Squad added a new "optional" parameter to the function, but optional parameters in MSIL aren't actually optional at runtime -- they merely instruct the compiler what value it should put there instead.)

So the broken timewarp is the game cutting out of timewarp too early?

If that is that, please do post the recompile, as i am too lazy to just quickly learn how recompiling works :D

Devs are doing their great work, so if you post it, that might just keep the people having trouble with timewarp at bay.
 

Link to comment
Share on other sites

On 7/17/2016 at 10:59 PM, dewin said:

There's an IntelliJ kOS syntax plugin out there somewhere, among others -- see https://github.com/KSP-KOS/EditorTools

I can't get the IntelliJ plugin to work because the installation instructions aren't detailed enough or aren't exactly the same for the version of IntelliJ I downloaded and I'm not extremely damiliar with IntelliJ (more with Eclipse), but I also use Atom, Nano and sometimes Vim, so I'll take a look at those plugins too.

Link to comment
Share on other sites

4 hours ago, angrybold said:

So the broken timewarp is the game cutting out of timewarp too early?

If that is that, please do post the recompile, as i am too lazy to just quickly learn how recompiling works :D

Devs are doing their great work, so if you post it, that might just keep the people having trouble with timewarp at bay.
 

No, setting timewarp directly throws an error.  The WarpTo function still works fine, it's just `set warp to 2.` that fails.

I would ask that a recompile is not posted unless the version is modified to be lower than our existing version.  There are... complications that come with an unofficial release.  As GPL, people are certainly welcome to post their own copies, there isn't any restriction on it.  It just muddies the waters when we start getting support requests on something that we didn't release.  A simple reset of the version number would suffice though, as KSP prints the assembly version inside of the log file.  We would like to have some means of automatically publishing "nightly" builds, but as of yet I haven't found a good "free" option that doesn't clutter our git repository's tags and releases.

We just found another issue with the current build, but I promise that we're close to release of the next version and are working hard to get it into all of your hands.

25 minutes ago, Amedee said:

I can't get the IntelliJ plugin to work because the installation instructions aren't detailed enough or aren't exactly the same for the version of IntelliJ I downloaded and I'm not extremely damiliar with IntelliJ (more with Eclipse), but I also use Atom, Nano and sometimes Vim, so I'll take a look at those plugins too.

I highly recommend using this atom package: https://atom.io/packages/language-kerboscript it's not perfect, but it's pretty darn good.  

Link to comment
Share on other sites

5 hours ago, hvacengi said:

I would ask that a recompile is not posted unless the version is modified to be lower than our existing version.  There are... complications that come with an unofficial release.  [...]

This is precisely why I didn't post the recompile.  Well, that and I'd have to actually grab 0.20.1 to do it.  The reason I compiled kOS from source in the first place is for my own addon.

Link to comment
Share on other sites

I have just recently changed my launch script to regulate the TWR of the ship. All seemed well until yesterday I launched a old rocket that has the thrust limiter on the engines set around to 50% so that the SLT is 1.4. I usually set the thrust to be regulated at 1.8 but immediately after launch the throttle is set right back to 50%.

The thrust is being worked out like so :

LOCAL G IS body:mu / ((ship:altitude + body:radius)^2).
LOCAL MaxTWR IS ship:availablethrust / (G * ship:mass).

I printed out the value of MaxTWR so I could check it value and found that it was reporting the full thrust of the engines even though the thrust limiter was set.

After some investigation I found what the problem was. G was correct, ship:availablethrust was correct, ship:mass was correct but MaxTWR was not so I change the code to :

LOCAL G IS body:mu / ((ship:altitude + body:radius)^2).
local maxtwr is 0.
set MaxTWR to ship:availablethrust / (G * ship:mass).

And all is well.

Edited by BeafSalad
resolved
Link to comment
Share on other sites

I am going to try and be calm.  But seriously I am very upset.  I have just sat here for over half a day trying to simply make a test ship launch and then roll 90 degrees!  Because I would prefer not to send my astronauts to space SIDEWAYS!!!!!!!

But I have tried every conceivable way to make the ship roll and all I can manage to do it get it to PITCH around either the x, y, or z-axis!!!  I am a pilot and what kOS is calling pitch, roll, and yaw is not what I or any other pilot would call them!!!!

So how do I meaningfully control a ship from kOS?  Oh and by the way the documentation on control is really BAD.,  Anything that starts out saying ROTATION is DIRECTION and DIRECTION is ROTATION has me confused right from the start and seriously not single single example of instituting a roll program from launch! Really!

 

I mean for the love of god why should it be so hard to instruct the ship to roll ccw 90 degree about the longitudinal axis!

Edited by ctbram
Link to comment
Share on other sites

12 minutes ago, ctbram said:

Oh and by the way the documentation on control is really BAD.,  Anything that starts out saying ROTATION is DIRECTION and DIRECTION is ROTATION has me confused right from the start and seriously not single single example of instituting a roll program from launch! Really!

http://ksp-kos.github.io/KOS_DOC/tutorials/quickstart.html#step-6-now-to-make-it-turn

This tutorial shows you how to steer, including the use of heading which automatically set the "roll" "top" to be straight up away from the planet.  If you want more control to be able to adjust your roll program more carefully, you can use any of the other constructors to modify this value (I recommend using `lookdirup` and some kind of average between the current "roll" "top" and the target "top"):

http://ksp-kos.github.io/KOS_DOC/math/direction.html#creation

We respect your opinions of the quality of our documentation, but please be more constructive than simply saying it's bad identifying the 1st line of the 2nd paragraph as confusing.  Honestly, directions are a complex topic which makes them difficult to explain and document.  If you're looking for example code, I recommend looking at the subreddit which I find easier to search, and full of other users who are perfectly happy to answer your questions.  There are multiple examples posted there (either as tutorials, or users showing their own code) that could serve as models for you in this instance.

While we know that it isn't perfect, we are quite proud of how detailed our documentation is.  You should also look at the rest of the document, a failure to include something you are specifically looking for does not mean that the document as a whole is bad.  As a project where the developers dedicate their "free" time to working on the mod, we cannot possibly afford the time it would take for everything to be exactly perfect.  Instead of implying that we failed because we don't already answer your question, simply asking it would have been received better.

Link to comment
Share on other sites

3 hours ago, ctbram said:

I am going to try and be calm.  But seriously I am very upset.  I have just sat here for over half a day trying to simply make a test ship launch and then roll 90 degrees!  Because I would prefer not to send my astronauts to space SIDEWAYS!!!!!!!

But I have tried every conceivable way to make the ship roll and all I can manage to do it get it to PITCH around either the x, y, or z-axis!!!  I am a pilot and what kOS is calling pitch, roll, and yaw is not what I or any other pilot would call them!!!!

So how do I meaningfully control a ship from kOS?  Oh and by the way the documentation on control is really BAD.,  Anything that starts out saying ROTATION is DIRECTION and DIRECTION is ROTATION has me confused right from the start and seriously not single single example of instituting a roll program from launch! Really!

 

I mean for the love of god why should it be so hard to instruct the ship to roll ccw 90 degree about the longitudinal axis!

FWIW, I wound up doing this:

  lock launch_heading to heading(launch_dir,launch_pitch).

  lock steering to R(launch_heading:pitch, launch_heading:yaw, 180).

Most of the examples that showed doing a heading() * R() or vice versa never worked for me...  i'm not certain any more now why i used heading() and didn't use launch_dir and launch_pitch directly into R, but i haven't looked at this code for a couple of weeks...

Link to comment
Share on other sites

3 hours ago, ctbram said:

all I can manage to do it get it to PITCH around either the x, y, or z-axis!!!

Your error is in assuming there is only one thing that the phrase "x axis", or "y axis", or "z axis" could possibly mean, and that it must necessarily be in the vessels' own orientation.  It's not.  It's in the coordinate grid of the world space of the game, and it doesn't rotate with the vessel.  It's purely a coincidence that you got pitch to work - a coincidence caused by the fact that the planetary north pole happens to be oriented along one of the game space's axes, and KSP just happens to place the launchpad at the equator.

Our error (well, not ours, but the original mod author's, who's long gone now from participating and the mod is now being handled by other people), was in calling rotation around these axes by the names "pitch, yaw, and roll" when that's not what they are.  (Although to be fair he was inheriting those names from Unity itself which always confusingly uses those terms for any rotation around the axes, regardless of whether or not those axes happen to be being used for airplanes.)  Changing it now would break everyone's programs that were already written.

I had a longer answer written out addressing every point individually, but then I figured why bother and deleted it.  It ended up just being a repeat of what's already in that "bad" documentation you speak of. If saying it there didn't work. why would saying it here make any difference?

Here's the summary:  (1) If you know what you're doing, then just bypass kOS's own cooked control entirely and use raw control to move the controls to whatever position you want, and take on the responsibility of dealing with dampening things (PID control) yourself.  (2) If you want to use cooked steering for only where to point the nose, but then manually override how it chooses to point the roof, look for the thing called LOOKDIRUP().  It lets you pick one vector for your nose direction and a second vector for your "roof" direction".  Then look up ANGLEAXIS() which lets you roll any number of degrees around whichever axis you feel like (for example around your ship's forward facing vector).

 

Edited by Steven Mading
Link to comment
Share on other sites

In this topic I read about this site called Reddit, until now I thought that Reddit was only a platform for pr0n, harassment and hate speech, apparently there's more to it?

It's there that I found out about 2 addons for the kOS addon. It's addons all the way down?

This means that I need to follow yet another forum if I want to keep up with things... :-(

Link to comment
Share on other sites

Question:

How do you work out the velocity vector of Kerbin/Earth around the sun? I'm using SRSS and want to launch craft into the plane of the elliptic, and I want to do the cross vector of the position of earth and the velocity of earth in order to work it out, but I can't for the life of me work out how to calculate the vector for earths velocity around the sun, is there a way to do this? 

Link to comment
Share on other sites

2 minutes ago, Joe32320 said:

Question:

How do you work out the velocity vector of Kerbin/Earth around the sun? I'm using SRSS and want to launch craft into the plane of the elliptic, and I want to do the cross vector of the position of earth and the velocity of earth in order to work it out, but I can't for the life of me work out how to calculate the vector for earths velocity around the sun, is there a way to do this? 

Velocities are given relative to the SOI body of the vessel running the code.  Thus ship:body:velocity:orbit is always a zero vector.

But in general the generic solution to any "I don't know the frame of reference that was used to obtain these two vectors, how do I get one relative to the other" is to just subtract the origin vector from the non-origin one.

i.e. the position of A relative to B, if you assume both are in the same reference frame but you don't know which reference frame that is, is to just do the vector subtraction: set relPos to Apos - Bpos.

Similarly, you can do the same with velocities:  The velocity of Kerbin relative to the Sun should be: set relVel to Kerbin:velocity:orbit - Sun:velocity:orbit.

Caveat: I haven't tested this.

Link to comment
Share on other sites

15 minutes ago, Steven Mading said:

Velocities are given relative to the SOI body of the vessel running the code.  Thus ship:body:velocity:orbit is always a zero vector.

But in general the generic solution to any "I don't know the frame of reference that was used to obtain these two vectors, how do I get one relative to the other" is to just subtract the origin vector from the non-origin one.

i.e. the position of A relative to B, if you assume both are in the same reference frame but you don't know which reference frame that is, is to just do the vector subtraction: set relPos to Apos - Bpos.

Similarly, you can do the same with velocities:  The velocity of Kerbin relative to the Sun should be: set relVel to Kerbin:velocity:orbit - Sun:velocity:orbit.

Caveat: I haven't tested this.

Yeah, I tried that first, but got some weird results:

http://i.imgur.com/7WbWu7d.png

Picture probably explains it best, IDK if I've made a mistake, but thats the direction those arrows seem to be in. The position to the sun does seem to work, though strictly speaking in that example, I didn't do sun:position-earth:position for it to point from the centre of earth to the sun.

Link to comment
Share on other sites

2 hours ago, Joe32320 said:

Picture probably explains it best, IDK if I've made a mistake, but thats the direction those arrows seem to be in. The position to the sun does seem to work, though strictly speaking in that example, I didn't do sun:position-earth:position for it to point from the centre of earth to the sun.

Not your fault.  You've discovered a bug.  I made an issue for it here, which you should have a look at to see the detailed description of the problem:

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

If you need an immediate workaround, you can swap the Y and Z axes of the vector you get back from SUN:VELOCITY:ORBIT (but only that one, not the other body's velocities), as shown in the screenshot accompanying the bug report link above.

If you do use that workaround, be aware that it's likely something we'll fix in a later release so be on the lookout for that in the release notes of future releases so you can un-swap them once it's fixed in the mod itself.

 

Link to comment
Share on other sites

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