Skip to main content

Interact and script with OpenRocket from Python via JPype, with enhanced capabilities for simulations and computational workflows

Project description

orlab

orlab is a Python module designed to simplify interaction and scripting with OpenRocket from Python. It leverages JPype to bridge Python and Java, enabling seamless control over OpenRocket's functionalities. Currently, it supports access to simulation capabilities given an .ork file, with the goal of future expansion to enable more sophisticated computational engineering workflows.

This project is an evolution of the original orhelper library, which hasn't been maintained recently and is limited in scope. orlab supports current OpenRocket versions (the package root is detected from the jar automatically), reorganizes the code for better structure, and plans to incorporate additional features.

Table of Contents

Prerequisites

Before installing orlab, ensure you have the following installed on your system:

  • An OpenRocket jar — the version is detected automatically:
  • Adoptium JDK 17 LTS (or higher?)
  • Python version 3.10 or higher

Installation

  1. Install the Package

    Install orlab using pip:

    pip install orlab
    
  2. Install Java JDK

    See Setting Up the JDK for more details.

  3. Download OpenRocket JAR

    If you haven't already, download the OpenRocket .jar file:

    • Direct Download: OpenRocket-24.12.jar

    • Using wget on Linux:

      wget https://github.com/openrocket/openrocket/releases/download/release-24.12/OpenRocket-24.12.jar
      
  4. Point orlab at the jar

    Pass jar_path to OpenRocketInstance(...), or set the ORLAB_JAR environment variable. This step is only necessary if the .jar file is not located in the current directory.

    export ORLAB_JAR=/path/to/OpenRocket-24.12.jar
    

    Replace /path/to/ with the actual directory path where the .jar file is located. The legacy CLASSPATH variable also still works.

Setting Up the JDK

Linux

  1. Install Adoptium JDK 17 LTS

    Download and install the Adoptium JDK from the official website. Check the option to set / override JAVA_HOME, unless you have a specific reason not to in which case pass jvm_path= to OpenRocketInstance.

  2. Set the JAVA_HOME Environment Variable

    If JPype doesn't automatically detect the JDK, manually set the JAVA_HOME environment variable:

    • Find Installation Directory:

      Locate where Adoptium JDK is installed, e.g., /usr/lib/jvm/adoptium-17.

    • Edit ~/.bashrc:

      Open the .bashrc file with your preferred text editor:

      nano ~/.bashrc
      
    • Add the Following Line:

      export JAVA_HOME="/usr/lib/jvm/adoptium-17"
      
    • Apply Changes:

      source ~/.bashrc
      

Windows

  1. Install Adoptium JDK 17 LTS

    Download and install the Adoptium JDK from the official website.

  2. Set Environment Variables

    • Open Environment Variables Settings:

      Navigate to Control Panel > System > Advanced system settings > Environment Variables.

    • Add JAVA_HOME:

      • Click on New under System variables.
      • Set Variable name to JAVA_HOME.
      • Set Variable value to the path where Adoptium JDK is installed, e.g., C:\Program Files\Eclipse Adoptium\jdk-17.
    • Update PATH:

      • Select the Path variable and click Edit.
      • Click New and add %JAVA_HOME%\bin.
    • Apply and Close:

      Click OK to apply the changes.

Usage

After installation and setup, you can start using orlab to interact with OpenRocket. Refer to the examples/ directory for sample scripts demonstrating various functionalities. The package must be installed (pip install orlab, or pip install -e . from a clone) before running them — the source now lives under src/ and is not importable from the repository root.

For more detailed information and advanced usage, consult the OpenRocket Wiki on Scripting with Python and JPype.

API docs are a work-in-progress, for now see the examples folder for usage.

Development

If you wish to contribute or modify orlab, follow these steps:

  1. Clone the Repository

    git clone https://github.com/yourusername/orlab.git
    cd orlab
    
  2. Install Dependencies in Editable Mode

    pip install -e .
    
  3. Make Your Changes

    Modify the codebase as needed. Ensure that your changes are well-documented and tested.

  4. Run Tests

    (Assuming tests are set up)

    pytest
    
  5. Submit a Pull Request

    Push your changes to a forked repository and submit a pull request for review.

Credits

  • The original orhelper project by SilentSys
    • Richard Graham for the original script: Source
    • @not7cd for initial organization and cleanup: Source
  • All contributors to the OpenRocket project over the years

Feel free to contribute, report issues, or suggest enhancements!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orlab-0.5.0.tar.gz (295.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orlab-0.5.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file orlab-0.5.0.tar.gz.

File metadata

  • Download URL: orlab-0.5.0.tar.gz
  • Upload date:
  • Size: 295.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for orlab-0.5.0.tar.gz
Algorithm Hash digest
SHA256 51b7b7023622456e310910787d0972812979caf54bb2e74bd8c9d7634c69ec3d
MD5 01124134aa2c566b6b7fcde472be9acf
BLAKE2b-256 ee335094a51f4fdcff4f08ac536f4dd8645b9b14379d96c77aa19de3ed034ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for orlab-0.5.0.tar.gz:

Publisher: release.yml on CameronBrooks11/orlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orlab-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: orlab-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for orlab-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8237b714ff6b5afc878dca9d1e082eb7d6f7ba9112ca96dbb8fc17325cf8b2
MD5 f8ed3178e47ea7d2e78f4a042f963706
BLAKE2b-256 40cb4f2ad2b01b538db70af6911c7d58d8f0fb31a494f4b7379dbcbbbed6836f

See more details on using hashes here.

Provenance

The following attestation bundles were made for orlab-0.5.0-py3-none-any.whl:

Publisher: release.yml on CameronBrooks11/orlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page