Board index FlightGear Development AI Traffic

Paths from AI aircraft on Mac

Intelligent, computer controlled vehicles that drive/fly over the planet!

Paths from AI aircraft on Mac

Postby the4thchild » Mon Jul 02, 2018 1:10 am

I tried to load an AI scenario with a wingman and noticed that the AI aircraft cannot locate the path of the corresponding downloaded aircraft on Mac.

For example, the Seahawk Wingman scenario file located in
Code: Select all
/Applications/FlightGear.app/Contents/Resources/data/AI/seahawk_wingman_demo.xml
points to the AI aircraft model at
Code: Select all
AI/Aircraft/seahawk/Models/seahawk-3d-model-wingman.xml
, which in turn points to
Code: Select all
/../../../../Aircraft/seahawk/Models/SeaHawk-FGA6-WV859.ac
for the aircraft model.

When I download this aircraft on Mac, however, the files are stored in
Code: Select all
/Library/Application Support/FlightGear/Aircraft/org.flightgear.addon/Aircraft
rather than the relative path expected by the AI aircraft's XML. I assume it uses this location appears from the default FG_HOME location on Mac.

My workaround was to copy the downloaded Seahawk aircraft into the FlightGear.app aircraft folder. Is there a way to use FG_HOME from within the AI aircraft's XML file? Or a way to check all Aircraft locations in case they might be located in a number of different folders?
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Mon Jul 02, 2018 8:59 pm

those "../" parts should not be in there... they should reference the craft directly instead of trying to walk the paths like that... that you have those "../" in yours raises the question of which flightgear are you running??

when i first tested this on my system just now, i only saw the droptanks flying along beside me... when i fixed those paths by removing all those path walking dots and slashes, the craft appeared and seemed to work fine... there is, however, still a problem in the Wingman Controls dialog... it can't open the formation settings... the console reports

Code: Select all
Nasal runtime error: undefined symbol: formation
  at /group[3]/button/binding, line 1

i do not have a fix for this...

the following fixes the initial path problem and another one reported in the console... this first one removing the "../" stuff is a lot more correct than it might have been back in 2003 and 2004 when the scenario files were created and modified...

in AI/Aircraft/seahawk/Models/seahawk-3d-model-wingman.xml
lines 14 and 15...
Code: Select all
        <path>Aircraft/seahawk/Models/SeaHawk-FGA6-WV859.ac</path>
        <texture-path>Aircraft/seahawk/Models</texture-path>


also, to fix the navigation lights, remove "AI/" from the beginning of lines 376, 386, and 396... those models are not located in the AI tree... they are in the Aircraft tree in the actual craft's directory...
Code: Select all
                <path>Aircraft/seahawk/Models/light-green.xml</path>
[...]
                <path>Aircraft/seahawk/Models/light-red.xml</path>
[...]
                <path>Aircraft/seahawk/Models/light-white.xml</path>
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Tue Jul 03, 2018 5:07 pm

FWIW: i've sent a patch to the dev mailing list for this... hopefully it will be applied and made available soon for those building their FG from the source... others will have to wait for the next release to get the fix or manually edit the one file as noted above...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby the4thchild » Wed Jul 04, 2018 4:50 pm

Thanks for pointing this out and for the fix! It's good to know that the full aircraft model can be found without having to follow the full relative paths. I can confirm that your fix works on my testing for both the Seahawk and if I use another AI aircraft such as Spitfire and update its paths.

I do still need to manually move the aircraft files from their downloaded folder,
Code: Select all
/Library/Application Support/FlightGear/Aircraft/org.flightgear.addon/Aircraft/seahawk
, to the main FlightGear app folder,
Code: Select all
/Applications/FlightGear.app/Contents/Resources/data/Aircraft/seahawk
. Otherwise, I get the
Code: Select all
Failed to load model: Model file not found: 'Aircraft/seahawk/Models/SeaHawk-FGA6-WV859.ac'
error.

Is there a way to find the aircraft from the download location, without manually moving the aircraft folder?
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Wed Jul 04, 2018 5:53 pm

you should not move/copy the craft from the download folder... absolutely not... are you saying that if you put the craft back where you moved them from, you still get errors after restarting the sim and using the seahawk wingman demo? can you post your fgfs.log file?

internally FG melds all the various directories into its own tree... it knows to look in all the various anchored "/Aircraft" and unanchored "Aircraft" directories...

are you also saying that there are other scenarios using those "../" directory traversals?? scenarios are not worked with very much these days... they're quite old (the seahawk one is dated 2003/2004) and there may need to be some more work done on them or in FG code to have them work properly again... at one time they were simply demos of what could be done by programming the sim...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby the4thchild » Wed Jul 04, 2018 7:34 pm

Basically what happens for me is if I run the Seahawk scenario without downloading that aircraft, the Seahawk fails to load, and two gliders are in its place. The scenario itself loads, but the aircraft is missing. If I download the aircraft, its folder goes to the /Library location, and the aircraft again fails to load. If I copy the Seahawk folder into the main application's Aircraft directory, the Seahawk loads. Is this a problem because internally FG does not know the "/Library/Application Support/FlightGear/Aircraft/org.flightgear.addon/Aircraft" default download path on Mac?

This actually happens with or without changing the "../" traversals in the AI aircraft's path. I noticed that many other AI aircraft have these traversals as well and also work for me with or without them, so long as I move the downloaded aircraft to the main app's directory as above.

I realize that the scenarios are pretty old...but I think they're awesome! I'm starting to use one of the wingman scenarios to try building a generic version that can load various AI aircraft models, starting with the Spitfire AI. I had to make quite a few modifications in the AI model to get the propellers to sync with the main aircraft -- are the AI models pretty old/outdated as well?
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Wed Jul 04, 2018 8:15 pm

the4thchild wrote in Wed Jul 04, 2018 7:34 pm:Basically what happens for me is if I run the Seahawk scenario without downloading that aircraft, the Seahawk fails to load, and two gliders are in its place.

right... you have to have the craft for the scenario to load them... even without them the scenario should load and work... you just won't see the effects...

those two gliders? are they not the drop tanks? i haven't looked to see where they are loaded from but when i started looking into your situation, i only had the two drop tanks flying along with my craft (the UFO in this case) and there was nothing else for the wingman's craft... i could have missed the glider, though, if it is really tiny... anyway, when i removed the directory traversal mess and left off the leading '/', the fuselage showed up as well...

the4thchild wrote in Wed Jul 04, 2018 7:34 pm:The scenario itself loads, but the aircraft is missing. If I download the aircraft, its folder goes to the /Library location, and the aircraft again fails to load. If I copy the Seahawk folder into the main application's Aircraft directory, the Seahawk loads. Is this a problem because internally FG does not know the "/Library/Application Support/FlightGear/Aircraft/org.flightgear.addon/Aircraft" default download path on Mac?

no, FG has to know about it... "/Library/Application Support/FlightGear" directory is "fg-home" AFAIK... these other directories should be in there, too if i'm understanding things properly...
Code: Select all
AI
Aircraft
aircraft-data
cache
Export
FlightGear
Input
Liveries
PreviewsCache
TerraSync
Wildfire

Aircraft is where your downloaded aircraft are installed via the launcher...
Terrasync is where your scenery is downloaded to...
Export is where your flight tapes and flight plans are saved to...
aircraft-data is where the saved aircraft states are stored when you exit the sim...
Input is where your custom controller files are stored... custom meaning when you've changed the button or axis assignments...

the4thchild wrote in Wed Jul 04, 2018 7:34 pm:This actually happens with or without changing the "../" traversals in the AI aircraft's path. I noticed that many other AI aircraft have these traversals as well and also work for me with or without them, so long as I move the downloaded aircraft to the main app's directory as above.

AI craft or AI scenarios? AFAIK, these are not ""AI craft"" as used in the AI Traffic or MultiPlayer stuff...

the thing is that you should not have to ""pollute"" "/Applications/FlightGear.app/Contents/Resources/data/" at all... that is where all the craft used to live... when the big split came along back after FG 3.4.0 was released, all the craft in there, except for the c172p and the UFO, were moved to a hanger we call FGAddon... that's where your downloads are coming from if you are using the default hanger... FG should know that your "/Library/Application Support/FlightGear/Aircraft" directory is there or you couldn't even fly those craft that you've downloaded...

the4thchild wrote in Wed Jul 04, 2018 7:34 pm:I realize that the scenarios are pretty old...but I think they're awesome! I'm starting to use one of the wingman scenarios to try building a generic version that can load various AI aircraft models, starting with the Spitfire AI. I had to make quite a few modifications in the AI model to get the propellers to sync with the main aircraft -- are the AI models pretty old/outdated as well?

AI traffic craft are being updated all the time... yes, the scenarios are pretty cool, too...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby the4thchild » Thu Jul 05, 2018 4:11 am

wkitty42 wrote in Wed Jul 04, 2018 8:15 pm:no, FG has to know about it... "/Library/Application Support/FlightGear" directory is "fg-home" AFAIK... these other directories should be in there, too if i'm understanding things properly...


This is my issue as the scenario aircraft does not seem to recognize this folder. The launcher must see it as downloading aircraft through the launcher does place aircraft in this directory, but for some reason wingman aircraft launched from scenarios don't. I'm using FG 2018.2.2 so should be up to date. Is this a Mac-specific issue, or a configuration problem? I've seen the issue when running directly from the command-line or through the launcher. I agree that it would be preferable not to pollute the app folder.

I do recall seeing only drop tanks at some point during my earlier testing. For at least some of my tests, the fuselage showed up after an extended delay.

wkitty42 wrote in Wed Jul 04, 2018 8:15 pm:AI craft or AI scenarios? AFAIK, these are not ""AI craft"" as used in the AI Traffic or MultiPlayer stuff...


These aircraft are the ones in the AI/Aircraft folder, similar to the Seahawk wingman model you edited. I ask about the Spitfire model there because many of its values don't appear to sync when used as a wingman, and I'm unsure whether that's because the model is outdated or if it's not meant to be used as a wingman as-is. Making adjustments as seen in https://gitlab.com/mhab/BAE-Hawk/blob/master/AI/BAE_Hawk_T2_wingman.xml seem to sync many of its values with the main aircraft.
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Thu Jul 05, 2018 1:22 pm

this may very well be mac specific considering the changes and testing we've done... the changes i posted fixed the problem on my linux installation... apparently they do not fix the problem on your mac and that suggests a problem within the FG code... i'll pass this on to the devs... i know that at least one of them has a mac and can test this situation... it may be a few days before we get an answer, though, as they're taking a (two week IIRC) vacation...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby the4thchild » Fri Jul 06, 2018 4:13 pm

Thanks, would be curious to see if it's a Mac-specific issue. My startup logging does show:
Code: Select all
fghome-dir = "Path "/Users/david/Library/Application Support/FlightGear""
download-dir = "/Users/david/Library/Application Support/FlightGear"
terrasync-dir = "/Users/david/Library/Application Support/FlightGear/TerraSync"
aircraft-search-paths =
   /Users/david/Library/Application Support/FlightGear/Aircraft/org.flightgear.fgaddon

so the fgaddon path does seem to be loaded. I tried deleting the autosave file but got the same result.

Glad you guys get a vacation...this is an awesome sim!
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X

Re: Paths from AI aircraft on Mac

Postby stuart » Sun Jul 29, 2018 5:56 pm

I've just committed some fixes to address this. You should no-longer require the seahawk installed to run the scenario.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1629
Joined: Wed Nov 29, 2006 10:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Paths from AI aircraft on Mac

Postby wkitty42 » Mon Jul 30, 2018 1:41 pm

thanks, stuart! that will also prevent the need to copy the craft into fgdata which should not be done anyway ;)
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Paths from AI aircraft on Mac

Postby the4thchild » Wed Aug 15, 2018 12:22 pm

I see the commit now -- this looks awesome! Looking forward to trying it out in the next release. Thanks again for your help (and this incredible sim!).
the4thchild
 
Posts: 9
Joined: Sun Dec 19, 2010 10:12 am
OS: Mac OS X


Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 2 guests