Skip to content

Conversation

@aZira371
Copy link
Collaborator

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

RocketPy cannot simulate rockets with motor delay charges (fixed-time deployment) like model rocket motors or high-power motors without avionics. Users must resort to workarounds or cannot accurately simulate kits like Loc-IV powered by Aerotech motors with delay elements. #437

New behavior

Parachute triggers now accept time-based string formats:

  • "launch + X" - deploys X seconds after t=0
  • "burnout + X" - deploys X seconds after motor burnout

Implementation:

  • Extended Parachute.__evaluate_trigger_function() to parse time-based triggers
  • Added t (current time) and rocket (motor access) parameters to trigger function signature
  • Maintained backward compatibility via parameter count detection (existing pattern)
  • Updated all four call sites in Flight class to pass additional parameters (two original + two new)

Example usage:

# Model rocket with 3-second motor delay (like Estes C6-3)
rocket.add_parachute(
    name="Main",
    cd_s=10.0,
    trigger="burnout + 3",
    sampling_rate=100,
    lag=1.5,
)

# Simple timer deployment 5 seconds after launch
rocket.add_parachute(
    name="Drogue",
    cd_s=1.0,
    trigger="launch + 5",
    sampling_rate=100,
    lag=0.5,
)

Testing:

  • 11 unit tests covering parsing, functionality, edge cases, backward compatibility
  • 4 integration tests with full flight simulations with time-based triggers

Breaking change

  • Yes
  • No

Additional information

Existing trigger types (callable, float altitude, "apogee") remain unchanged. The trigger function signature extension uses optional parameters with defaults, ensuring zero-impact to existing code

- ENH: added ability to parse time nodes and rocket properties in parachute.py
- ENH: added and modified functionalities in time node calculations for parachute in flight.py
- TST: added separate integration test_parachute_time_trig.py focusing on parachute triggers in flight simulations
- TST: added separate unit test_parachute.py focusing on parachute triggers mechanisms
@aZira371 aZira371 requested a review from a team as a code owner January 24, 2026 08:18
@aZira371 aZira371 self-assigned this Jan 24, 2026
@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

❌ Patch coverage is 96.96970% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.04%. Comparing base (9cf3dd4) to head (6814de7).
⚠️ Report is 27 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/rocket/parachute.py 94.28% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #923      +/-   ##
===========================================
+ Coverage    80.27%   81.04%   +0.76%     
===========================================
  Files          104      107       +3     
  Lines        12769    13893    +1124     
===========================================
+ Hits         10250    11259    +1009     
- Misses        2519     2634     +115     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants