Giter VIP home page Giter VIP logo

Comments (10)

seanmcleod avatar seanmcleod commented on May 24, 2024

I looked at this very briefly the other day when testing the CMake support in VS2017. I thought it may be trivial in terms of just fixing simple things like changing print statements into print functions etc. to make then compatible with both python 2 and 3.

But it looks like we'll need to look into the differences between bytes and strings between python 2 and 3, in particular with SGPath.

`ERROR: testAircrafts (main.CheckAircrafts)

Traceback (most recent call last):
File ".\CheckAircrafts.py", line 45, in testAircrafts
fdm = CreateFDM(self.sandbox)
File "C:\Users\Sean\CMakeBuilds\3f00c6d9-d323-5a32-8a90-665138817fd4\build\x64-Release\tests\JSBSim_utils.py", line 53, in CreateFDM
_fdm = jsbsim.FGFDMExec(root_dir=os.path.join(sandbox(), ''))
File "jsbsim.pyx", line 142, in jsbsim.FGFDMExec.cinit (tests\jsbsim.cxx:3025)
File "jsbsim.pyx", line 308, in jsbsim.FGFDMExec.set_root_dir (tests\jsbsim.cxx:5541)
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string (tests\jsbsim.cxx:8873)
TypeError: expected bytes, str found`

from jsbsim.

agodemar avatar agodemar commented on May 24, 2024

FYI
I have added a folder Jupyter_Notebooks in the reference manual repository here.

The folder contains a couple of preliminary tests made via Jupyter notebooks (formerly IPython) running a Python 3 kernel. There are some helper classes defined in the subfolder python which are designed to perform multiple JSBSim simulations. The classes are adapted from this work that I did in collaboration with one of my former students and colleagues at Fraunhofer Institute for Wind Energy Systems, IWES (Germany).

I run my simulations in Windows and I've put a recent build of JSBSim.exe (not uploaded) in the subfolder JSBSim.

from jsbsim.

seanmcleod avatar seanmcleod commented on May 24, 2024

So you didn't have any issues then with using Python 3 to call into the JSBSim code? Actually taking a quick glance at some of your Python code it looks like you're using os.system('JSBSim.exe --script...') to execute instances of JSBSim then and you're not using the Python API wrapper to call the JSBSim classes directly from Python?

from jsbsim.

agodemar avatar agodemar commented on May 24, 2024

... you're not using the Python API wrapper to call the JSBSim classes directly from Python?

In fact, that was my approach. But I would love to adapt that work in order to use a Python 3 API wrapper. We might use it to make reports on engineering flight simulations via Jupyter.

from jsbsim.

agodemar avatar agodemar commented on May 24, 2024

FYI
I'm continuing to create more Jupyter notebooks (with Python3 kernel) to check various aspects in JSBSim ecosystem. Here is one that parses FDM config files, searches for tabular data, and make plots: Jupyter_Notebooks/02_reading_jsbsim_config.ipynb

from jsbsim.

seanmcleod avatar seanmcleod commented on May 24, 2024

@agodemar perfect, I was actually starting to write something very similar. My aim is to given an FDM generate a set of plots for a visual/graph representation, e.g. Cl vs AoA, Cd vs AoA, Cl vs Cd, plus graph the individual items that make up for example Cd, so Cd0, Cdi etc.

Did you notice the funny kink in the ground effect curve of your C172 versus the one retrieved from GitHub? I checked in a fix for the kink a while ago.

from jsbsim.

agodemar avatar agodemar commented on May 24, 2024

@seanmcleod Jupyter notebooks can help a lot in creating reports on FDM config files as well on results. The classes that I've put here have been designed with that in mind. They need to be enhanced with the task you were mentioning:

given an FDM generate a set of plots for a visual/graph representation, e.g. Cl vs AoA, Cd vs AoA, Cl vs Cd, plus graph the individual items that make up for example Cd, so Cd0, Cdi etc.

Yes, I did notice the kink and I knew you submitted a smother version of that curve.

from jsbsim.

seanmcleod avatar seanmcleod commented on May 24, 2024

@agodemar yep I've used Jupyter notebooks on other non-JSBSim related projects.

In terms of plotting data from the FDM I was thinking of using the JSBSim python API in order to be able to evaluate functions that are defined rather than parsing the xml looking for table data etc.

So for example if Cdi is defined as a function using Cl^2 etc. the graphing code would evaluate it as well as handling functions with table data.

The Cdi based on Cl^2 is actually more complicated since the code would need to first lookup the Cl values from the Cl vs AoA function and then use those when evaluating the Cdi function etc.

from jsbsim.

bcoconni avatar bcoconni commented on May 24, 2024

FYI @ezietsman made the pull request #23 to update the tests to Python 3.6 and keep them compatible with Python 2.7. The PR is currently needing some changes before being merged but this is just a matter of a couple of details. I am confident they should be resolved quickly.

from jsbsim.

bcoconni avatar bcoconni commented on May 24, 2024

@agodemar and @seanmcleod The PR #23 has been merged. I think we can close 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.