Jump to content

How to write continuous-thrust auto-hover with stock jets in KOS?


Recommended Posts

I've messed around with apoapsis-prediction, suicide-burns, PID, variants of PID, throttle-predicting algorithms, etc, and none of them seem to have quite the effect that you get from B9's auto-hover jets. Do B9's jets cutoff throttle like a good physics-predicting PID does?

To be sure, my rocket auto-hover is dead-perfect accurate, I can just sit under the tunnel neither touching the ceiling nor the floor and it stabilizes to within millimeters for any rocket over 2 G of thrust. My cut-off jet auto-hover is decent as well, rarely going significantly above hover height and usually slowing itself down after a fall to within only a few meters to a few tens of meters below hover height depending on the fall distance, and stabilizing to within 30 centimeters of hover height.

But... my continuous-operation, I.E. no toggling the engine and intake to cut the thrust instantly to 0, jet auto-hovering could use work. I have one variant which feels more like flying a K-drive than a VTOL (Flying up at a fraction of a m/s and gaining altitude coming out of a lean), 1 variant which will often over-fly by a hundred meters, and one which usually gets within a few meters, but wobbles about the hover point a lot and never comes to a meter-accurate stop and really doesn't like dealing with hills of any sort.

Any idea how to make pinpoint-accurate auto-hover for the basic jets or other engines that spool up and down without annoyingly flashing them on and off like a madman? Is it possible with KOS? Is it just like regular VTOL-flight by finding the hover point and having to fly cautiously and slowly and wait for the engines to spool?

BTW, simple PID and physics-predicting c1*P+c2*I^0.5+c3*D^2 don't seem to work. They go off by potentially kilometers before the spooling catches up.

Edited by Pds314
Link to comment
Share on other sites

The spooling makes this nearly impossible because controlling power output through pulse-width modulation is the easiest and most accurate method... however, spooling makes pulse-width modulation impossible (it relies on the existence of a well defined on/off threshold. The only way to get a jet to hover is by managing TWR to be close to 1.

For a VTOL vehicle you don't need to hover really, just get the amount of thrust right for each vehicle. I use infernal robotics and create an osprey-like craft that tends to work pretty well if it's balanced properly.

Link to comment
Share on other sites

The spooling makes this nearly impossible because controlling power output through pulse-width modulation is the easiest and most accurate method... however, spooling makes pulse-width modulation impossible (it relies on the existence of a well defined on/off threshold. The only way to get a jet to hover is by managing TWR to be close to 1.

For a VTOL vehicle you don't need to hover really, just get the amount of thrust right for each vehicle. I use infernal robotics and create an osprey-like craft that tends to work pretty well if it's balanced properly.

Hmm.. I know I've seen humans who seem to be able to jump-hover to arbitrary altitude with VTOLs and accurately get to the right altitude without cutting the engines.

Of course, writing a human is not exactly easy to do, especially in KOS.

Link to comment
Share on other sites

I really can't think of anything more helpful. You might try using raw control mode with a feedback loop to try to emulate human control. Just try to do it without kOS, pay attention to what you do with throttle, pitch, etc... then try to emulate that in a script. I use a script i call "datarecorder" to help with this, it logs all the relevant data (altitude, pitch, etc) at small time intervals. Unfortunately since print throttle doesn't produce output like it should, that doesn't help as much as it could.

Link to comment
Share on other sites

Well, regardless, I made a new spooling-compensation... thing... that makes it so it will deal with configurably assymetric spooling of any length in a fairly efficient manner. Thus, I can now descend from a hover altitude of 110 meters to 10 meters in an almost suicide burn-like manner without impacting the ground.

Edited by Pds314
Link to comment
Share on other sites

I don't know if this helps or not, but when I was trying to make hover scripts in the old kOS that only ran one command per update and was thus very very slow, I had to deal with a similar problem, in that the code was very very slow and delayed from its effect (a bit like dealing with an engine the has to spool up, I imagine).

So the first thing I did was work out what throttle setting should *in principle* cause a hover, i.e. the throttle setting that should cause a TWR of 1.000, and then operate the pid logic from that. If you are in a situation where you like the the current velocity and want it to stay like it is, set the throttle to that hovTH value (the hover throttle), and it should make the craft continue rising or falling at a constant rate. If you want to accellerate up or down, then calculate the desired throttle as an offset of hovTH.

In other words, design the pid controller as if hovTH was the 'zero' point.

And hovTH needs to be in a lock expression because it has to constantly be recalculated as the fuel is burned and the mass changes.

Link to comment
Share on other sites

WOW, it is kind of amazing to see a jet-powered vehicle wander around the KSC with its lowest part less than 30 cm from the terrain and be absolutely perfectly stable. Granted, one that makes an obnoxious noise by continuously turning the engines off and on, but still, being able to fly safely in 2 dimensions centimeters from certain catastrophe is kind of awesome.

Link to comment
Share on other sites

And hovTH needs to be in a lock expression because it has to constantly be recalculated as the fuel is burned and the mass changes.

Not to mention that it needs to be recalculated as the speed increases and the basic jet's thrust decreases with it.

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