Jump to content

[1.3] GliderStats v1.0: Gather flight statistics for testing glider designs.


Snark

Recommended Posts

What it does

  • When the current craft is in unpowered atmospheric flight during descent, tracks certain statistics and displays them next to the navball.
  • Tracked statistics are:  glide ratio, descent speed

Download from github
License:  MIT
Source code

screenshot.png

 

Status messages

The status messages are displayed as follows:

  • No message:  The craft isn't in atmospheric flight.
  • "Throttle > 0":   The engine throttle is on (so you're not "gliding").
  • "Not descending":  The craft is ascending, therefore it's not in a stable glider mode.
  • "Gliding (nn%)...":  The craft has only recently started gliding, so the mod is still gathering statistics and can't show values yet.  The percentage climbs to 100% and then this message is replaced by one of the ones below.  The statistics interval defaults to 10 seconds, but is configurable, see below.
  • "Gliding (controlled):  <stats>":  SAS is turned on, and/or the player is providing control input.
  • "Gliding (free):  <stats>":  The craft is in completely free, uncontrolled mode, with no control inputs.

See below for how the stats are displayed.

 

Displayed statistics:

Typical statistics messages look like one of the following:

  • stabilizing (±n.nn%), ratio n.nnn, descent n.nnn m/s
  • ratio n.nnn, descent n.nnn m/s

What this means:

  • "ratio":  This is the craft's glide ratio, defined as forward speed divided by downward speed.
  • "descent speed":  How fast the craft is losing altitude, measured in m/s.

The statistics are tracked over a sliding time window of 10 seconds (you can change that via configuration, see below).  The reported numbers are the worst value found during the last 10 seconds (i.e. the lowest glide ratio, and the highest descent speed).  If the craft has been gliding for less than 10 seconds, then the status message doesn't show the stats yet.

"What's with this 'stabilizing' thing?"

Ideally, the craft would be in completely stable, uniform flight in order to get accurate measurements.  That can be tricky-- a lot of the time when gliding, the craft will "porpoise" for a while, oscillating between diving steeply and accelerating, then pitching up and slowing down.  This is known as a phugoid oscillation.  It can take a while for those oscillations to die down.  Until they do, it's hard to get accurate measurements.

The "stabilizing" display shows you how close you are to a stable glide.  It's a percentage, representing the difference between max and min speed over the last 10 seconds.  When this number approaches zero, it means you're in perfectly uniform flight and the displayed stats will be accurate.

By default, when your speed has varied by more than 1% over the last 10 seconds, it shows the "stabilizing" display.  When the delta drops below 1%, it drops the display.  Note that 1% is just the default-- it's configurable, see below.

 

How to install

Unzip the contents of "GameData" to your GameData folder, same as with most mods.

 

Configuration options

After running KSP with this mod installed for the first time, there will be a file PluginData/GliderStats/config.xml located in the mod's installation folder, like this:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <double name="SamplingWindowSeconds">10</double>
    <double name="StabilizationThreshold">0.01</double>
    <bool name="AllowTrim">1</bool>
    <bool name="AllowControlInput">1</bool>
</config>

You can edit the file to change GliderStats' behavior.  Changes will take effect the next time KSP starts.

The following options are available:

  • SamplingWindowSeconds:  The length of the "window" over which the mod gathers statistics.  Making this longer will give more accurate results, but you'll have to wait longer to get them.
  • StabilizationThreshold:  The percentage difference between max/min speed during the window, above which the "stabilization" warning is displayed (see above).  Defaults to 0.01, meaning 1%.
  • AllowTrim:  Boolean, 1 or 0.  Defaults to 1 (on).  When set to 0, the mod treats having any trim at all as disqualifying the craft from being in a "gliding" state.
  • AllowControlInput:  Boolean, 1 or 0.  Defaults to 1 (on).  When set to 0, the mod treats having any control input (either SAS, or manual player input) as disqualifying the craft from being in a "gliding" state.

 

Take the challenge

My motivation for writing this mod was that I had an idea for a challenge, and needed a good way to report scores.  So, if you like building gliders, check it out!

 

Link to comment
Share on other sites

58 minutes ago, AeroGav said:

I'm going to install your mod and test my glider now.   It seems stable in pitch and yaw,  but it does have Phugoids.    Speed fluctuates from 37 to 47 m/s  over the cycle, which takes about a minute to complete...

Nice!  :D  We have our first entry.

Link to comment
Share on other sites

19 minutes ago, AeroGav said:

@Snark   Is there any way to create a mod that adds thermals?  Randomly spawns areas in the atmosphere that apply a few m/s upward velocity to any craft within, so you can actually go soaring like a real glider?

I expect there probably is.  Pretty sure I've seen mods in the past that added wind, so this seems like it ought to be doable.  Heck, some attention to detail could actually make it somewhat realistic (e.g. thermals happen only at the right time of day, have an intensity tied to solar radiation, are more likely to happen in certain spots such as the sunward slopes of mountains, etc.).

Like any mod, though, it would be a chunk of work.  Sounds like a great mod idea :) ... but the mod author of that would not be me, since I wouldn't really use it myself.  (My modding is very selfishly motivated:  I write mods because I want them for my own gameplay and nobody else appears to have written them already.)  Given my limited free time, therefore, I don't see it likely that I'd get around to modding something like that any time soon.

It really does sound like a neat idea, though.  Perhaps post it over in Add-on Discussions, as a "hey, does anyone know of a mod that does this, or is anyone interested in making" kind of thing?

Link to comment
Share on other sites

Cool Mod. One thing that is really bugging me tho. Can you please allow for "trim"? I cannot input  trim (alt+awsd) and get a "free" flight. This means we have to "trim" our vehicles in the SPH which is a bit maddening hopping back and forth to get the perfect trim.

Link to comment
Share on other sites

8 hours ago, g00bd0g said:

Cool Mod. One thing that is really bugging me tho. Can you please allow for "trim"? I cannot input  trim (alt+awsd) and get a "free" flight. This means we have to "trim" our vehicles in the SPH which is a bit maddening hopping back and forth to get the perfect trim.

I can see how that could be frustrating, sure. Mainly comes down to a question of personal philosophy.

There's a "free" glider, and there's a "controlled" glider. I don't think there's any argument from anyone that the former is harder than the latter, and therefore that it's reasonable to have separate scoring categories for the two.

But where to put a glider with trim?  Should that be "controlled" or "free"?

I could see an argument to be made on either side, there. Certainly I don't think you're being unreasonable to make your request. It's a reasonable position to take.

However... reasonable people can disagree. And to me, trim is a form of control. Less controlled than SAS, sure, but control nonetheless. So that's why I prefer to keep it in the "controlled" category, by design.

Link to comment
Share on other sites

3 hours ago, Snark said:

I can see how that could be frustrating, sure. Mainly comes down to a question of personal philosophy.

There's a "free" glider, and there's a "controlled" glider. I don't think there's any argument from anyone that the former is harder than the latter, and therefore that it's reasonable to have separate scoring categories for the two.

But where to put a glider with trim?  Should that be "controlled" or "free"?

I could see an argument to be made on either side, there. Certainly I don't think you're being unreasonable to make your request. It's a reasonable position to take.

However... reasonable people can disagree. And to me, trim is a form of control. Less controlled than SAS, sure, but control nonetheless. So that's why I prefer to keep it in the "controlled" category, by design.

The end product is the same either way, so why make it more difficult? Your mod,  your choice, we can agree to disagree :) Thanks for the neat mod!

 

P.S. Just to make sure we understand each other, I am not talking about "actively" flying using the trim keys, only setting the trim and then leaving it alone.

Edited by g00bd0g
Link to comment
Share on other sites

8 hours ago, g00bd0g said:

P.S. Just to make sure we understand each other, I am not talking about "actively" flying using the trim keys, only setting the trim and then leaving it alone.

Yep, I figured that's what you meant, and that makes perfect sense.  :wink:

One problem is that there's no way for the mod to tell that the player isn't actively flying via trim (at least, not without my spending more time writing additional code that I'm not willing to spend time on at this point).  Yes, it's doable, but it would take more code, and since I view this mod as basically a throwaway one-off (written just so I could post the glider challenge), it's not something I want to spend time on.

Link to comment
Share on other sites

  • 4 years later...

Hate to Necro this, but I have been on the glider kick in KSP for a while now.  Just wondering if this mod will still function in the latest KSP version.  I was really looking for a mod that added thermals and ridge lift etc. to the game but saw this and thought it looked interesting.

Link to comment
Share on other sites

On 1/31/2022 at 10:37 AM, Bit Fiddler said:

Hate to Necro this, but I have been on the glider kick in KSP for a while now.  Just wondering if this mod will still function in the latest KSP version.  I was really looking for a mod that added thermals and ridge lift etc. to the game but saw this and thought it looked interesting.

I don't actually know, since I haven't run it myself in a long time. The only way for me to find out would be to install it on my current KSP and see for myself, which you could do as easily as I could. ;)

This was written for KSP 1.3, which was quite a few versions ago, so I suppose it's not out of the question that it could have gotten broken in the meantime. Only way to know is to try it and see.

If someone does try it out on current KSP, do me a favor and post here whether or not it works? If it does, I can update the compatibility info in the OP, and if it doesn't, maybe I could get off my duff and update it when I can.

Link to comment
Share on other sites

it seems to be working on the surface.   I do not know what is going on under the hood, I do however see a readout near the navball showing info.  i will mess around see if i can see any issues, but i would call it good for latest version.    and add it to CKAN...  :)


Not a competition glider, just a sport glider I made, but it did not do too bad, I think it's best sink rate was about 4m/s.

Spoiler

 

 

Edited by Bit Fiddler
Link to comment
Share on other sites

If you decide to update this mod at all, it would be nice to put it in a scalable UI window, or at least allow us to move and scale the text.   On my 4k system it is hard to see at times.

 

EDIT:

Ok the more I use this the more I like it.  So now I have a big request.

 

If you feel up to the task here is my wish list...

1) make a UI box that scales properly so 4k users get good results.

2)on said UI add a few text entry boxes the user can fill in, for forum username, and a URL if the craft is saved to Kerbal X, steam Workshop, Drop Box, or whatever.  and a craft name / pilot name just for flavor.  Some of this data can be read automatically from the game engine, I guess.

3) have a button on the UI that says "TEST".  when the user presses this button, it will put the craft at the standard launch position (I would say right above the KSC runway launch at 5K altitude. (Or whatever turns out to be the best altitude, maybe another user input?)  It will then set Pitch and Roll to zero, set heading to 90, and set speed to 100m/s (more user inputs?).   At any rate this will start the test headed out to sea, so there will be no terrain to get in the way of the test.

4) It will then release the glider and start the data collation.  This is where the biggest part comes in:  Save the various stats to a table every half second, or second or whatever. keep this up until the glider lands.  at this point it will revert the flight to launch and disable physics so it will not move and hide all UI elements.  Then add a text overlay with the min and max values for the various stats, the average value for the stats, distance traveled, forum username, URL, craft name pilot name KSP version, starting geometry (alt, pitch, roll, speed, etc.), did it free fly or was there user input, did the craft survive the landing....  you get the idea.  It will also record any mod.dll you add to the watch list like FAR or whatever.  Then allow the user to pan and zoom the camera to get the "Money Shot", then take a screen shot of the craft and info overlay, making a nice info graphic poster of the craft with the test results.

This will make all test flights conform to a specific set of rules for starting conditions, which will make the test more meaningful, as air density changes due to altitude, this start point will greatly affect the results of the test.  This will give the user a nice picture to upload to the forum for contests or whatever, with all the info at a glance.  Or it could be used just to make cool posters of any craft, by skipping the test and only showing data fields selected by the user from the UI window.

 

I know this takes your small simple mod, and makes it into a big, complicated thing, but I can dream...  

 

Edited by Bit Fiddler
Link to comment
Share on other sites

22 hours ago, Bit Fiddler said:

it seems to be working on the surface.   I do not know what is going on under the hood, I do however see a readout near the navball showing info.

That's basically enough info to know.  :)  It's a pretty simple mod-- if it seems to work, then it does.

If it weren't going to be compatible with current KSP, then it wouldn't work at all.  Thanks for the info, I'll go ahead and mark it as compatible with the current version.

9 hours ago, Bit Fiddler said:

it would be nice to put it in a scalable UI window, or at least allow us to move and scale the text.

Thank you, that's a nice suggestion.  :)

Unfortunately, it's also in the "will never, ever happen" category.  Not because it's a bad idea-- it isn't-- but because I have neither the know-how to do it, the time to learn how to do it, or the bandwidth to implement it even if I knew.  I've got a fair number of mods out there, but one thing they have in common is that they have virtually no UI on them.  I know nothing about Unity UI programming, and it's a learning curve I simply don't have the time or the inclination for.  My mods generally put a lot of design thought into "how can I make this work with no UI at all".  What you see now is the fanciest I'm able to get with UI programming.  :(

The only kinds of "UI" my mods ever have is when the KSP game itself provides explicit support for them (like adding buttons to a part's menu, or providing configuration options in the settings menu).

 

As a side note-- it's also the case that I haven't been playing with gliders myself for quite a while now, which means I'm not in the habit of using this mod  myself, and therefore I'm fairly unlikely to spend more time on it at this point.  If it were to break due to a KSP update and I just needed to tweak a setting and recompile or something, then I'd do that, but new feature development is pretty much off the table.

That said, though, I made a point of giving this mod the MIT license, which is about as wide-open and permissive as you can get without actually making something public domain.  ;)  So if anyone ever wanted to make their own fork of this and build on it, they're free to do so, with my blessing.  I'm more than happy for someone to pick it up and run with it.

(Note that the "with  my blessing" bit is actually irrelevant-- the license says they can do so, and it's irrevocable, so they could do it whether I liked it or not.  I merely add that in case anyone had qualms.)

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