SilentSys / orhelper

orhelper is a module which aims to facilitate interacting and scripting with OpenRocket from Python
GNU General Public License v2.0
16 stars 18 forks source link

Question about extracting meaningful data from launch and exporting "Design Report" pdf with orhelper #4

Open yuriachermann opened 3 years ago

yuriachermann commented 3 years ago

Hey, SilentSys!

I was wondering if it's possible to retrieve some important values from the rocket and the launch using orhelper, like:

And export as well the Design Report pdf file.

Do you have any idea on how to do that? Thanks in advance!

Att, -Yuri Achermann

SilentSys commented 3 years ago

Yes. See the FlightDataType enum in _enums.py for all that is available. You will use Helper.get_timeseries() with the enum -- lazy.py and simple_plot.py contain examples on how to use this.

As these values change with time, you will need to interpret the time series yourself depending on what you are looking for (e.g. max value of the velocity time series).

You can also use Helper.get_events() to see at what times deployment, landing, etc. occur that and then extract that value from the time series if you wish.

SilentSys commented 3 years ago

As for the design report PDF, orhelper currently does not have any helper methods for this. You can however look at the OpenRocket Java code and call whichever function is required. I could add this feature to orhelper in the future if it is useful.

yuriachermann commented 3 years ago

Exporting the design report but mainly adding new motors throw the script would be amazingly useful for my applications. I can try to implement this but I know very little of Java... If you could just point me the way would be great!

SilentSys commented 3 years ago

Helper.load_doc() is a great simple example on how to interact with java from Python, its quite intuitive/natural really. All the objects constructed and methods called in that function are from Java. You can look at the jpype docs if you want to learn more about this.

When referencing OpenRocket code, you want to look at commit f3440bac6846fd60da5dcac76e772f0539541e69 as that is the release for v15.03. It looks like the printing and design report stuff is in openrocket/swing/src/net/sf/openrocket/gui/print/. Aka net.sf.openrocket.gui.print in Java or accessible in the Python Helper by self.openrocket.gui.print.

Not sure exactly what you mean by adding new motors, but I recommend you clone the OpenRocket repo, checkout that commit hash, and then use a Java IDE to search around for what you need.

If you use an IDE like PyCharm, I find it useful to place a breakpoint somewhere in your Python project and then you can use the evaluation feature to inspect and play with all the Java classes and variables.

If you do implement this, please open a pull request so that we can make that feature available to everyone.