-
-
Notifications
You must be signed in to change notification settings - Fork 49
Adding free flight simulations #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
camUrban
wants to merge
42
commits into
main
Choose a base branch
from
feature/free_flight
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
===========================================
- Coverage 87.33% 75.16% -12.18%
===========================================
Files 28 30 +2
Lines 4597 5584 +987
===========================================
+ Hits 4015 4197 +182
- Misses 582 1387 +805 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f699d13 to
f01d451
Compare
3 tasks
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
Also updates Claude's development tracker
…oModel and CoupledUnsteadyRingVortexLatticeMethodSolver classes Also updates Claude's progress tracking log
…Point Also cleans up various typos, improves docstrings, and updates docstring style guide with subclass pattern
…it quaternions Also adds comprehensive unit tests for the new function and removes old cruder methods that tried to implement this functionality
Renamed mujoco_model.py to _mujoco_model.py and refactored MuJoCoModel to accept CoupledMovement and inertia matrix directly, generating the MuJoCo XML internally. Added new transformation matrix properties to OperatingPoint and CoupledOperatingPoint for improved axis conversions. Updated CoupledUnsteadyProblem to require inertia matrix and instantiate MuJoCoModel. Removed direct mujoco_model import from __init__.py.
The MuJoCo model is now obtained from the CoupledUnsteadyProblem instance instead of being passed directly to the CoupledUnsteadyRingVortexLatticeMethodSolver. This simplifies the constructor and enforces tighter coupling between the problem and its associated MuJoCo model.
Replaces MuJoCo XML and model instantiation with direct inertia tensor definition in both glider and flat plate free flight scripts. The inertia tensor is now passed to CoupledUnsteadyProblem, simplifying initialization and removing dependencies on internal transformation utilities and MuJoCo model wrappers.
Gravity is now disabled in the MuJoCo model and applied solely by the coupled solver to prevent double-counting. Force transformation logic in the coupled solver is simplified, weight force calculation now uses the actual gravity direction, and variable naming is made consistent. Added debug logging for free flight and fixed inertia tensor units in documentation.
Set logging level to DEBUG in free flight scripts and suppress matplotlib debug messages. Update debug messages in CoupledUnsteadyRingVortexLatticeMethodSolver to use consistent formatting and scientific notation. Change output formatting in print_results to display values in scientific notation for better readability.
Introduces the rotationPointOffset_Gs_Ler parameter to WingMovement, allowing specification of a custom rotation point for wing angular motion. Updates initialization, wing generation logic, fixtures, and adds comprehensive unit tests to verify correct behavior and validation of the new feature.
Replaces delta_time calculation in gammabot simulation scripts with fixed values for fine and coarse meshes. Refactors movement.py to improve delta_time optimization, including a two-stage local/global search, reproducibility via random seed, and more robust mismatch evaluation. Enhances logging and error handling for optimization process.
Numba debug messages are now silenced in the glider and flat plate free flight scripts to reduce log noise. Typing annotation added for minimizer_kwargs in movement.py, and a debug log string in coupled_unsteady_ring_vortex_lattice_method.py was updated to stop Python 3.11 "unterminated string" error.
Introduces docs/MUJOCO_CONVENTIONS.md detailing MuJoCo state variable mappings to Ptera conventions. Adds debugging_scripts/flat_plate.py for flat plate solver testing. Refactors quaternion and velocity handling in _mujoco_model.py for clarity and correctness. Improves logging in coupled_unsteady_ring_vortex_lattice_method.py to show velocity vectors. Adds vCg_E__E property to CoupledOperatingPoint for velocity in Earth axes.
Enhanced free flight visualization by correcting coordinate transformations to PyVista axes, improving camera positioning, and ensuring proper clipping range for animations. Fixed panel and wake surface transformations to PyVista axes. Updated debugging scripts and documentation to reflect current development status, added new code style and writing guidelines, and removed obsolete debugging files. Also ensured MuJoCo model initializes derived quantities before simulation steps.
8414265 to
8f9e636
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CoupledOperatingPointclass topterasoftware/operating_point.pyCoupledMovementclass topterasoftware/movements/movement.pyCoupledUnsteadyProblemclass topterasoftware/problems.pyCoupledSteadyProblemclass topterasoftware/problems.pypterasoftware/mujoco_model.py, which contains theMuJoCoModelclass.pterasoftware/coupled_unsteady_ring_vortex_lattice_method.py, which contains theCoupledUnsteadyRingVortexLatticeMethodSolverclass.pterasoftware/__init__.pyto import the new modules.UnsteadyRingVortexLatticeMethodSolver's_calculate_loadsmethod where it was using different functions for calculating the cross product for eachLineVortexleg.pterasoftware.output.animate.RingVortexpterasoftware.output.animateandpterasoftware.output.draw.output.print_resultsto display values in scientific notation for better readability across scales.rotationPointOffset_Gs_Lerparameter toWingMovement, allowing specification of a custom rotation point for wing angular motion.delta_time's"optimize"mode by tuning the local optimizer and introducing a fall back to dual annealing as a global optimizer.delta_time's"optimize"mode where static cases weren't improved.docs/. This uses the progressive disclosure strategy known to produce better results.MUJOCO_CONVENTIONS.mdfile with verified interpretations of MuJoCo's relevant inputs and outputs.animate_free_flightfunction inoutput.py, along with a few helper functions.Temporary Debug Scripts to Remove Before Merging
debugging_scriptsand all files withindocs/FREE_FLIGHT_DEVELOPMENT.mdgammabot_simulationsand all files withinNew Dependencies
Change Magnitude
Moderate: Medium-sized change that adds or modifies a feature without large-scale impact.
Checklist
mainand is up to date with the upstreammainbranch.--in-place --black). See the style guide for type hints and docstrings for more details.pterasoftwarepackage use type hints. See the style guide for type hints and docstrings for more details.testspackage.testspackage.codespell,black,mypy, andtests).