-
Hi, I am working on a little side project that uses the python interface to JSBSim. I would like to do script-based initialization instead of defining initial conditions in an xml file (for future flexibility.) However, when I try to do a ground trim I end up with all my gear points (including all the hard contact points) making contact and the plane immediately bounces in the air. Question: is there any examples or tutorials of how to do a purely python-script-based ground trim? I haven't been able to find anything that doesn't just load initial conditions out of an xml file. Otherwise I just realized I don't have all my most recent changes committed, but later this evening (or tomorrow) I could post a link to my python code if anyone was willing to try it out and help me. I tried to work on this a few months ago and finally gave up, but was able to at least get things started mostly reliably by using trimType=6 (no trim at all.) But I'd really like to get this and in-air trims working from python. At the end of the day I want to be able to specify and airport or runway or 5 mile final or any place for startup similar to how it is done in FlightGear. Can any one offer any help or insights or point me to a good working example? Thanks in advance! Curt. (yes that Curt ... I have not messed with this stuff for at this level for many years so I have forgotten everything I once knew and have become dumb again, but I have a uav project I've been still working on and I'd like to beef up my simulation portions. ) :-) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Ground trim can be done with Python by setting the initial conditions properties then by setting the property Lines 61 to 63 in 70505e6 Note that an exception jsbsim.TrimFailureError will be raised if the trim fails.
|
Beta Was this translation helpful? Give feedback.
-
Hi Bertrand, thanks once more for your patience in walking me through this learning (debugging?) process. If it helps, the version of the model I am attempting to trim can be found at the following link It should be a straight copy of the jsbsim portions of the FlightGear Rascal110 model: https://github.com/NorthStarUAS/Simulator/tree/main/nstSimulator/data/models_jsbsim I agree those pre-trim values are clearly weird and wrong, but is that something I am responsible for setting? (and if so, what is the recommended way to set them? ... I am trying to do this all dynamically from a python script and not use xml init files.) My naive expectation is that JSBsim would initialize all it's important values to 0 or whatever values are necessary for the code to function correctly? The aero/engine/prop model comes right out of FlightGear and sadly I am not yet familiar enough with JSBSim to determine if everything is setup correctly? The top level xml file appears to have the following basic structure: <fdm_config>
<propulsion>
<engine>
<thruster> I apologize again in advance for not jumping into the discussion here knowing enough to provide all the important details up front, so please feel free to continue to ask for what you need me to do to figure this out. Thanks again! Curt. |
Beta Was this translation helpful? Give feedback.
Ground trim can be done with Python by setting the initial conditions properties then by setting the property
simulation/do_simple_trim
to 2.In the example below, the pitch angle
theta-deg
is set to 0 then the ground trim is triggered.jsbsim/tests/CheckTrim.py
Lines 61 to 63 in 70505e6
Note that an exception
jsbsim.TrimFailureError
will be raised if the trim fails.