Skip to content

Add Event class as foundation for deployables and multistage simulation#8

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-new-event-class
Draft

Add Event class as foundation for deployables and multistage simulation#8
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-new-event-class

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 15, 2026

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
  • All tests (pytest tests -m slow --runslow) have passed locally

Current behavior

Flight events (parachute deployments) are stored as raw [time, parachute] two-element lists in Flight.parachute_events. There is no structured type to represent discrete simulation events, making it impossible to cleanly extend the system for stage separations, deployable releases, or other future event types.

New behavior

Introduces Event — a lightweight class in rocketpy/simulation/event.py — to represent any discrete occurrence during a flight simulation.

Why simulation/, not rocket/?
rocket/ defines vehicle geometry and components (what exists). simulation/ records what happens during flight (when and how components activate). Event is created by the ODE solver inside Flight; it belongs where it's used. This also keeps it reusable for future MonteCarlo and multistage managers without circular imports.

Key attributes:

Attribute Description
time Trigger time in seconds
trigger The triggering condition (mirrors Parachute.trigger)
event_type "parachute", "stage_separation", "deployable", etc.
action The associated object (e.g., the Parachute that deployed)

Usage:

from rocketpy import Event

# After a flight simulation, parachute_events holds Event objects
for ev in flight.parachute_events:
    print(ev.time, ev.event_type, ev.action.name)

# Backward-compatible: existing index access still works
t = flight.parachute_events[0][0]   # ev.time
p = flight.parachute_events[0][1]   # ev.action

Changes:

  • rocketpy/simulation/event.py — new Event class with __repr__, __str__, __eq__, and backward-compatible __getitem__
  • Flight.__simulate() — both parachute trigger paths now append Event objects instead of raw lists
  • flight_prints.py — updated to use event.time / event.action attributes
  • rocketpy/simulation/__init__.py, rocketpy/__init__.pyEvent is publicly exported
  • tests/unit/simulation/test_event.py — 24 unit tests

Breaking change

  • No

Existing code accessing parachute_events[i][0] (time) or parachute_events[i][1] (parachute) continues to work via Event.__getitem__.

Additional information

This is the first building block toward the deployables and multistage plan. The event_type string field is intentionally open-ended so future separation events ("stage_separation", "deployable") slot in without changing the class interface.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • github-production-user-asset-6210df.s3.amazonaws.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new event class for deployables and multistage implementation Add Event class as foundation for deployables and multistage simulation Mar 15, 2026
Copilot AI requested a review from aZira371 March 15, 2026 13:57
@aZira371 aZira371 changed the base branch from master to develop March 15, 2026 14:10
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