TMD file again

  • Hi developers


    Could someone post the minimum required for a TMD file to get a model to show in FS2


    Model was not visible in the aircraft selector though I could select the empty space where the model was listed. When In FS2 model not visible


    Report file shows no errors nor did the export from the modelling program


    Thanks, Steve

  • Hi Steve,


    first place to check is the tm.log of the Aerofly executable which is in your documents\aerofly folder when it loads the aircraft it will write out what is wrong.

    If you have copied the tmd file from another aircraft then you have to basically clean out the graphics section except one rigidbodygraphics object which is attached to the fuselage. You can then add all objects in the geometry list for testing.


    I'm actually not sure what the minimum tmd looks like nowadays. We usually start with a similar aircraft and than modify the physics (e.g. add wheels, gear, more wings, actuators...) and redo the entire graphics section and also adjust the sounds.


    if you check out the wiki, I've recently added a few code snippets:

    https://www.aerofly.com/dokuwiki/doku.php/aircraft:tmd


    Essentially:

  • Hi Jan


    Thanks for the reply and very useful link to the wiki.


    Apart from the DynamicsObjects section that's pretty much what I had done. so added this section from f18 but no luck yet


    Tm.log shows this concerning f104g


    1.82-tmimage: loading model f104g...

    1.83-tmmodelmanager: model: (name='f104g') (directory='C:/Users/ste/Documents/Aerofly FS 2/aircraft/f104g//')

    1.83-tmimage: loading configfile 'C:/Users/ste/Documents/Aerofly FS 2/aircraft/f104g///f104g.tmc'

    1.83-tmmodule: contact points 3: (0.440 0.950 -1.197 r=0.150) (0.440 -0.950 -1.197 r=0.150) (-4.598 0.000 -0.382 r=0.060)

    1.86-tmmodelmanager: number of stars = 1572

    1.94-tmimage: loading dynamics begin 'C:/Users/ste/Documents/Aerofly FS 2/aircraft/f104g///f104g.tmd'...

    1.94-tmmodelmanager: loading dynamics end: (id=1) (0 dynamics) (0 graphics) (0 sound) (ny=0) (nz=0)

    1.94-tmmodelmanager:

    1.94-tmmodelmanager: mass: 0.000000kg


    and this a little later in the file


    8.02-tmcollision: ERROR: (tm2file::LoadFile failed. error loading file 'C:/Users/ste/Documents/Aerofly FS 2/aircraft/f104g/copilot.tmc')


    copilot.tmc ?? can't find any aircraft with this file


    Will plod on tomorrow


    Steve

  • Hi Steve,


    ummm it says loading dynamics end: 0 dynamics, 0 graphics, 0 sound so it didn't create any objects, and it says mass 0 (no rigidbodies have been created).

    Are you using the new syntax for the tmd structure? The one with <[pointer_list_tmuniverse][DynamicObjects][] and with "modelmanager" and not the old <[int32][dynamics][0] ...


    You can ignore the copilot.tmc file. I mean you could just create a blank file to get rid of this message but it shouldn't affect the loading at all.

  • if you check out the wiki, I've recently added a few code snippets:

    https://www.aerofly.com/dokuwiki/doku.php/aircraft:tmd

    Thanks for progress on the Wiki Jan. I'd love to do an aircraft project one day, but lack of documentation puts me off at the moment. This is already a step forward. (I will fly a Cessna 208 in Aerofly even if I have to make it myself :))


    Is the XML-ish format that IPACS uses something developed in house? I've been tempted to whip-up a quick app that converts it to XML and back again


    Something like XML Notepad could then be used to edit this stuff hierarchically, which I think would be a lot easier for the large TMD files.

    https://github.com/Microsoft/XmlNotepad/wiki


    Example:

    Code
    1. <[string8][object][jet_engine]
    2. <[string8][Name][JetEngine]>
    3. <[string8][Body][Fuselage]>
    4. <[string8][ThrottleControl][ThrottleInput.Output]>
    5. <[float64][MaximumThrust][10000.0]>
    6. >

    Converts to


    Code
    1. <object type="string8" value="jet_engine">
    2. <Name type="string8" value"JetEngine" />
    3. <Body type="string8" value"Fuselage" />
    4. <ThrottleControl type="string8" value"ThrottleInput.Output" />
    5. <MaximumThrust type="string8" value"10000.0" />
    6. </object>
  • Hi Jan


    Having a bit of a mare this morning as aircraft converter refuses to work, tried re-install and registry clean but still no work so loading fs2 onto my development system to see if it will work there.


    I am using the f18 as a working copy. In an effort to make things easier I attached all my geometry into 2 objects to make working with a base TMD file easier, ie only 2 entries, but I have not been able to check this out due to the above problem.


    Hi Nickhod


    Any tools to make things easier will be much appreciated, I believe the only thing stopping aircraft development is the TMD file. To programming types it will look ok but to us mere modellers it's going to take some getting used too. Perhaps an export tool that writes a basic TMD file might help. I have noticed the tm.log file produced by the exporter contains much of the information required, ie names, location, pivot axis etc


    The way you whip up files you should have it done by, err what time is it now 11.21, ok I'll give you to 11.24 ;)


    Steve

  • To programming types it will look ok

    It looks horrendous to this programming type too!


    I get why they've done this, you can parse this a lot faster than you can parse XML, but XML as the intermediate format would have been preferable.


    For example, if Jan's bare bones TMD file was XML, you could see the hierarchy in a free XML editor and also edit the values in the text box in the bottom left of the screen. Any syntax errors would be validated.


    I'll have a look at writing a two-way converter as I think it would be useful for the scenery stuff too.



  • OK this is getting tedious now


    Have installed FS2 onto my developer machine, as other system also fails to work


    I right click on f104g folder and run the aircraft converter. I get an error saying,


    Cannot load aircraft - set Aerofly Fs 2 folder in config.tmc


    Only config.tmc file I can find is in


    C:\Users\ste\Documents\Aerofly FS 2 Aircraft Converter


    Inside this file it clearly points to the correct folders


    <[string8][UserFolder][C:/Users/ste/Documents/Aerofly FS 2/]>


    <[string8][DesktopFolder][C:/Program Files (x86)/Steam/steamapps/common/Aerofly FS 2 Flight Simulator/]>


    Before I go paint the white lines on the motorway with a paint brush in the dark can anyone spot my very obvious (but not to me) error


    Thanks Steve


    My vote goes to Lord Nickhod

  • Hi Steve,


    yes you need a copy of the tmd and tmc files in the intermediate directory, together with the exported model in form of a tgi file and all of the textures as bitmaps. On that folder you can launch the converter which will copy the tmd, tmc over to the aircraft directory, convert all textures, 3d model and sounds.

    The tmd that you have in the intermediate folder has to be a tmd that could be loaded by aerofly, at least for the preview image rendering.


    DId you find the aircraft tutorial in the wiki and does the converter work for that aircraft? That would be a good check if your tools are installed correctly, the rest is probably just caused by some mistakes in your tmd file and not actually an issue of installation. Do you have skype? Write my a PM if you do, I'd like to explain the tmd in a screen-sharing session, maybe together we can find the mistake(s).


    Maybe you could upload your tmd file here (or via pm) and I'll go over it, maybe I can find an error.



    [off topic]


    nickhod Please don't spend too much time with trying to make aircraft tools, I already have a decent aircraft editor which works in 3D and has become totally OP in the last couple of months. This tool is not yet available to the public, there are things I need to iron out... needs an undo/redo function for example.

    It can load a tgi.txt file (from the exporter) to show the geometry, select parts and extract pivots from the export or manually pick vertices, It shows the physics geometry (e.g. wing and fuselage, position of masses, etc.), and it has a very handy debugger, instant refresh when a file is saved externally, functions like move, rotate, mirror or physics objects and control clickspots (with multi-select) and a lot more. And last but not least: it preserves the comments and indentation when you edit the file and then save it.





    This is the perfect tool to assist in making an aircraft or will be when I eventually get to publish it. Personally for editing the files I use Visual Studio 17. Its text editor is pretty good, allows multi-row block edit and offers other useful tools and allows me to split the text editor view into pretty much any configuration I can think of (left/right, all four corners, 3 columns, 4 columns, top/bottom,...)

  • Hi Jan


    I thank you for your offer and will no doubt take you up on it in the future.


    I am slowly understanding the TMD file and process a little better. I have come to the conclusion I need to make the model simpler in terms of number of objects, I have been thinking more with my aircraft engineering brain, perhaps over complicating things when I do not need too. I guess more objects just means more entries in the TMD. So a bit more thought needed there and some streamlining. Its not helped by the Starfighters complicated gear.


    I did manage to get the model to show in the aircraft menu, looked like it had just left the runway rather than sat on its wheels, I could select it and .....well it didn't appear in the sim but its progress at least, and the sim didn't crash this time so another bonus.


    Tool looks as good as Nickhod suggests and I agree with him, much needed if we are going to get more 3rd party aircraft.


    Thanks again


    Steve

  • Its not helped by the Starfighters complicated gear.

    Hi Steve,


    I take it you are building a Lockheed F-104 Starfighter, that's a very nice aircraft, my old boss had a hundreds hours on them :-)


    Looking forward to seeing your screenshots :-)


    Cheers,


    Paul

    Windows 10 64bit | iCore7-7770K| ASUS STRIX Z270E |KHX2400C15D4 - 32GB | Gigabyte Ge-Force GTX 1080Ti| SSD Intel 520 Series | 40" Philips BDM4065UC/75 4K - Oculus Rift

  • Hi Jan


    Could you possible explain how you work out the inertia length


    <[tmvector3d][InertiaLength][ 0.404930 -0.355130 0.765910 ]>


    Also


    How do we input an axis that is rotated. The Starfighters gear rotates at approx 45 degrees.


    I can see why people give up when they reach the TMD file, good thing about being old is we get stubborn so I'll keep bashing away at it. Yes I know I could have gone for a simple aircraft but where's the fun in that ;(


    Thanks


    Steve (with a brain that hurts)

  • The rigidbodies in Aerofly are box-shaped with a mass and a certain dimension, the InertiaLength. That length is used to calculate the inertia of the rigidbody. The higher the values the more torque required to rotate the object (principle of angular momentum).


    We use a solid cuboid to easily modify the inertia around the each of the three main axes of inertia:

    https://en.wikipedia.org/wiki/List_of_moments_of_inertia


    We get these values either from bounding box dimensions from the modelling tools or by estimation. The precise value is not that important, I wouldn't be able to tell a difference in behavior even if its 5% increased or decreased.


    For a landing gear: just estimate the physical size (e.g. 0.4m long, 1.1m wide and only 0.2m thick... that would give you: 0.4 1.1 0.2

    Make sure all values are positive though... I see you set a negative value (or found one, where??? :D) that would be like dealing with negative masses.


    Note: the inertia length represents the dimensions of the object in the local coordinate system. So if you rotate the rigidbody with the B0 matrix the inertia axes rotate with it, so you need to work out at which angle the gear is attached to the fuselage, say 30 degrees, then just plug that into my handy rotation matrix generator: https://www.aerofly-sim.de/dow…rotation-matrix-generator

    and out you get the B0 matrix for your gear: (I hand drew it in)





    I can offer to set up the landing gear for you. That is the most tricky thing you need to do in Aerofly.

    If you send me your converted aircraft files (your starfighter aircraft folder) together with the tgi.txt file (needs to be enabled in the plugin before exporting I think...) then I can view your aircraft in my editor and set up all the annoying physic objects.

    We know that it is a bit overwhelming to set this up without any help and we don't want the user projects to fail just because of this, so we're here to help you with your first aircraft(s).

  • Hi,


    I hope it's okay when I hijack the thread. I was batteling with the tmd file since yesterday and didn't get anywhere.


    I have been reading in the wiki and converting the DR400, so I understand the basic idea and my setup works.


    So far I have only exported the fuselage and wings of my own project. I used the tdm file of the DR400 and cutted it down to what I need


    That's how it looks like:



    It compiles, but the preview is empty and the report tells me for all 3 geometries "unreferenced geometry"


    I see in the wiki

    Quote


    Referenced object does not exist (e.g. trying to call .Output on an object that is not defined in the scope of the same section)


    To be honest, it doesn't tell me anything. Could someone please bring a bit light into it?


    Thanks a lot!


    Cheers,

    Kai

  • Hi Kai


    I did the same as you and achieved the same results. The preview is nothing more than an image of the compiled aircraft, strangely enough its the 3d model that's in the modelling program so something is going right. If its been produced you can look at this image in your intermediate folder. In my case its preview_f104g.tiff and shows the model perfectly


    I believe things are a lot more involved than just a bare minimum approach which is what we are trying to achieve, ie a model we can just look at in the sim. In my view the exporter would be better to produce a sample TMD file with all the relevant entries as a starting point.


    By the time we're done we'll all be working for NASA as rocket scientists :D


    Steve