Giter VIP home page Giter VIP logo

Comments (9)

seanmcleod avatar seanmcleod commented on May 23, 2024 1

@bcoconni I've assigned it to myself in the meantime. I had started writing some code at the time to test out my proposal of having the script code generate multiple set entries for any that use a -1 index, but then got distracted with other things. I'll have to revisit the code.

from jsbsim.

seanmcleod avatar seanmcleod commented on May 23, 2024

What I also noticed is that if I refer to the property without an index then the script appears to take that as an alias for the 0 index, e.g.

    <event name="Increase Throttle">
      <description>Increase throttle to max</description>
      <condition> simulation/sim-time-sec >= 1.0 </condition>
      <set name="fcs/throttle-cmd-norm" value="1" type="FG_RAMP" tc="2" />
    </event>

Based on looking at the logged values for the 2 engines, i.e. I see the thrust increasing for engine 0 but no change in thrust for the other engine.

from jsbsim.

andgi avatar andgi commented on May 23, 2024

I think both issues here are by the design of the property tree. That the property fcs/throttle-cmd-norm
is the same as fcs/throttle-cmd-norm[0] certainly is - and you wouldn't want to have it differently since it'd be ugly and impractical to end the name of all single properties by "[0]".

from jsbsim.

seanmcleod avatar seanmcleod commented on May 23, 2024

@andgi so you're suggesting that you think that some-property[-1] isn't supported by the property tree by design. In which case is the -1 convention as seen and supported by functions like FGFCS::SetThrottleCmd(int index, double setting) only available to C++ code and not via script?

from jsbsim.

andgi avatar andgi commented on May 23, 2024

Yes, I think so. The property tree code (while not the script interface) comes from FlightGear/SimGear and I've never ever heard about any "-1" indices. Given that the tree can be serialized into XML (also by design) indices outside 0, 1, ... would be very strange indeed. (As would non-continuous ranges of indices but I think those are supported, though.)

Is it a very big problem to repeat the set-element for each engine?

Of course you could add a special case in the script parser fcs/throttle-cmd-norm[-1] but then someone else wants it for some other engine properties, and for all gear units and....

from jsbsim.

seanmcleod avatar seanmcleod commented on May 23, 2024

I had come across the -1 option for FGFCS::SetThrottleCmd() a couple of years ago while developing a simulator for test pilot training where I needed to support single and multi-engine models using a single physical throttle that I was interfacing with and so used the -1 option for convenience.

Then more recently I noticed a bug in the engine initialization code for handling <running> -1 </running> elements, see - #101.

So I assumed that there was general support for the -1 index option 😉

In terms of whether it's a big problem to add repeated <set> elements the main issue is I'm trying to write a script, in this case an acceleration test, that is agnostic to how many engines there are, i.e. ideally I'd like to be able to invoke the script for any aircraft independent of exactly how many engines it has.

IF we decided to add more support for the -1 index I wouldn't special case fcs/throttle-cmd-norm.

My thinking is that the script code would detect the -1 index and in that case internally it would query the property manager to figure out exactly how many indices have been created for that property and it would then generate multiple <set> elements internally to match the number of actual indices.

That way script writers could write scripts that are agnostic to the exact number of indices for properties that they want to set uniformly for a range of indices, e.g. across engines etc.

from jsbsim.

andgi avatar andgi commented on May 23, 2024

@seanmcleod Neither of those examples are directly indexing properties in the property tree.

from jsbsim.

seanmcleod avatar seanmcleod commented on May 23, 2024

Correct, but they led me to believe as a user that there was a good chance that the some-property[-1] case in a script would also be supported given that the C++ API FGFCS::SetThrottleCmd() supported it and the initialization file also supported the use of a -1 index to allow an operation across all indices.

And I think it would be a useful feature for users writing scripts, particularly as I mentioned for writing scripts that want to work across aircraft with varying numbers of engines as one example, and any other aircraft properties exposed via indices.

from jsbsim.

bcoconni avatar bcoconni commented on May 23, 2024

@seanmcleod
What is the way forward about this issue ?

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.