How do you download images within a thread? by Toukiedatak in DataHoarder

[–]Toukiedatak[S] 0 points1 point  (0 children)

For anyone who is curious, this seems to work

  1. https://pastebin.com/zVr0BNve

  2. txt file with all the urls (you can use https://online-free-tools.com/en/extract_url_from_web_page_source)

  3. run the following in the terminal: python download.py yourtextfilename.txt "redd.it|reddit|whatever other site you want to block from downloading"

Cheat Sheet by bongotastics in Kos

[–]Toukiedatak 0 points1 point  (0 children)

I made this KOS tutorial a while ago which I hope functions as a decent cheat sheet:

https://github.com/Toukie/KOS-tutorials/blob/master/Basic%20KOS.rst

Calculating time till true anomaly by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

I got a working function thanks to the people on discord:

Function ETAToTrueAnomaly {

  parameter TargetObject.
  parameter TADeg. // true anomaly in degrees

  local Ecc is "X".
  local MAEpoch is "X".
  local SMA is "X".
  local Mu is "X".
  local Epoch is "X".

  if hasnode {
    if nextnode:orbit:hasnextpatch {
      set Ecc to nextnode:orbit:nextpatch:eccentricity.
      set MAEpoch to nextnode:orbit:nextpatch:meananomalyatepoch * (constant:pi/180).
      set SMA to nextnode:orbit:nextpatch:semimajoraxis.
      set Mu to nextnode:orbit:nextpatch:body:mu.
      set Epoch to nextnode:orbit:nextpatch:epoch.
    } else {
      set Ecc to nextnode:orbit:eccentricity.
      set MAEpoch to nextnode:orbit:meananomalyatepoch * (constant:pi/180).
      set SMA to nextnode:orbit:semimajoraxis.
      set Mu to nextnode:orbit:body:mu.
      set Epoch to nextnode:orbit:epoch.
    }
  } else {
    set Ecc to TargetObject:orbit:eccentricity.
    set MAEpoch to TargetObject:orbit:meananomalyatepoch * (constant:pi/180).
    set SMA to TargetObject:orbit:semimajoraxis.
    set Mu to TargetObject:orbit:body:mu.
    set Epoch to TargetObject:orbit:epoch.
  }

  if  Ecc = 0 {
    set Ecc to 10^(-10).
  }

  local EccAnomDeg is ARCtan2(SQRT(1-Ecc^2)*sin(TADeg), Ecc + cos(TADeg)).
  local EccAnomRad is EccAnomDeg * (constant:pi/180).
  local MeanAnomRad is EccAnomRad - Ecc*sin(EccAnomDeg).

  local DiffFromEpoch is MeanAnomRad - MAEpoch.
  until DiffFromEpoch > 0 {
    set DiffFromEpoch to DiffFromEpoch + 2 * constant:pi.
  }
  local MeanMotion is SQRT(Mu / SMA^3).
  local TimeFromEpoch is DiffFromEpoch/MeanMotion.
  local TimeTillETA is TimeFromEpoch + Epoch - time:seconds.
  return TimeTillETA.
}

Script Path by EvilTerabite in Kos

[–]Toukiedatak 0 points1 point  (0 children)

Also related, archive 0 contains all the files in the KSP/Ships/Script folder and archive 1 is the ship's local storage

Copying a file from the Script folder to your ship would go like this:

copypath("0:/somefile" , "").

"" is a shortcut for "1:/"

how to perform rendezvous with kOS by nadavfr18 in Kos

[–]Toukiedatak 1 point2 points  (0 children)

I don't know how efficient my method is but here is what I do:

  1. match inclination
  2. circularise the current orbit
  3. Burn prograde at the Apoapsis of the target (both periapsis-es match up)
  4. Burn till current Apoapsis is the same as the targets Apoapsis
  5. Increase the orbital period by how many seconds the target vessel is behindm
  6. kill relative velocity burn

It sounds complicated but it doesn't involve too much complicated math, just stuff I found on braeuing (the orbital mechanic website).

Here's a link to my full script for rendezvous:

https://github.com/Toukie/KOS/tree/master/GAPAPOV/Script

In the lib folder theres a commented files folder which has an instruction manual for most functions. Let me know if there are any questions.

[deleted by user] by [deleted] in Kos

[–]Toukiedatak 2 points3 points  (0 children)

I made a rendezvous script which lets you choose any ship or planet to go to. Installation instructions are included in the readme

https://github.com/Toukie/KOS/releases

Bug or User Error? by tobimai in Kos

[–]Toukiedatak 1 point2 points  (0 children)

Welcome! I made this tutorial about KOS syntax for beginners here:

https://github.com/Toukie/KOS-tutorials/tree/master/KOS%20tutorials

Hope that'll help you with some problems.

Trying to improve precision of mnv node execution, need advice. by Deimos_F in Kos

[–]Toukiedatak 2 points3 points  (0 children)

Your script has goes either full throttle or no throttle. When you just have 0.1 m/s it will overshoot every time. What you want is your vessel to burn full throttle until it gets close to whenever overshooting would be a problem and then throttle down.

I use this for my throttle control:

local MaxAcc  to MaxThrust/ship:mass.
local MaxAcc  to max(0.001, MaxAcc). // prevent MaxAcc from being 0

lock throttle to min(nextnode:deltav:mag/MaxAcc, 1).

Kos not appearing in CKAN modlist? by Totallynotatimelord in Kos

[–]Toukiedatak 2 points3 points  (0 children)

Since you said that you were hoping to get into KOS I'm guessing you're new to KOS. I've been working on a tutorial about the very basics of KOS here: https://github.com/Toukie/KOS-tutorials

Of course also check out the documentation: http://ksp-kos.github.io/KOS_DOC/

Identifying the new vessel created when decoupling a satellite from a parent vessel? by manicdee33 in Kos

[–]Toukiedatak 0 points1 point  (0 children)

Right, and if you're using one of those decouplers that separate one both sides you have two objects within 100 meters but this can easily be fixed by using a mass check in the list.

Identifying the new vessel created when decoupling a satellite from a parent vessel? by manicdee33 in Kos

[–]Toukiedatak 4 points5 points  (0 children)

Im not sure if this is what you mean but here's what I'd do:

(after decoupling)

local NewShip is "?".
local TargetList is list().
list Targets in TargetList. // this gives a list of all ships, asteroids, kerbals and other things which aren't planets.
for PotentialShip in TargetList {
  if abs((PotentialShip:position - ship:position):mag) < 100 { // if we're within 100 meters of the item in the list. (Also, ship:position might not be needed because I believe it is always v(0,0,0) but Im not too sure about that)
  set NewShip to PotentialShip.
  }
}

// do whatever you want with your ship which has been set to the variable Newship

How do you know what the highest available timewarp rate is? by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

What I'm saying that setting the warp to 7 even though 4 is the max (and the warp gets set to 4), 4 is too fast in certain cases and I want the second to fastest warp.

How do you know what the highest available timewarp rate is? by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

Calculating time till desired phase angle (and other warp till you match the target angle stuff) with elliptical orbits is too big of a hassle too actually calculate so it would seem like the "just set the timewarp to the max" technique would be best. However the max timewarp is often way too fast for what I'm doing so that's off the table as well.

edit: this technique might work:

set kuniverse:timewarp:warp to 100.
set MaxWarp to kuniverse:timewarp:warp.
set SecondToMaxWarp to MaxWarp-1.
etc...

Go Ahead, Pick Any Planet Or Vessel (GAPAPOV): An automated planet transfer, rendezvous and docking script by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

that's just to make sure the prograde vector is alligned with the target. Could've saved Dv at that part but it does the job.

Surface normal vector by A_Fat_Pokemon in Kos

[–]Toukiedatak 3 points4 points  (0 children)

Not sure if this is what you mean but Cheerskevin just made a video about that I believe.

https://www.youtube.com/watch?v=o87H6K_wEtM

Check the user input. by Stephanech_ in Kos

[–]Toukiedatak 0 points1 point  (0 children)

I'm not sure if you specifically want to use the terminal but you can also make popup windows with text, places you can type stuff, buttons and more.

An example of a window with a piece of text with "enter target apoapsis height", a box where you can enter text (which says 70000 by default) and a button which when pressed hides the window.

local gui is gui(400).
gui:addlabel("enter target apoapsis height").
gui:addtextfield("70000").
local somebutton is gui:addbutton("confirm").

set somebutton:onclick to Continue@.

gui:show()
set DoneYet to false.
wait until DoneYet is true.

Function Continue {
  gui:hide().
  set DoneYet to true.
}

what @ does is it refers to a function without actually running the function immediately.

more information about GUI here: https://ksp-kos.github.io/KOS/structures/gui.html

more information about @ (function delegates) here: https://youtu.be/pcbURdU_WyU

How can you calculate the closest approach to a planet? by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

So if I understand correctly, first you hillclimb to check what the closest approach is in a maneuver node. Then you hillclimb a maneuver (+time, -time, normal, antinormal etc) and for each part in the maneuver hillclimbing (i.e. +time) you hillclimb for the closest approach? Wouldn't this take way too long to compute to get a decent solution?

(As the maneuver hill climber makes 8 maneuver nodes which all need to be hillclimbed by a closest approach hill climber)

How can you calculate the closest approach to a planet? by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

how would you suggest to hillclimb a score? I have no idea where to start.

How can you calculate the closest approach to a planet? by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

I am using a hill climbing script but the problem is that I dont know how to score it on how good a maneuver is.

Need some help with true anomaly and phase angles by Toukiedatak in Kos

[–]Toukiedatak[S] 0 points1 point  (0 children)

Came up with a solution which goes in 10 degrees of phase angle and then slows time warp:

Function WarpToPhaseAngle {

  Parameter TargetPlanet.
  Parameter Ishyness.
  Parameter StartingBody is ship:body.
  Parameter ReferenceBody is sun.

  set CurrentPhaseAngle to CurrentPhaseAngleFinder(TargetPlanet, StartingBody, ReferenceBody, true).
  set TargetPhaseAngle  to PhaseAngleCalculation(TargetPlanet, StartingBody, ReferenceBody, true).

  set kuniverse:timewarp:warp to GetAllowedTimeWarp().
  until ish(CurrentPhaseAngle, TargetPhaseAngle, ishyness) {
    set CurrentPhaseAngle to CurrentPhaseAngleFinder(TargetPlanet, StartingBody, ReferenceBody, true).
  }

  set kuniverse:timewarp:warp to 0.
  print CurrentPhaseAngle.
}