Board index FlightGear Development Scenery

genapts850 problems with banked runway

Questions and discussion about enhancing and populating the FlightGear world.

genapts850 problems with banked runway

Postby TheEagle » Fri Aug 05, 2022 1:02 pm

Hi there, i've just finished building an updated scenery for Papua, with airports and scenery object placements pulled from the XPlane gateway, and TerraGear binaries from the WS2.0 Docker image. Since I didn't want my airports to be cut into the terrain like Lukla in TerraSync currently is, i've set max-slope to 1 on the genapts850 command line. This worked fine for the slope, but unfortunately it looks like the --max-slope option is also used for the max-bank of the runway, so i've got runways like this one now:

Image

As you can see, the runway has a 30° of bank at one end, which makes it unusable. Is there any parameter for genapts850 / other method to fix this ?

p.s.: also, what does the --nudge parameter do for both genapts850 and tg-construct ?
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby xDraconian » Sat Aug 06, 2022 4:59 pm

max-slope = rise-over-run... = vertical delta distance / horizontal delta distance

max-slope = 0.017455065 (1%)
max-slope = 0.052407779 (3%)
...
max-slope = 1.000000000 (45%)

nudge = a multiplier to EPSILON to overcome a buggy airport. Avoid using it.
more detail: when you compare two floating point numbers for equality they will rarely have the exact same value. So EPSILON is a small delta that specifies how close they need to be in order to treat them as equivalent.
nudge = 10... make the small delta x10 bigger.

example:
Code: Select all
float thrust = 100.0f;       // computer value may actually be 99.99999997
if (thrust == 100.0f)         // will never be TRUE
...
const double EPSILON = 0.0000001;
if (thrust - 100.0F <= EPSILON)    // that will work
xDraconian
 
Posts: 369
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: genapts850 problems with banked runway

Postby TheEagle » Sat Aug 06, 2022 5:26 pm

Thank you very much for explaining, xDraconian ! :) But I still don't know how to get rid of the banking … :(
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby xDraconian » Sun Aug 07, 2022 4:59 am

try max-slope=0.087488664
xDraconian
 
Posts: 369
Joined: Sun Jan 21, 2018 5:53 am
Version: Git
OS: Linux Mint

Re: genapts850 problems with banked runway

Postby wkitty42 » Sun Aug 07, 2022 10:27 am

xDraconian wrote in Sun Aug 07, 2022 4:59 am:try max-slope=0.087488664

part of the problem is that slope and bank are two different things... to me, slope is pitch which bank is roll if we think in aircraft 3D space terms... they should not be controlled by the same variable when generating the terrain... this wasn't so much a problem with the WS2 method of cutting out the terrain and placing the airport but it did make for unnatural simulation... especially when a runway is on a slope but the simulation has it flat... the old military base in Hawaii that is now closed is an extreme example of this...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 8226
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: genapts850 problems with banked runway

Postby TheEagle » Sun Aug 07, 2022 2:42 pm

Since there doesn't seem to be a simple solution to this, I decided to clone the terragear source code (branch next of course) and take a look - I'd be willing to implement an extra parameter for max bank, but I have some questions on the implementation first.

So, I've located the code responsible for the slope limiting in terragear/src/Lib/terragear/tg_surface.cxx, starting line 316:
Code: Select all
    bool slope_error = true;
    while ( slope_error ) {
        SG_LOG( SG_GENERAL, SG_DEBUG, "start of slope processing pass" );
        slope_error = false;
        // Add some "slope" sanity to the resulting surface grid points
        for ( int j = 0; j < Pts->rows() - 1; ++j ) {
            for ( int i = 0; i < Pts->cols() - 1; ++i ) {
                if ( limit_slope( Pts, i, j, i+1, j, _average_elev_m, slope_max, slope_eps ) ) {
                    slope_error = true;
                }
                if ( limit_slope( Pts, i, j, i, j+1, _average_elev_m, slope_max, slope_eps ) ) {
                    slope_error = true;
                }
                if ( limit_slope( Pts, i, j, i+1, j+1, _average_elev_m, slope_max, slope_eps ) ) {
                    slope_error = true;
                }
            }
        }
    }

Am i reading this right, that in the
  1. if statement the height difference along the runway (aka slope) is clamped
  2. the height difference across the runway (aka bank) is clamped
  3. the diagonal height difference is clamped ?
If that's the case, adding a separate parameter would be a matter of minutes, even for a C++ newbie like me ! :)
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby TheEagle » Sun Aug 07, 2022 8:46 pm

I just tried it, and it was in fact really simple ! I'm wondering why no one thought of it before … I've posted the patch on the mailing list and it will be in next soon, hopefully ! :)
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby TheEagle » Wed Aug 17, 2022 3:23 pm

Well, what I didn't try back when I posted the last reply was actually using the modified genapts850 - turns out that things aren't as simple as I thought. After probably 20 hours of debugging, my logic looks perfect but for some reason, I need to set both --max-bank AND --max-slope to a high value to get the runway sloped along the terrain - but that also gives me some bank, even though it's not as much as before. Can someone please take a look at my code (patch for branch next is on the mailing list) and maybe spot the error ? I simply can't find it … :(
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby TheEagle » Thu Aug 18, 2022 11:29 am

Everything working except for one last thing - how do I lower the radius of the smoothing taking place in tgSurface::fit, @xDraconian ?
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04

Re: genapts850 problems with banked runway

Postby TheEagle » Thu Aug 25, 2022 10:31 pm

While working on the code, I coded this (it happened just like that, I didn't plan it !):
Image
:lol: :lol: :lol: :lol: :lol:
You won't believe how many issues dissolved into thin air after reinstalling !

Cessna 210 (GitHub | Wiki)
Find a list of the other aircraft I'm developing or enhancing in my wiki profile !
Addons: Landing challenge (GitHub)
Other: FGTools (GitHub)
User avatar
TheEagle
 
Posts: 2674
Joined: Sat May 01, 2021 2:27 pm
Location: France
Callsign: F-EAGLE
IRC name: none
Version: 2020.4.0
OS: Ubuntu Studio 20.04


Return to Scenery

Who is online

Users browsing this forum: No registered users and 2 guests