Mihara / RasterPropMonitor

Plugin for Kerbal Space Program. This repository is out of date and is primarily of historic interest. See https://github.com/JonnyOThan/RasterPropMonitor
http://forum.kerbalspaceprogram.com/threads/57603
Other
116 stars 67 forks source link

HUD Ladder Variables #587

Closed DeputyLOL closed 8 years ago

DeputyLOL commented 8 years ago

Some thing just crossed my mind the other day. You said that making a rotation based gauge would be very difficult yet we have a horizon ladder that rotates.

How about adding a config that allows you to change the variables from pitch and roll to something else?

Let me know what you think.

I'm also asking this because I'm making a horizon ladder that doesn't go up in equal steps I need to use math variables to make it consistant.

MOARdV commented 8 years ago

That would be challenging within the RPM framework, although I can think of ways to do that (ahem - search for 'HORIZON'). Granted, that doesn't help within RPM.

DeputyLOL commented 8 years ago

ahhhhh..... I did some research and thought i'd ask you about it. It a small feature but would probably be as difficult as unscrambling eggs. Some horizons have a 'heading' bar built into them. a310 heading bars Take this A310 PFD. (I've marked helpful red arrows) They move left and right along the horizon as the heading changes. Its probably impossible but I just wanted to ask about it. Wat u think?

MOARdV commented 8 years ago

Not impossible. In MAS, at least. :)

It would probably need to be a separate texture (that is, separate from the horizon texture) that is drawn with the HORIZON object so that it picks up the roll and pitch changes, but it would have its own variable. It could even be used to display a sideslip, for that matter. I will need to think some more on it, first.

DeputyLOL commented 8 years ago

Lovely. Could we use horizon with out a pitch variable or just with a '0' to make a rotating dial? I wanted to make a sky pointer that moves with the horizon Also if we had the horizon heading indicator, I could include a side slip indicator in the sky pointer. I could use the 'pitch' to move sky pointer to stick to the side of the horizon display.

MOARdV commented 8 years ago

Lovely. Could we use horizon with out a pitch variable or just with a '0' to make a rotating dial?

In MAS, yes. Easy.

Alexustas commented 8 years ago

probably already too late and / or too hard to do. but I will try to offer it. Perhaps, instead of several modules (HORIZON, HORIZONTAL_BAR, HORIZONTAL_STRIP), you can make a single super-module, based on the "Image" module

IMAGE
{
       name = super_image
       variable = MyVar
       range = 0.5, 1.1

       BOUNDINGBOX
       {
            BBoxSize = X,Y - define image container
            BBoxAnchorOffset = X,Y - if we need rotate or scale container not around center 
            BBoxPosition = X,Y - values or variables, or a single Vector2 maybe?
            BBoxRotation = R - e.g. for 'HORIZON', or in conjunction with AnchorOffset we can get a gauge hand 
            BBoxScale = X,Y - if the anchor lowered to the bottom of the container and animate the scale. then we get 'VERTICAL_BAR', etc
       }
       TEXTURE
       {
            textureType = image - filling container with image, color or maybe image from Camera?
            variable = LetsShowThatImage - use this texture or not, if not - go to the next texture block
            range = 0.5, 1.1
            textureURL = JSI/RasterPropMonitor/Library/Components/NavBall/StaticMask
            textureOffset = X,Y - offset inside container
            textureSize = X,Y - if the texture size greater than the size of the container, we get a 'HORIZONTAL and/or VERTICAL STRIP' mode, using textureOffset 
            wrap = true
       }
      TEXTURE
       {
            textureType = solidColor
            variable = SorryNoShow
            range = 0.5, 1.1
            color = COLOR_NiceColor_Passive
       }
      TEXTURE
       {
            textureType = solidColor
            variable = ItDoesNotLookVeryGood
            range = 0.5, 1.1
            color = COLOR_NiceColor_Active
       }
}
DeputyLOL commented 8 years ago

Lovely!

DeputyLOL commented 8 years ago

Do you think you could give me a hand at starting off with my new PFD? I have this: PROP { name = AC_K320_PFD_CAP

MODEL
{
    model = AdvancedCockpit/Shared/Displays/DisplayUnit/DisplayUnit
}

MODULE
{
    name = MASMonitor

    screenTransform = ScreenObj // Transform for the monitor
    layer = _Emissive               // What layer to draw on
    screenSize = 640, 640           // Pixel dimensions (w, h)
    fontSize = 16, 32               // Fixed font dimensions
    font = InconsolataGo-Bold       // Default font
    textColor = 255, 255, 255, 255  // Default color of text
    backgroundColor = 0, 0, 16, 255 // Background color
    monitorID = Monitor%PROPID%     // What is the name of this prop's page variable?

    // Not implemented yet:
    //variable = fc.GetPowered()
    //range = 0.5, 1.1
    //disabledColor = 0,0,0,0

    page = AC_K320_PFD_CAP
}

MAS_PAGE { name = AC_K320_PFD_CAP HORIZON { name = horizon texture = AdvancedCockpit/K320/Displays/Textures/PFD_ladder_basic position = -42,13 size = 295,341 pitch = fc.Pitch() pitchRange = -90, 90 displayPitchRange = 2044,0 roll = fc.Roll() rollRange = -180,180 displayRollRange = -180,180 variable = fc.GetBrakes() // For illustration purposes: HUD ladder works if brakes are off :-) range = -0.5, 0.5 } HORIZON { name = HorizonBorder texture = AdvancedCockpit/K320/Displays/Textures/PFD_HorizonBorder position = -42,13 size = 295,345 pitch = 0 pitchRange = 0,0 displayPitchRange = 172,172 roll = fc.Roll() rollRange = -180,180 displayRollRange = -180,180 variable = fc.GetBrakes() // For illustration purposes: HUD ladder works if brakes are off :-) range = -0.5, 0.5 } HORIZONTAL_STRIP { name = Heading texture = AdvancedCockpit/K320/Displays/Textures/PFD_HEADING position = 125,556 size = 304,40 input = fc.Heading() inputRange = 0, 360 displayWidth = 320 displayRange = 0,2048 wrap = true } IMAGE { name = PFD overlay texture = AdvancedCockpit/K320/Displays/Textures/PFD/PFD_OVERLAY size = 640, 640 } //TEXT //{ // name = PFD overlay text // textfile = AvionicsSystems/pfd_main.txt // font = JSI_baseFont //}

VERTICAL_STRIP
{
    name = AirSpeedBar
    texture = AdvancedCockpit/K320/Displays/Textures/PFD/Airspeed/PFD_AIRSPEED
    position = 10,62
    size = 64,364
    input = AirspeedKnots()
    inputRange = 0, 500
    displayHeight = 930
    displayRange = 4002,151
    variable = fc.GetRCS() // For illustration purposes
    range = -0.5, 0.5
    wrap = false
}
VERTICAL_STRIP
{
    name = StallBar
    texture = AdvancedCockpit/K320/Displays/Textures/PFD/Airspeed/PFD_STALLBAR
    position = 74,62
    size = 12,364
    input = StallSpeed()
    inputRange = -60, 60
    displayHeight = 455
    displayRange = 682,227
    variable = fc.GetLights() // For illustration purposes
    range = -0.5, 0.5
    wrap = false
}

} }

And it doesn't work. I get a Initialization error:

[EXC 16:51:42.803] NullReferenceException: Object reference not set to an instance of an object AvionicsSystems.MASMonitor.EnablePage (UnityEngine.Camera cam) UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) [EXC 16:51:42.805] NullReferenceException: Object reference not set to an instance of an object AvionicsSystems.MASMonitor.DisablePage (UnityEngine.Camera cam) UnityEngine.Camera.FireOnPostRender (UnityEngine.Camera cam)

Any ideas?

DeputyLOL commented 8 years ago

Also this: [ERR 16:26:19.953] [AvionicsSystems] INITIALIZATION ERROR: MASMonitor configuration failed.

[ERR 16:26:19.954] [MASMonitor] Failed to configure prop #13 (AC_K320_PFD_CAP)

[ERR 16:26:19.956] [MASMonitor] System.ArgumentException: No ConfigNode found for page AC_K320_PFD_CAP in MASMonitor in AC_K320_PFD_CAP! at AvionicsSystems.MASMonitor.Start () [0x00000] in :0

MOARdV commented 8 years ago

[ERR 16:26:19.953] [AvionicsSystems] INITIALIZATION ERROR: MASMonitor configuration failed.

That is the problem (why you're getting the NRE). Make sure the MAS_PAGE node is outside the MASMonitor node, and outside the prop config. It must be a top-level node, not embedded in anything else. If I'm reading the curly brace nesting right, it's inside another node.

DeputyLOL commented 8 years ago

Ahhh ok. Thank you. Do you think you could release the variables AirspeedKnots() and Stallspeed() variables so I can get a grip on how they work. Also how would one pull off a mapped variable.

DeputyLOL commented 8 years ago

Also. How do I get the ladder to be more 'zoomed in'?

MOARdV commented 8 years ago

AirspeedKnots() and Stallspeed()

AirspeedKnots() can be done with fc.SurfaceSpeed() * 1.94384449 for the time being (ditto for fc.EquivalentAirspeed() and fc.IndicatedAirspeed(). I'll add fc.StallSpeed().

Also how would one pull off a mapped variable.

I thought I already had a helper function to do that, but it looks like I don't. I'll add fc.Remap(value, bound1, bound2, map1, map2) that will clamp value to the range [bound1, bound2], and then map it to the range [map1, map2]. The alternative is to write a Lua function to do that:

function Remap(value, bound1, bound2, map1, map2)
  value = math.max(bound1, math.min(bound2, value))
  local iLerp = (value - bound1) / (bound2-bound1)
  return map1 + iLerp * (map2 - map1)
end

(untested) - you'd put that in a .lua file somewhere, and add a config file to tell MAS to load it and add it to the Lua environment (see AvionicsSystems/testing.cfg). This Lua script will be slower than a C# function, so it's not something you will want to use extensively.

Also. How do I get the ladder to be more 'zoomed in'?

That's a bug on my part, I believe. I noticed that a while back before I got distracted on other things.

DeputyLOL commented 8 years ago

That's a bug on my part, I believe. I noticed that a while back before I got distracted on other things.

Its ok. I found a way, you just have to make the texture narrower. While I'm here, do you think you could tell me what the function for radio altitude is?

MOARdV commented 8 years ago

While I'm here, do you think you could tell me what the function for radio altitude is?

The cryptically-named fc.AltitudeTerrain(false) will return altitude above the terrain, or above the ocean. fc.AltitudeTerrain(true) will ignore the ocean and return altitude above the ocean floor, instead.

And let's take MAS discussions over to the AvionicsSystems project, so it's easier for me to keep track of stuff I need to add. :)

Oh - FAR doesn't expose a stall speed that I have found, but has stall %.

DeputyLOL commented 8 years ago

ok then. you can close this now unless you plan on adding hud ladder variables to RPM? Should I make a similar request in the MAS issues?

MOARdV commented 8 years ago

Should I make a similar request in the MAS issues?

Or a MAS feedback / questions thread.