Giter VIP home page Giter VIP logo

Comments (11)

OpenUAS avatar OpenUAS commented on May 23, 2024 1

Maybe time then to close this issue? @bcoconni your remarks look wise and indicating years of real life development experience, thanks 🥇 Hope to see you working on JSBsim in the long long future.

from jsbsim.

 avatar commented on May 23, 2024

One more example -- distance functions for each INS waypoint:

https://gitlab.com/mdanil/Tu-144/blob/master/Tu-144-jsbsim/NPK/Orbita/func/dist.xml

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

@Mike402
There are already some features in JSBSim to handle the duplication of XML definitions. At the moment they are limited to:

  • engines definition where you can use the special character # to replace the engine number.
  • file inclusion with the file= attribute

If we plan to extend that to other elements, I think we should design how the thing should work before going any further. An important point to my view is consistency with the existing features.

Suggestions ?

from jsbsim.

 avatar commented on May 23, 2024

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

@Mike402 @abassign
To respond to the request of reducing the duplication of XML code in your aircraft models, I just pushed a new commit a7574e8 to JSBSim and 27ddcedad to FlightGear that allows to use "template functions" everywhere in JSBSim. The idea is to have generic functions which can be repeatedly used in the aircraft models.

For example, say you need to multiply some values by 2 in several places in your model. First, you need to declare a template function like below:

<function name="twice" type="template"> <!-- the type "template" tells JSBSim that it is a special function that will be evaluated later -->
  <product>
    <property> # </property> <!-- The character # stands for the variable of the function -->
    <value> 2.0 </value>
  </product>
</function>

Notice in particular the usage of the special character #. It can appear several times in a given template function.

The second step is to use that template function everywhere you need it. For that you must use the attribute apply of a property.

<function name="fct1">
  <sum>
    <pi>
    <property apply="twice"> prop1 </property> <!-- the attribute apply="twice" tells JSBSim to apply the template function "twice" to the property "prop1" before proceeding to the evaluation of the function "fct1"-->
    <sin>
      <property apply="twice"> theta </property> <!-- same as above -->
    </sin>
  </sum>
</function>

This is equivalent to

<function name="fct1">
  <sum>
    <pi>
    <product>
      <property> prop1 </property>
      <value> 2.0 </value>
    </product>
    <sin>
      <product>
        <property> theta </property>
        <value> 2.0 </value>
      </product>
    </sin>
  </sum>
</function>

The feature is available in the branch next of FlightGear. Could you please test that feature and give feedback in that issue report ? Since you both requested to have a feature similar to that, or asked for new functions, I suppose that you can be beta testers ? 😃

from jsbsim.

 avatar commented on May 23, 2024

Thanks, it will take me a while to wrap my head around this and come up with an efficient use scheme, but this already looks useful!

I think #84 can be merged with this issue, as now there's cyclic clipto, and beside that sawtooth functions can be done as templates?

from jsbsim.

 avatar commented on May 23, 2024

But I can immediately say that if the number of arguments is limited to 1, this would be limited to only the simplest use cases?

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

But I can immediately say that if the number of arguments is limited to 1, this would be limited to only the simplest use cases ?

I am sure people can be creative about using such a feature 😃 And I'd rather discuss about how to solve a problem on a real case rather than jumping to negative conclusions. This is not very supportive regarding the amount of time that has been involved in developing this feature 😭

from jsbsim.

 avatar commented on May 23, 2024

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

No no I didn't meant to say it's useless, I, for one, can immediately think of a hundred uses for it in my plane.

This was purposely provocative 😈 to point out that we should focus on problem solving rather than on general statements. I'm sure you will find plenty of creative ways to use the template function feature 😄

I'm just saying that with multi-argument support it would have been maybe five hundred.

Right but we should move one step at a time.

My plan is to collect feedback about the current implementation of template functions with uses, problems and bugs issued from real case uses. Only then we might consider improvements or changes to the feature.

I have had bad experiences about over-engineering things due to wrong anticipations of future needs of users. This ended up with additional, almost useless, code to maintain for backward compatibility and a redesign of the feature.

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

@OpenUAS I guess you are right. We got no feedback on that feature for 2 years now, it seems it's time to close the issue now.
If someone wants to report some bugs/feature request please open a new issue. Feedback and support will be handled in Discussions.

Hope to see you working on JSBsim in the long long future.

I've been involved in the project for more than 10 years now. Who knows may be there are some more 10 years of involvement ahead of me ? 😄 Anyway thanks for the positive feedback it's always very much appreciated 👍

from jsbsim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.