Menu

#2903 Swift/Vatsim: blue glider instead of Cessna 172

2020.4
Fixed
Low
2024-09-23
2024-07-25
No

Hi, today i connected to Vatsim via swift on Linux and on a some-days-old next.

Nearby planes were shown, and the swift model matching did show them correctly as "FG C172P".
In the sim I have seen them as blue/yellow gliders.

The properties looked "good", as in /ai/models/swift[n]/sim/model/path=/Aircraft/c172p/c172p-set.xml correctly reflected the C172 matched of a particular nearby aircraft I checked.


It however made me curious, as my local models path does not have the slash prefix in the path (local model is at Aircraft/c172p/Models/c172p.xml).

So I changed the path creation like this:

diff --git a/src/AIModel/AISwiftAircraft.cpp b/src/AIModel/AISwiftAircraft.cpp
index cf09faf28..46302c037 100755
--- a/src/AIModel/AISwiftAircraft.cpp
+++ b/src/AIModel/AISwiftAircraft.cpp
@@ -25,7 +25,7 @@ FGAISwiftAircraft::FGAISwiftAircraft(const std::string& callsign, const std::str
 {
     std::size_t  pos = modelString.find("/Aircraft/"); // Only supporting AI models from FGDATA/AI/Aircraft for now
     if(pos != std::string::npos)
-        model_path.append(modelString.substr(pos));
+        model_path.append(modelString.substr(pos+1)); // strip first slash
     else
         model_path.append("INVALID_PATH");

After recompiling the model now shows as: /ai/models/swift[n]/sim/model/path=Aircraft/c172p/c172p-set.xml
However, still the glider is rendered, and not the detailed cessna model (nor the fallback one).

What is wrong? :(


My git looks like this:
flightgear: f8fc7630c origin/next (https://git.code.sf.net/p/flightgear/flightgear)
fgdata: c54b238c3 origin/next (git://git.code.sf.net/p/flightgear/fgdata)
simgear: 29f23fc5 origin/next (https://git.code.sf.net/p/flightgear/simgear)

Discussion

  • Gijs

    Gijs - 2024-07-25

    @ltoenning, this one's for you ;-)

     
  • Lars Toenning

    Lars Toenning - 2024-07-26

    I will take a look at this tomorrow.

     
  • Lars Toenning

    Lars Toenning - 2024-07-27

    I can reproduce this.
    But was it previously even possible to use user-flyable planes to render other planes? IIRC, this was never possible, but I could be wrong.

     
    • Benedikt Hallinger

      I can reproduce this.
      But was it previously even possible to use user-flyable planes to render other planes? IIRC, this was never possible, but I could be wrong.

      From the comments I see that it was just AI planes.
      But, it would be very good to have them visible, even if there is an actual detailed user flyable version installed (as is the case for the 172 in every fgfs installation).

       

      Last edit: Benedikt Hallinger 2024-07-27
  • Benedikt Hallinger

    Just as a note; I did not test Airliners or so.
    We were a bunch of small planes here, and I just have seen the glider.
    In my opinion, it would be good to see actual c172 planes out the window :instead of the gliders :)

    If I can do anything, please get in touch

     
    • Lars Toenning

      Lars Toenning - 2024-07-27

      You could add the "FG AI C172/C-FGFS" from $FGDATA/AI to your model set. This renderes fine. You can also test this without connecting to a network by using the model browser (https://swift-project.org/troubleshooting/model_browser/)

      Regarding using detailed (non-AI) models to display others: If I remember correctly, there were some limitations on how the AI Subsystem (which swift uses behind the scenes) can use these models. Hence, only the AI/not-detailed/non-userflyable planes are available. If this is still the case, we should make this more clear.

       
      • Gijs

        Gijs - 2024-08-04

        The wiki reads:

        For correct aircraft loading and parsing into swift you need to add FG's model directories.
        The supported folders are:
        * $FG_ROOT/AI/Aircraft
        * Any other folder which contains user-flyable airplanes (in separate folders).

        I think this is correct, but misses the point that you should refer to the actual model files, rather than -set.xml?

         
        • Benedikt Hallinger

          Added something to the wiki, is this correct now?

           
  • Lars Toenning

    Lars Toenning - 2024-07-27
    • assigned_to: Lars Toenning
     
  • Benedikt Hallinger

    Thanks, redone my set and now I can test-load the C172.
    Will this now show other real C172?

     
  • Lars Toenning

    Lars Toenning - 2024-08-06

    Any other folder which contains user-flyable airplanes (in separate folders, one per plane). Note, that you need to add the folder containing the actual .ac/xml model, not the one with the -set.xml, as the latter won't work.

    Have you tested that this works? I just looked at the swift code that parses the model folders and it seems that the following happens:
    - All paths that contain "/AI/Aircraft" are searched for .xml files. These files are added as "included" models to the model overview
    - All other paths are handled as user-flyable planes. Here, only the -set.xml files are added and the models are set as "excluded".

    Having this hardcoded path-piece is worse... But thats why swift is still in beta ;-)

    See this page about included/excluded models: https://swift-project.org/documentation/swift_data/excluded_models/

    It seems that the FG C172 was accidentially added to the database as an included model (overwrites the default "exclude" for -set.xml files). Hence it is used for matching in your case and the glider is shown. I will check with the swift database admin if we can change.

    Nevertheless, just by the code inspection, I assume that it is not possible to use any airplanes except the ones in "/AI/Aircraft" for rendering right now.

     
  • Lars Toenning

    Lars Toenning - 2024-08-11

    It seems that the FG C172 was accidentially added to the database as an included model (overwrites the default "exclude" for -set.xml files). Hence it is used for matching in your case and the glider is shown. I will check with the swift database admin if we can change.

    The default C172 is now excluded for matching. The only other C172 model for FlightGear in the database, that is not exluded is "FG AI C172/C-FGFS". This model is located in $FGDATA/AI/Aircraft/c172.

     
  • Gijs

    Gijs - 2024-09-23
    • status: New --> Fixed
     

Log in to post a comment.