Profile image

FUNKY TREES - Landing Gear Sensor

12.6k Flippos  4.9 years ago

So I wanted to have a "Master Caution" lamp light up when the Gear is down at a speed above 400KM/H (111m/s). Since Funky Trees doesn't quite support comparison operators I had to do a bit of a work around:

demo
upcoming plane cockpit teaser~

function

Notice: The above will either output 0 or itself. For beacons this is fine because they activate when input=/=0.
There's probably easier ways to do this (I often overcomplicate things), so feel free to leave suggestions/correct me in the comments.

EDIT: The "-0.5" part is not actually needed for the intended functionality. It is there for the case that GS=111m/s (exactly), but even so the value returned is still > 0.

UPDATE: This code is obsolete now since the newer version of SP and hence "upgraded" FT code came out. Inequality symbols are now a thing.

  • Log in to leave a comment
  • Profile image
    12.6k Flippos

    @SnoWFLakE0s The point is to have a warning if you take off and forget the gear down. All aircraft have this in real life.

    4.9 years ago
  • Profile image
    67.1k SnoWFLakE0s

    @FlipposMC
    .
    If you wanted, you could also make it such that gear just wont deploy above a certain speed- that might be more useful.

    +1 4.9 years ago
  • Profile image
    67.1k SnoWFLakE0s

    @JohnnyBoythePilot
    .
    Any part with an inputController class, under the attribute input.

    4.9 years ago
  • Profile image

    @FlipposMC
    K but where exactly in the input section & what part(s)?

    4.9 years ago
  • Profile image
    162k spefyjerbf

    Nice. Good work!

    +1 4.9 years ago
  • Profile image
    12.6k Flippos

    @JohnnyBoythePilot In Overload, under the "input" section.

    4.9 years ago
  • Profile image
    12.6k Flippos

    @spefyjerbf Rotators that moved wing sections that are themselves also a control surface.

    +1 4.9 years ago
  • Profile image
    162k spefyjerbf

    Awesome! I knew it would be nice for a VTOL engine, but I’m assuming that you made it work for control surfaces too?

    4.9 years ago
  • Profile image

    So how does this "funky trees" thing exactly work? I get its code but where do I conduct all this coding?

    +1 4.9 years ago
  • Profile image
    12.6k Flippos

    @spefyjerbf Believe it or not the Autoland code I was working on looks very similar to your descend code if not identical, with the exception that I'm trying to use "AltitudeAgl" to make my aircraft flare at the end.

    +1 4.9 years ago
  • Profile image
    12.6k Flippos

    @Type2volkswagen Yes as the "AltitudeAgl" data is...well the altitude above ground level. I tested it out and 100m is indeed a little too low so you definitely want to bump that up. One important thing to note is that the Final approach for Yeager and Bandit spawn you above water. This means that if you set the gear to come down at a threshold of say 200m Agl it will only come down once you are above the terrain. There is no way around this airport-specific problem, other than bumping up the Agl threshold or just using "Altitude" in place of "AltitudeAgl" and setting it to always come down at like 700m.

    4.9 years ago
  • Profile image
    162k spefyjerbf

    Very nice. I had a slightly different approach to comparison. The inclusion of the xor operator is really useful!

    4.9 years ago
  • Profile image

    @FlipposMC will this account for the different heights of runways ? (Wright vs Yeager)

    4.9 years ago
  • Profile image
    18.2k exosuit

    @FlipposMC yeah that's the problem currently.
    .
    the funky tree in SR2 looks nicer imo. Wonder when they're going to implement it to SP

    4.9 years ago
  • Profile image
    12.6k Flippos

    @CrashFighter05 Here is the code you require:
    clamp((AltitudeAgl / 2) * (1 - sign(AltitudeAgl - 100 - 0.5)), 0, 1)
    This will output "1" if the height above ground is < 100m and 0 otherwise. (Change it to your desire).

    4.9 years ago
  • Profile image
    12.6k Flippos

    @exosuit edited my response, was in a hurry so I didn't clarify stuff.

    Yes you can use v<x
    No, it seems you can't use it in addition to FunkyTrees (in the same input field).

    4.9 years ago
  • Profile image
    18.2k exosuit

    @FlipposMC didn't dllama made the autoflap on his cropduster plane using v< (speed) in the input?
    .
    afaik it has existed before 1.9 was out

    4.9 years ago
  • Profile image
    12.6k Flippos

    @exosuit To detect the speed being above a certain number as you say, of you plan on using FunkyTrees I believe you still need to do something similar to what I did, because FunkyTrees doesn't really support comparison operators (>,<) as of yet.

    If something like "v<300" IS your ONLY input it will work, yes. But as you said it requires two pistons.

    TLDR; The v<x Feature seems to not be compatible with FunkyTrees as part of an equation, but on its own it is.

    4.9 years ago
  • Profile image
    24.4k NoGoCars

    @FlipposMC now I feel stupid i had no clue what you were talking about.

    4.9 years ago
  • Profile image
    18.2k exosuit

    i hate it when i have to think (i haven't learned or experimented with it anyways) so what i'd do would be attaching the beacons to two pistons. one piston will extend by half if a condition is met (let's say it's the landing gear input), and another one if the speed is above certain number).
    .
    If both conditions are met, then the piston would extend fully and make the warning to go off.
    .
    it surely requires alot more parts but i think it sounds simpler for me

    4.9 years ago
  • Profile image
    12.6k Flippos

    @CrashFighter05 If you used AltitudeAgl you'ld just have to add something that will change the output data from AltitudeAgl to 1 if the input is =/= 0. I believe a clamp should work?

    4.9 years ago
  • Profile image
    24.4k NoGoCars

    You could probably make it to where the landing gear automatically extends below 500 feet or something like that. I'm gonna try to make this now.

    4.9 years ago
  • Profile image
    860 E1

    funky

    +1 4.9 years ago