Skip to content

Conversation

@AKHIL-149
Copy link
Contributor

Summary

This PR adds free flight simulation capabilities (based on #66) with the following improvements:

  • Merged with latest main branch (resolved conflicts)
  • Removed debugging scripts directory
  • Removed development documentation (FREE_FLIGHT_DEVELOPMENT.md)
  • Removed gammabot simulation data

Changes

  • New coupled unsteady ring vortex lattice method solver
  • MuJoCo integration for physics simulation
  • New movement classes for coupled simulations
  • Support for rotation point offset in wing movements
  • Unit tests for new functionality

Test Plan

  • Run existing unit tests
  • Verify coupled simulation examples work correctly
  • Check MuJoCo integration

Based on PR #66 by @camUrban with cleanup for merge.

AKHIL-149 and others added 8 commits December 8, 2025 19:44
This commit addresses issue camUrban#68 by replacing the maximum-period logic
with least-common multiple (LCM) calculation when determining the cycle
period for averaging forces and moments in unsteady simulations.

Changes:
- Added Movement._lcm() static method to calculate LCM of two periods
- Added Movement._lcm_multiple() static method to calculate LCM across
  multiple periods
- Added Movement.lcm_period property that returns the LCM of all motion
  periods from airplane_movements and operating_point_movement
- Updated Movement initialization to use lcm_period instead of max_period
  when calculating num_steps for cyclic motion (line 252)
- Updated UnsteadyProblem initialization in problems.py to use lcm_period
  instead of max_period when determining first_averaging_step (line 137)
- Updated docstrings to clarify that lcm_period should be used for
  cycle-averaging calculations
- Added unit tests for lcm_period calculation with static, single-period,
  and multiple-period movements

Why LCM instead of max:
When motions have different periods (e.g., 2s and 3s), using the maximum
period (3s) does not ensure each motion completes an integer number of
cycles. The LCM approach ensures proper cycle-averaging by using a period
where all motions complete exactly N cycles. For 2s and 3s periods, the
LCM is 6s, allowing the 2s motion to complete 3 cycles and the 3s motion
to complete 2 cycles.

The max_period property is preserved for backward compatibility.

Fixes camUrban#68
…tting warning

Rewrites the test_lcm_period_with_multiple_airplanes to explicitly construct Airplane, Wing, and WingCrossSectionMovement fixtures for two airplanes with periods 2.0 and 3.0. Prior results caused errors due to referencing missing fixture functions. Also fixes a warning about this file from the black CI action.
Added all_periods property to movement classes at all levels:
- WingCrossSectionMovement: Collects all non-zero periods from position and angle motion
- WingMovement: Collects periods from all wing cross sections plus own motion
- AirplaneMovement: Collects periods from all wing movements plus own motion

Updated Movement.lcm_period to use all_periods instead of max_period from each
AirplaneMovement. This ensures LCM calculation includes ALL individual periods
from the entire hierarchy, not just the maximum at each level.

Example fix: For an airplane with wing motions at 3.0s and 4.0s periods,
the old code calculated LCM(4.0) = 4.0 (missing the 3.0s motion).
The new code calculates LCM(3.0, 4.0) = 12.0 (correct).

Also added lcm_period to Movement class docstring as requested.

Fixes failing tests:
- test_lcm_period_with_multiple_wings_same_airplane
- test_lcm_period_with_multiple_cross_sections_same_wing
…_periods` properties to the movement class docstrings
@AKHIL-149 AKHIL-149 requested a review from camUrban as a code owner December 9, 2025 04:47
@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.90%. Comparing base (8414265) to head (f09d406).

Files with missing lines Patch % Lines
pterasoftware/movements/movement.py 92.59% 2 Missing ⚠️
pterasoftware/movements/airplane_movement.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           feature/free_flight      #74      +/-   ##
=======================================================
+ Coverage                72.67%   72.90%   +0.22%     
=======================================================
  Files                       29       29              
  Lines                     5530     5588      +58     
=======================================================
+ Hits                      4019     4074      +55     
- Misses                    1511     1514       +3     

☔ 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 changed the base branch from main to feature/free_flight December 10, 2025 21:16
Copy link
Owner

@camUrban camUrban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched the base of this PR to the feature branch this work is targeting instead of main, since the feature is still in progress and not ready for release.

I really appreciate you taking care of the merge-from-main. However, I still need those debug scripts for now (while this work is still in progress). Would you mind restoring the deleted files? Thanks again for jumping in on this!

@camUrban camUrban added maintenance Improvements or additions to documentation, testing, or robustness feature New feature or request labels Dec 10, 2025
Restoring files removed in de9110f as requested by @camUrban.
These files are still needed for active development and testing
of the free flight simulation feature.

Restored:
- debugging_scripts/ (8 files) - Development test scripts
- docs/FREE_FLIGHT_DEVELOPMENT.md - Development tracking doc
- gammabot_simulations/ (40 files) - Simulation test cases and results
@camUrban
Copy link
Owner

Hey @AKHIL-149! This PR is a bit behind now after merging in the logging and Reynolds number calculation changes. I'm going to close it and update the free flight repo manually.

@camUrban camUrban closed this Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request maintenance Improvements or additions to documentation, testing, or robustness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants