Skip to content

Adding free flight simulations#66

Closed
camUrban wants to merge 1444 commits intomainfrom
feature/free_flight
Closed

Adding free flight simulations#66
camUrban wants to merge 1444 commits intomainfrom
feature/free_flight

Conversation

@camUrban
Copy link
Copy Markdown
Owner

@camUrban camUrban commented Nov 24, 2025

Description

This PR adds the ability to perform simulations that couple an airplane's motion to the aerodynamic forces due to its motion.

Motivation

Adding coupled simulations increases the use-cases of Ptera Software beyond pure aerodynamic investigations and makes it more attractive for general robotics simulations.

Relevant Issues

Closes #65 and improves upon solution to #50.

Changes

  • Adds the CoupledOperatingPoint class to pterasoftware/operating_point.py
  • Adds the CoupledMovement class to pterasoftware/movements/movement.py
  • Adds the CoupledUnsteadyProblem class to pterasoftware/problems.py
  • Adds the CoupledSteadyProblem class to pterasoftware/problems.py
  • Adds pterasoftware/mujoco_model.py, which contains the MuJoCoModel class.
  • Adds pterasoftware/coupled_unsteady_ring_vortex_lattice_method.py, which contains the CoupledUnsteadyRingVortexLatticeMethodSolver class.
  • Updates pterasoftware/__init__.py to import the new modules.
  • Fixes inconsistency in UnsteadyRingVortexLatticeMethodSolver's _calculate_loads method where it was using different functions for calculating the cross product for each LineVortex leg.
  • Removes redundant increment of index variable in pterasoftware.output.animate.
  • Adds checks to prevent plotting non-existent wake RingVortex pterasoftware.output.animate and pterasoftware.output.draw.
  • Changes output formatting in output.print_results to display values in scientific notation for better readability across scales.
  • Introduces the rotationPointOffset_Gs_Ler parameter to WingMovement, allowing specification of a custom rotation point for wing angular motion.
  • Improves delta_time's "optimize" mode by tuning the local optimizer and introducing a fall back to dual annealing as a global optimizer.
  • Fixes a bug in delta_time's "optimize" mode where static cases weren't improved.
  • Speeds up test suite by removing redundant tests and using coarser mesh parameters for geometry fixtures.
  • Refactors CLAUDE.md to be significantly shorter by breaking up instructions and guidelines into other files in docs/. This uses the progressive disclosure strategy known to produce better results.
  • Adds MUJOCO_CONVENTIONS.md file with verified interpretations of MuJoCo's relevant inputs and outputs.
  • Adds animate_free_flight function in output.py, along with a few helper functions.

Temporary Debug Scripts to Remove Before Merging

  • debugging_scripts and all files within
  • docs/FREE_FLIGHT_DEVELOPMENT.md
  • gammabot_simulations and all files within

New Dependencies

  • MuJoCo

Change Magnitude

Moderate: Medium-sized change that adds or modifies a feature without large-scale impact.


Checklist

  • I have created or claimed an issue for this work as described in Contributing Code.
  • My branch is based on main and is up to date with the upstream main branch.
  • All calculations use S.I. units.
  • Code is formatted with black (line length = 88).
  • Code is well documented with block comments where appropriate.
  • Any external code, algorithms, or equations used have been cited in comments or docstrings.
  • All new modules, classes, functions, and methods have docstrings in reStructuredText format, and are formatted using docformatter (--in-place --black). See the style guide for type hints and docstrings for more details.
  • All new classes, functions, and methods in the pterasoftware package use type hints. See the style guide for type hints and docstrings for more details.
  • If any major functionality was added or significantly changed, I have added or updated tests in the tests package.
  • Code locally passes all tests in the tests package.
  • After pushing, PR passes all automated checks (codespell, black, mypy, and tests).
  • PR description links all relevant issues and follows this template.

@camUrban camUrban self-assigned this Nov 24, 2025
@camUrban camUrban added the feature New feature or request label Nov 24, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 289 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.43%. Comparing base (b7aa876) to head (7c8d10a).

Files with missing lines Patch % Lines
pterasoftware/output.py 12.45% 267 Missing ⚠️
pterasoftware/_mujoco_model.py 81.15% 13 Missing ⚠️
pterasoftware/_functions.py 69.23% 4 Missing ⚠️
pterasoftware/problems.py 95.65% 3 Missing ⚠️
pterasoftware/_transformations.py 96.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #66       +/-   ##
===========================================
- Coverage   91.50%   81.43%   -10.07%     
===========================================
  Files          32       34        +2     
  Lines        6450     7618     +1168     
===========================================
+ Hits         5902     6204      +302     
- Misses        548     1414      +866     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@camUrban camUrban added the dependencies Updates to a dependency file may be required label Nov 25, 2025
@camUrban camUrban force-pushed the feature/free_flight branch from f699d13 to f01d451 Compare December 5, 2025 04:21
AKHIL-149 and others added 24 commits December 11, 2025 19:25
The function now lives in _logging.py as part of the centralized logging
infrastructure. Also removed the now-unused logging import.
Added tests to verify the handler actually emits log messages and flushes the stream properly. This covers the core functionality that was previously untested.

Coverage improved from 86.44% to 97% for _logging.py.
Removes all internal logging configuration from solver run() methods and eliminates the logging_level parameter, requiring users to configure logging explicitly via setup_logging. Exposes setup_logging as a public API, updates documentation and examples, cleans up _logging.py, and updates tests to match the new logging approach. Progress bars are now always shown in the unsteady solver by default.
Renamed setup_logging to set_up_logging throughout the codebase for consistency. Added show_progress and show_solver_progress parameters to unsteady solver, trim, and convergence functions to control TQDM progress bar display. Updated example scripts and tests to use the new logging setup and progress options. Changed many info-level log messages to debug-level for less console clutter during normal runs.
Refactors set_up_logging to validate input types for level, handler, and format_string, raising TypeError for invalid types. Updates _convert_logging_level_name_to_value to handle logging level names case-insensitively. Removes the use_tqdm_handler parameter, always using _TqdmLoggingHandler by default. Updates and expands unit tests to cover new validation logic and case-insensitive level name handling.
Updated comments for clarity and consistency in test_logging.py.
Introduces the CoupledOperatingPoint class to represent operating conditions for individual Airplanes in free flight aerodynamic simulations. Updates module docstrings to reflect the addition and provides methods for dynamic pressure, transformation matrices, and freestream velocity calculations.
Introduces the CoupledMovement class to encapsulate multiple AirplaneMovements and their associated CoupledOperatingPoints for coupled unsteady simulations. Updates documentation in movement.py, __init__.py, and operating_point.py to reflect the new structure and clarify initialization and usage of CoupledMovement in CoupledUnsteadyProblems.
Introduces CoupledSteadyProblem and CoupledUnsteadyProblem classes to support coupled unsteady aerodynamic simulations. Updates docstrings and type annotations for clarity and consistency.
…interface with MuJoCo for free flight simulations

MuJoCoModel class includes methods for applying loads, stepping the simulation, extracting state, and resetting. Updates documentation and configuration files to include mujoco as a core dependency and configures mypy for the new module.
Refactored CoupledMovement, CoupledOperatingPoint, and CoupledSteadyProblem to operate on a single Airplane and CoupledOperatingPoint per problem instead of lists. Updated initialization, validation, and documentation to reflect this change, simplifying the interface and internal logic for coupled aerodynamic problems.
Introduces CoupledUnsteadyRingVortexLatticeMethodSolver for solving CoupledUnsteadyProblems with the unsteady ring vortex lattice method. Updates _functions.py and related logic to support the new solver, including load processing and panel attribute updates.
Introduces the animate_free_flight function to animate a CoupledUnsteadyRingVortexLatticeMethodSolver's Airplane, including support for wake vortex visualization and scalar coloring. Updates draw and related internal functions to handle the coupled solver, adds new helper functions for panel and wake surface generation in free flight, and refines type checks and error handling for streamline and wake visualization.
…ttice_method.py

Swapped np.cross for _functions.numba_1d_explicit_cross in backLegForces_GP1 calculation to improve performance and maintain consistency with other optimized operations.
…ging scripts with new variable names and converged/trimmed parameters

Also updates debugging log with latest progress
@camUrban camUrban mentioned this pull request Mar 4, 2026
12 tasks
camUrban added 26 commits March 4, 2026 18:22
Add max_wake_rows, max_wake_chords, and max_wake_cycles
parameters to Movement, with validation and conversion
logic mirroring num_steps/num_chords/num_cycles.
Propagate max_wake_rows through UnsteadyProblem to the
solver, which caps pre-allocated wake arrays and
truncates wake points and vortices each time step once
the threshold is reached.
Prepare the documentation for defining the global position of a plane.
Resolves conflicts in operating_point.py, output.py, CLASSES_AND_IMMUTABILITY.md,
and .idea/scopes/to_inspect.xml.

Simplifies CoupledOperatingPoint by passing angles_E_to_BP1_izyx through to
OperatingPoint's __init__ (which now validates and stores it) and removing the
4 redundant Earth transformation property overrides that are now inherited from
the parent class with lazy caching.
@camUrban camUrban closed this Mar 17, 2026
@camUrban camUrban force-pushed the feature/free_flight branch from 7c8d10a to d256240 Compare March 17, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Updates to a dependency file may be required feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Free flight simulations

3 participants