Jump to content

kOS - 3 simple questions


Recommended Posts

Hey everyone,

I am using kOS autopilot in RO and have three little questions, as I have no experience in programming.

1.: Upon Launch I lock my steering to UP. When passing a certain vertical speed, I lock my steering to heading (90:80) - pitching down by 10 degrees. Now I want to wait until the SAS-prograde-pitch is less than 80° and lock my steering to SAS-prograde.

How do I express the "SAS prograde pitch" and "SAS prograde yaw"? Something like:

 

LOCK STEERING TO HEADING (90:80).

WHEN "SASprogradepitch" is < 80 THEN SAS ON.

SET SASMODE TO PROGRADE.

LOCK STEERING TO SAS.

is what I am looking for.

 

2.: Which command toggles the button above the navball - changing the navball reference to surface,orbit or target?

3. Are there acronyms for "pitch" and "yaw" "pitch/yaw with reference to orbit" and "pitch/yaw with reference to surface"?

 

I could not find anything in the manaul.

Thanks for your answers

Link to comment
Share on other sites

(1) - The function call : VANG(ship:up:vector, ship:srfprograde:vector) will give you the angle between straight up and your surface-prograde vector.  (I assume you want surface and not orbital here).  So, for example, a pitch of 80 would mean there is 10 degrees angle between up and prograde.  If you do 90 - VANG(ship:up:vector, ship:srfprograde:vector) then you should get the pitch number you are looking for.

(2) - There is no such thing in kOS.  Instead you can explicitly mention which you are interested in because prograde comes in two varieties - surface and orbital.  You can say srfprograde for surface, or just prograde for orbital.  You can say ship:velocity:surface or ship:velocity:orbit to get velocity vectors in the two frames.  For target-relative there isn't a shortcut, but you can always subtract your target's velocity vector from your velocity vector to get the same thing the navball would have shown you in target mode.

(3) - Not really.  But if you want this kind of information, look at lib/navball in the community library.  It's possible to get this information with a few lines of kOS script code and this example shows how.
The documentation describing the functions is here: https://github.com/KSP-KOS/KSLib/blob/master/doc/lib_navball.md
The actual functions themselves are here: https://github.com/KSP-KOS/KSLib/blob/master/library/lib_navball.ks

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...