c172p-team / c172p

A high detailed version of the Cessna 172P aircraft for FlightGear
GNU General Public License v2.0
82 stars 43 forks source link

Taxing tutorial not starting in the correct location #1387

Closed wlbragg closed 3 years ago

wlbragg commented 3 years ago

dloeckx said...

Not sure if this is the right place to comment... It took me quite some searching, but I found out that my plane isn't positioned at the location indicated in the xml at the start of the taxiing tutorial, yet - as mentioned above - on the runway. Using Flightgear 2020.3.11 on a Macbook Pro (M1 chip), yet I had the same issue on an older (early 2015) Macbook Air a few months ago. Happy to help debugging!

wlbragg commented 3 years ago

Interesting, nothing has changed in the aircraft tutorials as far I know. But I am seeing an error in the log... Failed to find a parking at airport PHTO:Slab44 Funny thing is though, the tutorial mentions nothing about Slab44, it only sets the aircraft at a lat and lon. But it also looks like it is not setting the aircraft at the correct lat and lon as indicated in the tutorial. That would be the first thing to check I suppose, where on the airport is the starting position of... latitude-deg 19.71731272 longitude-deg -155.0597483

And is ... latitude-deg 19.71717163 longitude-deg -155.0594903 indeed at the start of the taxiway?

wkitty42 commented 3 years ago

this may be related to ""recent"" changes to the PHTO groundnet file... from what i see, the one in terrasync was last modified May 2021 via the new flightgearairports tools... it contains 9 parking places... two named "GA" (numbers 1 and 2) and 7 named "Gate" (3-9 skipping 5 and having two 3's)...

wlbragg commented 3 years ago

Thanks @wkitty42 that would explain this. What I can't get my head around is that the tutorial doesn't seem to reference any 'parking position, yet it is throwing an error that it can't find Slab44. So it really sounds like the issue is that the parking spaces names have been changed even though I can't find in the tutorial where it refers to a parking space.

wkitty42 commented 3 years ago

On 11/14/21 8:32 PM, wlbragg wrote:

Thanks @wkitty42 https://github.com/wkitty42 that would explain this. What I can't get my head around is that the tutorial doesn't seem to reference any 'parking position, yet it is throwing an error that it can't find Slab44. So it really sounds like the issue is that the parking spaces names have been changed even though I can't find in the tutorial where it refers to a parking space.

it may be that FG, itself, is attempting to place the craft in parking before moving it OR it may be trying to place the craft in parking nearest to the provided coordinates... but those's are both pure guesses and no clue where that parking name may be being found... unless... [see next paragraph(s)]

one question that comes to mind is if the reporting user has allowed terrasync to update or not... if not, they may have the old ground net in place still while others of us have the newer one... it may also be that they have been manually updating their scenery using an external tool like terramaster and, again, they have not updated their local copy since at least May 2021...

while writing this, i also remembered that FG, when downloaded and installed, comes with its own copy of the Hawaii area... it is possible that the reporting user does not have terrasync turned on and that the included Hawaii area on their system has the old ground net still... since terrasync is not turned on, it cannot override the included area...

also, on that thought, if terrasync is enabled, perhaps it is not listed above the included Hawaii area in the list of scenery directories FG knows about... the scenery paths are read top-down so that higher listed directories override lower ones... if terrasync is enabled but placed lower (eg: injected at the bottom of the list), then the old, incorrect, not updated, original Hawaii scenery would still be being used...

dloeckx commented 3 years ago

@wkitty42 : I didn't had 'Automatically download scenery' checked. I switched it on, but even after a few reloads nothing has changed.

@wlbragg : The plane starts (From 'Location'-->'Position Aircraft in Air') at position Longitude -155.059, latitude 19.719, heading 217.5 According to the json of the tutorial, it should start at lon -155.059783, lat 19.71731272, heading 125 for the taxiing tutorial, and at lon -155.051897, lat 19.724150, heading 220 for the preflight tutorial. In both cases, the plane remains at its original position and the heading doesn't change.

I start from the GUI, and go to the tutorials via the menu Help --> Tutorials

Edit: fixed coordinates for preflight tutorial

wkitty42 commented 3 years ago

why are you starting the craft in the air? maybe try starting in a parking place, let everything load, and then select the tutorial? you might need to go into the aircraft-data directory and remove the c172p file, if it exists, just in case it contains some bad data that is confusing the sim... the aircraft-data directory is found in the same place as the fgfs.log file...

dloeckx commented 3 years ago

I am not starting in the air? The heading is the orientation of the nose of the plane on the compass afaik? The plane is on the tarmak in one of the parking spots, and it stays where it is even if I start a tutorial. I'll remove the c172p directory and look for the log file. Would it help if I start from command line?

Edit: I now understand the confusion. I use the 'Position Aircraft in Air' only to read-out the position, not to change anything.

wkitty42 commented 3 years ago

ok, yeah... the "position aircraft in air" thing threw me off...

what do you mean "remove the c172p directory"?? are you using a downloaded one from here as well as the one that comes default with FG? be sure which one you are using by clicking on it in the launcher's aircraft selection page... one click will select the craft... another click will show the details of the craft... scroll to the bottom of the window to see which directory it is in... or i think you can hover over the craft pane after selecting it and a popup tool tip will show the directory...

look here to find out where the log file may be on your OS: FG wiki - Commonly_used_debugging_tools#Finding_fgfs.log

dloeckx commented 3 years ago

My mistake about the directory, I didn't know about the log-file directory and all other info there. I deleted the c172p file (so not directory), without avail. However, I also found the log file and see the following error first thing when I start the tutorial:

  126.07 [ALRT]:nasal     /Users/Shared/Hudson/MacRelease/flightgear/src/Scripting/NasalSys.cxx:1413: Nasal runtime error: undefined symbol: sim
  126.07 [ALRT]:nasal     /Users/Shared/Hudson/MacRelease/flightgear/src/Scripting/NasalSys.cxx:1431:   at /sim/tutorials/tutorial[2]/nasal, line 6

Please find attached the complete log file: fgfs.log

wlbragg commented 3 years ago

Nice catch, I did not have that error in my log. But I did have this right after the reposition command which I think is in response to the failed tutorial reposition.

  126.07 [INFO]:nasal     /Applications/FlightGear.app/Contents/Resources/data/Nasal/seaport.nas:2: *** NEW LOCATION ***
  126.07 [INFO]:general   /Users/Shared/Hudson/MacRelease/flightgear/src/Main/fg_init.cxx:1204: fgStartReposition()
  126.07 [INFO]:nasal     /Applications/FlightGear.app/Contents/Resources/data/Nasal/aircraft.nas:383: saving aircraft data to /Users/dloeckx/Library/Application Support/FlightGear/aircraft-data/c172p.xml
  126.09 [WARN]:flight    /Users/Shared/Hudson/MacRelease/flightgear/src/FDM/fdm_shell.cxx:149: FDM: Some errors restoring preserved state

That looks like it is the issue.

Referring to /sim/tutorials/tutorial[2]/nasal, line 6, If you look at c172p-tutorials.xml the 3rd tutorial on the list, ie; 0, 1, 2 ([2]) is the taxiing tutorial. What is line 6?

Well line 6 of the file seaport.nas is

var lon = getprop("/position/longitude-deg");

as in

setlistener("/sim/presets/latitude-deg", func {
    logprint(LOG_INFO, "*** NEW LOCATION ***");
    settimer(func {
        var typ = getprop("/sim/type");
        var lat = getprop("/position/latitude-deg");
        var lon = getprop("/position/longitude-deg");
        var g = geodinfo(lat, lon);
        if ((g != nil and g[1] != nil and g[1].solid) and (typ == "seaplane") )
            fgcommand("dialog-show", props.Node.new({ "dialog-name": "seaport" }));
    }, 8);
}, 1);

First, why is seaport.nas involved here? We don't refer to it in the tutorial.

:EDIT: I never really understood where or how seaport was called. I also didn't know it was automatic if the aircraft or airport (sim/type) was seaport. Nor do I remember where "seaport" is defined. I am assuming it has to do with the airport? I don't know if this has anything to do with this issue of if line 6 refers to seaport.nas. :END EDIT:

I may have to get some help on the mailing list for this one.

wlbragg commented 3 years ago

I just checked the Amphibious tutorial and it is also busted. But, funny thing, I checked the J3Cub Amphibious tutorial and it still works. So this appears to be specific to the c172p even thought those tutorials are virtually identical. The J3 I think was done after the c172p and based off it. So this is really strange. We need to positively identify what exactly is line 6?

stuartbuchanan commented 3 years ago

Hi Folks,

I've taken a look and worked out what is going on, but not why or when this changed.

TL;DR - setting the presets/airport-id tags in the tutorial is over-riding the lat/lon:

<airport-id>PHTO</airport-id>

Longer version: We have code in FG to place aircraft on the correct runway based on METAR data. This is done late in the positioning phase of the code because we need to be "at" the airport first. At this point we appear to have lost an idea of what the user actually set, and the code sees the airport-id and attempts to find a runway to match.

So just changing <airport-id>PHTO</airport-id> to <airport-id></airport-id> fixes it.

-Stuart

dloeckx commented 3 years ago

I can confirm that this patch fixes it, many thanks! Do you want me to fork and update the tutorial XML's?

wlbragg commented 3 years ago

Sure, if you don't mind, that would be great. I'll review them and then merge it.

wlbragg commented 3 years ago

Amphibious tutorials were missed.