Jump to content

KOS: Scripted panels, parachutes and remote tech


inoculator

Recommended Posts

Hi all,

just a short link to a functional script I wrote.

Hope it helps anybody.

Have fun to use it.

https://drive.google.com/file/d/1HYVjI_sNvVdbnFuCrrL6N2fx6aAO8piR/view?usp=sharing

just put it as loader in the head of your script:
e.g.: runpath("0:/functions/check_special_parts.ks").

The script consists of 4 functions, that are similar in their concept:

If You call the function, it will return a value depending on the parts it scans and finds.
You can call the function with parameter "arm" to trigger the parts in question.
The idea of the script is for helping on automated launches with dynamicaly activate parts and no need of a seperate script for each.
The script is written with "remote tech" installed and active.

Here a short walkthough:

"check_chutes"

set test to check_chutes().
print "found " + test[0] + " drogue and " + test[1] + " regular parachutes".
//deploy all safe to deploy chutes
set test to check_chutes("arm").
print "found " + test[0] + " drogue and " + test[1] + " regular parachutes remaining for deploy".

My usage (as a snipplet of my launch script):
 

[.....a lot of other code ....]

//pre flight check
set THIS_CHUTES to CHECK_CHUTES().
if THIS_CHUTES[1] = 0 {  //We have no chutes for landing
	clearscreen.
	print "W A R N I N G" at(5,6).
	print "We have no Parachutes for Landing !" at (2,8).
	print "I will disable deorbiting in any case." at (2,10).
	print "Are You sure to continue ?" at (2,12).
	print "Press CRS UP to continue or CRS DWN to cancel" at(2,14).
	set PAR_DEORBIT to 0.
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "cancel" {
		set core:bootfilename to "".
		reboot.
	}	
}

[.....a lot of other code ....]

// landing runmode
if RUNMODE=9 {//reentry the last stage parachutes
	if RUNMODEINIT=0 {
		set RUNMODEINIT to 1.
		set RUNMODESTATUS to "Waiting for Parachutes".
	}
	if alt:radar<10000 {
		set THIS_CHUTES to CHECK_CHUTES("arm").
		if THIS_CHUTES[0] = 0 and THIS_CHUTES[1]=0 {
			set RUNMODE to 99.
		}
	}
}

[.....a lot of other code ....]

"CHECK_HULLS" -a protective shell must be tagged with "HULL" to be recognized here.

set test to check_hulls().
print "Found " + test + " protective shells marked for deployment."
set test to check_hulls("arm").
print "Found " + test + " protective shells remaining marked for deployment."

And my usage:

 

[.... a lot of code ....]

set THIS_HULLS to CHECK_HULLS().
if THIS_HULLS>0 {
	clearscreen.
	print "A T T E N T I O N" at(5,6).
	print "Found " + THIS_HULLS + " protective shells" at(2,8).
	Print "For shell deployment at 70000m press" at(2,10).
	print "CRS UP otherwise CRSDWN" at(2,12).
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "ok" {
		when altitude > 70000 THEN {CHECK_HULLS("arm").}
	}	
}

[... a lot of other code ...]

And now Solar panels and Remote Antennas.
Here I introduce the tag "noauto". If You tag a solar panel or an antenna with "noauto" it will not be set to automatic deployment.
This protects objects from being deployed at the wrong time (e.g. covered satellites in protective shells not deployed during launch).

"CHECK_SOLARS"
 

set test to CHECK_SOLARS().
print "Found " + test[0] + " static, " + test[1] + " deployable and " + test[2] + " panels set to 'noauto'".
set test to CHECK_SOLARS("arm").
print "Found " + test[0] + " static, " + test[1] + " deployable and " + test[2] + " panels set to 'noauto'".

and here my usage:
 

[... again a lot of code ...]

set THIS_SOLARS to CHECK_SOLARS().
if THIS_SOLARS[0]=0 and THIS_SOLARS[1]=0 and THIS_SOLARS[2]=0 {
	clearscreen.
	print "W A R N I N G" at(5,6).
	print "No Solar Panels found !" at (2,8).
	print "Are You sure to continue ?" at (2,12).
	print "Press CRS UP to continue or CRS DWN to cancel" at(2,14).
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "cancel" {
		set core:bootfilename to "".
		reboot.
	} 
}

if THIS_SOLARS[1] > 0 {
	clearscreen.
	print "A T T E N T I O N" at(5,6).
	print "Found " + THIS_SOLARS[1] + " solar panels to deploy." at(2,8).
	Print "For deployment at 70000m press" at(2,10).
	print "CRS UP otherwise CRSDWN" at(2,12).
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "ok" {
		when altitude > 70000 THEN {CHECK_SOLARS("arm").}
	}	
}

[... and guess what.. just more code...]

And to make a long story short, here is the adopted version for antennas (just usage):
 

[... yes again previously there is code...]

set THIS_REMOTE to CHECK_REMOTE().
if THIS_REMOTE[0]=0 and THIS_REMOTE[1]=0 and THIS_REMOTE[2]=0 {
	clearscreen.
	print "W A R N I N G" at(5,6).
	print "No Antennas found !" at (2,8).
	print "Are You sure to continue ?" at (2,12).
	print "Press CRS UP to continue or CRS DWN to cancel" at(2,14).
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "cancel" {
		set core:bootfilename to "".
		reboot.
	} 
}

if THIS_REMOTE[1] > 0 {
	clearscreen.
	print "A T T E N T I O N" at(5,6).
	print "Found " + THIS_REMOTE[1] + " Antennas to deploy." at(2,8).
	Print "For deployment at 70000m press" at(2,10).
	print "CRS UP otherwise CRSDWN" at(2,12).
	set THIS_GETKEY to 0.
	Until THIS_GETKEY<>0 {set THIS_GETKEY to GET_KEY(). wait 0.1.}
	if THIS_GETKEY = "ok" {
		when altitude > 70000 THEN {CHECK_REMOTE("arm").}
	}	
}

[... code, you know...]

 

as allready said: have fun with it.

br

Carsten

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