Jump to content

My First Fully Autonomous Ship (KOS)


KASA Space

Recommended Posts

So after a few hours of fiddling and a lot of headscratching to find out how KOS really worked, I was able to scrap together a fully custom script that sent my rocket into orbit without any intervention (except, in the video, I did have to jettison the fairing and open the panels manually, but the ship would have orbited regardless).

Here you go!

 

Link to comment
Share on other sites

SAS ON.
LOCK THROTTLE TO 1.
STAGE.
CLEARSCREEN.
PRINT "LAUNCHING!".
WAIT UNTIL ALTITUDE > 2000.
LOCK STEERING TO HEADING(90,80).
PRINT "Pitching to 80d".
WAIT UNTIL ALTITUDE > 3000.
LOCK STEERING TO HEADING(90,75).
PRINT "Pitching to 75d".
WAIT UNTIL ALTITUDE > 5000.
LOCK STEERING TO HEADING(90, 70).
PRINT "Pitching to 70d".
WAIT UNTIL ALTITUDE > 7000.
LOCK STEERING TO HEADING(90, 65).
PRINT "Pitching to 65d".
WAIT UNTIL ALTITUDE > 9500.
LOCK STEERING TO HEADING(90, 60).
PRINT "Pitching to 60d".
WAIT UNTIL ALTITUDE > 11000.
LOCK STEERING TO HEADING(90, 50).
PRINT "Pitching to 50d".
WAIT UNTIL ALTITUDE > 15000.
LOCK STEERING TO HEADING(90, 45).
PRINT "PITCHING TO 45d".
WAIT UNTIL MAXTHRUST = 0.
WAIT 1.
PRINT "STAGED".
STAGE.
PRINT "STAGE 2 ACTIVATED".
WAIT UNTIL APOAPSIS > 75000.
LOCK THROTTLE TO 0.
WAIT 0.5.
LOCK THROTTLE TO 0.
PRINT "Coasting to OIB".
WAIT 1.
SET WARPMODE TO "PHYSICS".
SET WARP TO 4.
PRINT "Time Warping".
WAIT UNTIL ETA:APOAPSIS < 20.
SET WARP TO 0.
LOCK STEERING TO HEADING(90, 15).
LOCK THROTTLE TO 0.9.
SET vThrottle to 0.9.

WHEN ETA:APOAPSIS < 5 THEN {
	IF vThrottle < 0.5 {
		SET vThrottle to vThrottle + 0.1.
		LOCK THROTTLE TO vThrottle.
	}
	PRESERVE.
}

WHEN ETA:APOAPSIS > 20 THEN {
	IF vThrottle > 0 {
		SET vThrottle to vThrottle - 0.1.
		LOCK THROTTLE TO vThrottle.
	}
	PRESERVE.
}

WHEN PERIAPSIS > -100000 THEN {
  LOCK STEERING TO HEADING(90,5).
}
WHEN PERIAPSIS > -20000 THEN {
  LOCK STEERING TO HEADING(90,1).
}
	
WAIT UNTIL PERIAPSIS > 70000.
PRINT "ORBIT!".
LOCK THROTTLE TO 0.
WAIT 1.
LOCK THROTTLE TO 0.
UNLOCK ALL.

This script works best with 2 stage vehicles where the first stage has a starting TWR between 1.10 and 1.25, but best sits at like 1.19. The first stage should be able to make it above 15km, and beyond that, the second stage just has to be able to orbit after that.

 

Enjoy!

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