Drew Kerman

[kOS 0.18.2 Script] RCS Thrust Controller (v4.0) - automated maneuver node execution

Recommended Posts

 

 

J03fW7K.png

Download Latest Release
(v4.0 - 12/23/15)
O7ApvZQ.png

What RCS Thrust Controller Does

This fills a gap in the Remote Tech flight computer, which does not allow you to execute maneuvers using RCS thrust. On some small craft, this may be all that you have available. While you are out of contact or dealing with signal delay, performing maneuvers can be difficult or downright impossible. This script will use your next planned maneuver node and carry it out at the proper time.

What RCS Thrust Controller Doesn't

This does not attempt to replace any functionality that already exists with the RT2 Flight Computer. You still have to use the FC to properly orient your craft for the burn. This also does not automatically read all the properties of the thrusters on your craft.

Usage

Full instructions are provided in the ReadMe included. Obviously you need to download and install kOS.

F.A.Q.

Q: This isn't a stand-alone mod? Why?

A: Mainly because I'm too lazy to setup a C# dev environment when one already exists for me within the game. Also, because it's way more fun IMO doing it this way as opposed to "normal" programming I've done way too much of already.

Q: But I don't know anything about kOS!

A: Thankfully, you don't really need to. The numbers you need to tweak are well-exposed and documented, and using kOS within the game is very simple

Q: Can it be used for any vehicle?

A: Any vehicle that has a kOS computer module to hold the scripts.

Q: Can it be used for kerbed vehicles?

A: Yes! While primarily designed for remote-operated vehicles it will still function just fine under Local Command situations.

Known Issues

  • Regardless of whether you are using an actual kOS part or are using Module Manager to insert kOS functionality into another part (like a probe core) it must not be a root part of the craft. This is a known kOS issue
  • The future node created by the script is there to avoid a run-time error that needs to be patched within kOS
  • The future node initially has a radial out value to push it off the current orbit so that it can be selected by the user to place a node before it
  • RCS tweakable will only let you set the thrust as low as 5 before going straight to 0 (which RCSTC will reset to 1)

Future Additions

  • Thruster kN Detection - Will allow the option to not have to set the kN variable manually
  • Multiple ISP Thrusters - Allow for thrusters that don't all have the same ISP
  • Multiple kN Thrusters - Allow for thrusters that don't all have the same kN

Change Log

(12/23/15) v4.0
- RCS thrust tweakable is now stock, meaning a single thrust control script is all that is needed, Tweakable Everything is no longer an optional dependency
- All detected RCS parts are temporarily highlighted to show which are enabled (green) and disabled (red) to help confirm craft configuration
- Console window text no longer overwrites itself under some situations
- RCS jet blip on initialization no longer necessary to get ISP number to show in right-click menu
- Tweakable is back to using decimal numbers instead of percentage

(10/20/15) v3.2
- Fixed the non-TE version from still trying to use TE to set the thrust initially
- Added a check for time warp, and drops the game out of warp to initialize the thrusters because otherwise they would not fire to register ISP
- Improved performance by removing the need to call `getModule()` multiple times every tick, which caused kOS to navigate the entire part tree each time. Possibly also improved the timing of very short burns that require millisecond precision

(9/2/15) v3.1
- Full RemoteTech support enabled through kOS `addons` interface. RT features disabled if it is not installed/activated
- Abort command now respects signal delay
- Program now respects local control
- Functionalized main loop for cleaner exit on abort/errors - no more shutting down the console
- Warning message displays if user manually enables RCS prior to the maneuver
- Fix for runtime error if user manually enables RCS prior to maneuver
- Fix for changes to TweakableEverything slider, which now has percentage values instead of decimal

(3/16/15) v2.1
- Fixed an issue where Tweakable Everything can allow you to tweak thrust  to 0%, which the program doesn't like. Tweaking the thrust to 0% (or  setting it to 0% with the non-TE version) will change it to 1%

(3/14/15) v2.0
- Script extension changed to conform to new kOS architecture
- Uses new HUD message capability to present thruster info and maneuver warnings
- Checks for connection to Mission Control before executing (bypassable)
- No longer requires ISP and throttle to be set in hardcode or at runtime (latter depends on use of Tweakable Everything)
- Maneuver nodes are now monitored and changes can be made to ÃŽâ€v, ETA and throttle anytime prior to node execution
- No longer needs a maneuver node to be created prior to execution
- Cancelling maneuver nodes no longer terminates the program
- The Abort button is used to terminate the program
- Time warp is monitored and will drop out 10 seconds prior to node execution

(9/10/14) v1.1
- Thanks to TDW, cleaned up countdown code which means program runs on less lines for users that have limited kOS storage space
- Added ability to detect how much ÃŽâ€v the craft has remaining and warn the user if it is not enough to perform the maneuver
- Tweaked messages of ÃŽâ€v to include "m/s" for clarity

(9/5/14) v1
- Initial release 

 

Edited by Gaiiden
version update

Share this post


Link to post
Share on other sites

Looks good.

Don't know if it was deliberate or not but you don't seam to have anything to align the craft to the maneuver node and hold it steady also you may want to look at

PRINT timeRemaining:CLOCK AT (29,3).

(KOS_DOC) if you are looking to shorten the script. You should also be able to loop that to keep the time to burn up to date.

Share this post


Link to post
Share on other sites
Don't know if it was deliberate or not but you don't seam to have anything to align the craft to the maneuver node and hold it steady

It's deliberate and covered fully in the ReadMe. It wasn't stated outright in the description above but "This does not attempt to replace any functionality that already exists with the RT2 Flight Computer" essentially means that it does not attempt to point your vessel, as that is what the Flight Computer is for.

also you may want to look at
PRINT timeRemaining:CLOCK AT (29,3).

(KOS_DOC) if you are looking to shorten the script. You should also be able to loop that to keep the time to burn up to date.

Nope, that won't work - although it is a good idea! I never really thought about that, unfortunately after checking the docs I see nextnode:eta returns just a plain Number, not a Timespan.

Share this post


Link to post
Share on other sites

Well that will teach me for not reading the post or the readme properly :blush:.

Work round on the clock issue would be:


LOCK timeRemaining to (time + nextnode:eta - (thrustLength/2)) - time.
Print timeRemaining:Clock AT (29,3).

its not as tidy but it does force timeReamaining into a time instead of a number.

Also if/when you look at reading the RCS ISPs you will (at least in the current version of KSP) need to add a check for an isp of 0. For some reason RCS ISPs read as 0.0 until after you fire them for the first time.

Share this post


Link to post
Share on other sites

Awesome, thanks for that code, and the heads up on ISP. In addition, I realized I was missing something to tell people they were about to perform a maneuver without enough ÃŽâ€v remaining.

Share this post


Link to post
Share on other sites

shiny new features! Still not all the way to where I'd like it to be but kOS limitations continue to hold me back. That was the way it was with 1.0 though and look how far it's come. kOS continues to improve and therefore so will this.

- Script extension changed to conform to new kOS architecture
- Uses new HUD message capability to present thruster info and maneuver warnings
- Checks for connection to Mission Control before executing (bypassable)
- No longer requires ISP and throttle to be set in hardcode or at runtime (latter depends on use of Tweakable Everything)
- Maneuver nodes are now monitored and changes can be made to ÃŽâ€v, ETA and throttle anytime prior to node execution
- No longer needs a maneuver node to be created prior to execution
- Cancelling maneuver nodes no longer terminates the program
- The Abort button is used to terminate the program
- Time warp is monitored and will drop out 10 seconds prior to node execution

Share this post


Link to post
Share on other sites

whoops! Forgot to test what happens when you tweak the thrust all the way down... turns out you can't go to 1%...

Share this post


Link to post
Share on other sites

I've not been able to test since my 1.0.2 install is still under construction. But I did not notice any breaking changes in the latest kOS release that should cause any problems, and RCS thrusters didn't undergo any breaking changes themselves with 1.0.2 that I know of. Should all still be good!

Further Update: I won't be playing KSP seriously again until v1.1 drops, so don't expect any work on this script until then

Edited by Gaiiden

Share this post


Link to post
Share on other sites

New hotness!! Advanced RT features and better usability

v3.1

- Full RemoteTech support enabled through kOS addons interface. RT features disabled if it is not installed/activated

- Abort command now respects signal delay

- Program now respects local control

- Functionalized main loop for cleaner exit on abort/errors - no more shutting down the console

- Warning message displays if user manually enables RCS prior to the maneuver

- Fix for runtime error if user manually enables RCS prior to maneuver

- Fix for changes to TweakableEverything slider, which now has percentage values instead of decimal

Share this post


Link to post
Share on other sites

An important performance update that could help improve the accuracy of maneuvers that require millisecond timing

v3.2

- Fixed the non-TE version from still trying to use TE to set the thrust initially

- Added a check for time warp, and drops the game out of warp to initialize the thrusters because otherwise they would not fire to register ISP

- Improved performance by removing the need to call getModule() multiple times every tick, which caused kOS to navigate the entire part tree each time. Possibly also improved the timing of very short burns that require millisecond precision

Share this post


Link to post
Share on other sites

Hooray for v1.0.5 stock RCS thrust tweakables!

v4.0

  • RCS thrust tweakable is now stock, meaning a single thrust control script is all that is needed, Tweakable Everything is no longer an optional dependency
  • All detected RCS parts are temporarily highlighted to show which are enabled (green) and disabled (red) to help confirm craft configuration
  • Console window text no longer overwrites itself under some situations
  • RCS jet blip on initialization no longer necessary to get ISP number to show in right-click menu
  • Tweakable is back to using decimal numbers instead of percentage

Download from Github

Share this post


Link to post
Share on other sites
1 hour ago, Gaiiden said:

Hooray for v1.0.5 stock RCS thrust tweakables!

v4.0

  • RCS thrust tweakable is now stock, meaning a single thrust control script is all that is needed, Tweakable Everything is no longer an optional dependency
  • All detected RCS parts are temporarily highlighted to show which are enabled (green) and disabled (red) to help confirm craft configuration
  • Console window text no longer overwrites itself under some situations
  • RCS jet blip on initialization no longer necessary to get ISP number to show in right-click menu
  • Tweakable is back to using decimal numbers instead of percentage

Download from Github

Doesent mechjeb have a sort of something similiar, where u can toggle throttle controlling RCS or something, but im not sure if its compatible with RT. probably cant plot manuever nodes with it, either.

Share this post


Link to post
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.