Comments (9)
@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.
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.
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.
@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.
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.
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.
@seanmcleod Neither of those examples are directly indexing properties in the property tree.
from jsbsim.
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.
@seanmcleod
What is the way forward about this issue ?
from jsbsim.
Related Issues (20)
- JSBSim Simulink Function HOT 36
- Rust HOT 13
- Can autopilot feature come to jsbsim- unreal engine 5? HOT 2
- MSVC: toupper is not a member of std HOT 1
- Missing target_include_directories in libJSBSim
- JSBSIM_ prefix in CMake options
- Cython warnings about 'tp_print' which is deprecated
- Wrong calculation of vPQRdot in FGAccelerations class HOT 4
- Fixing the mixture for JSBSim piston aircraft HOT 54
- Request: turbine spindown table or property support HOT 2
- Aircraft crashed on air when rolling consecutively HOT 15
- How Jsbsim models the "+" shaped tail fins of missiles and rockets. HOT 1
- After changing pitch and long initial conditions the yaw angle changes also for no reason HOT 1
- JSBSim interface to Matlab on Windows: throttle command from joystick doesn't work HOT 5
- Trim succeeds and results in NaN values HOT 1
- JSBSim and s-function have different results and different reactivity themselves HOT 1
- Building for Unreal 5 on Linux not working HOT 7
- Javascript alternative? HOT 2
- Linearization and simplex trim from console executable and xml script HOT 16
- FGTurbine Shutdown Spin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbsim.