Skip to content

feat: Implement 3D flight animation methods using Vedo (Issue #523)#950

Draft
Copilot wants to merge 4 commits intodevelopfrom
copilot/pr-909-solve-merge-conflicts
Draft

feat: Implement 3D flight animation methods using Vedo (Issue #523)#950
Copilot wants to merge 4 commits intodevelopfrom
copilot/pr-909-solve-merge-conflicts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

Adds animate_trajectory and animate_rotate to the Flight plots layer, enabling interactive 3D visualization of simulated rocket trajectory and attitude via the optional vedo dependency. Resolves merge conflicts and addresses all reviewer comments from PR #909.

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates

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

No built-in 3D animation of rocket trajectory or attitude exists in the Flight class.

New behavior

Two animation methods accessible via flight.plots.*, backed by vedo as an opt-in dependency (pip install rocketpy[animation]):

# 6-DOF trajectory + attitude
flight.plots.animate_trajectory(start=0.0, stop=20.0, time_step=0.05)

# Rotation-only (attitude held at start position)
flight.plots.animate_rotate(file_name="rocket.stl", start=0.0, stop=20.0, time_step=0.05)

Key implementation details:

  • Methods live in rocketpy/plots/flight_plots.py (not simulation/flight.py) per project convention
  • Built-in fallback STL model at rocketpy/plots/assets/default_rocket.stl; bundled via [tool.setuptools.package-data]
  • Correct quaternion → axis-angle conversion: angle = 2·arccos(q0), with np.clip guard and zero-division protection for near-identity quaternions
  • World bounding box enforces a 10 m minimum dimension to remain visible for short-range trajectories
  • _validate_animation_inputs() raises ValueError for invalid [start, stop] or non-positive time_step, and FileNotFoundError for missing STL paths
  • ImportError with install hint raised via existing import_optional_dependency("vedo") if vedo is absent
  • vedo>=2024.5.1 added as rocketpy[animation] optional group; included in rocketpy[all]

Tests added (tests/unit/test_plots.py):

  • Happy-path execution with fully mocked vedo
  • ImportError when vedo is absent
  • ValueError for reversed/out-of-range time interval and time_step ≤ 0
  • FileNotFoundError for missing STL (explicit path and missing default)

Breaking change

  • No
Original prompt

Can I have your help on PR 909? Merging conflicts, solving differente comments, and testing the feature

Created from VS Code.

MateusStano and others added 2 commits April 5, 2026 21:10
* BUG: Fix hard-coded radius value for parachute added mass calculation (#889)

* Fix hard-coded radius value for parachute added mass calculation

Calculate radius from cd_s using a typical hemispherical parachute drag
coefficient (1.4) when radius is not explicitly provided. This fixes
drift distance calculations for smaller parachutes like drogues.

Formula: R = sqrt(cd_s / (Cd * π))

Closes #860

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Address code review: improve docstrings and add explicit None defaults

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Add CHANGELOG entry for PR #889

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Update rocket.add_parachute to use radius=None for consistency

Changed the default radius from 1.5 to None in the add_parachute method
to match the Parachute class behavior. This ensures consistent automatic
radius calculation from cd_s across both APIs.

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation

Fix hard-coded radius value for parachute added mass calculation

Calculate radius from cd_s using a typical hemispherical parachute drag
coefficient (1.4) when radius is not explicitly provided. This fixes
drift distance calculations for smaller parachutes like drogues.

Formula: R = sqrt(cd_s / (Cd * π))

Closes #860

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Add CHANGELOG entry for PR #889

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation

MNT: Extract noise initialization to fix pylint too-many-statements in Parachute.__init__

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* Refactor environment method access in controller test for clarity

* fix pylint

* fix comments

* avoid breaking change with drag_coefficient

* reafactors Parachute.__init__ method

* fix tests

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>

* ENH: get changes from BUG: All NOAA NOMADS Dependent Atmosphere Models Broken
Fixes #933

* ENH: Add guidelines for simulation safety, Sphinx documentation, and pytest standards (GitHub Copilot) (#937)

* REL: bump version to 1.12

* ENH: Add explicit timeouts to ThrustCurve API requests and update changelog (#940)

* Initial plan

* ENH: Add explicit timeouts to ThrustCurve API requests

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* DOC: Add timeout fix PR to changelog

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* ENH: Restore power_off/on_drag as Function objects; add _input attributes for raw user input and update changelog (#941)

* Initial plan

* ENH: Restore power_off/on_drag as Function, add _input attributes for raw user input

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* DOC: Add PR #941 compatibility fix to changelog

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* Update rocketpy/rocket/rocket.py

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: ruff pylint

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: MateusStano <mateusstano@usp.br>

* MNT: Remove unused imports and deprecated functions from mathutils/function.py

* BUG: Readd SourceType enumeration for function source types and clean up imports

* BUG: Fix incorrect Jacobian in `only_radial_burn` branch of `SolidMotor.evaluate_geometry` (#944)

* Initial plan

* BUG: Fix incorrect Jacobian in only_radial_burn branch of evaluate_geometry

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* ENH: move weathercocking_coeff to PointMassRockt

* MNT: ruff

* MNT: fix cyclic import

* BUG: Add wraparound logic for wind direction in environment plots (#939)

* chore: added personal toolkit files

* update branch name in workflow

* chore: update toolkit files

* Fix: add wraparound logic for wind direction and related tests

* style: fix ruff formatting

* Remove unused import

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* refactor: move repetitive logic into helper method

* fix: update test logic in test_environment

* add changelog entry

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: add numpy import to test_environment.py

* MNT: rename constant for wraparound threshold in _break_direction_wraparound method

* ENH: Adaptive Monte Carlo via Convergence Criteria (#922)

* ENH: added a new function (simulate_convergence)

* DOC: added a cell to show simulate_convergence function usage

* TST: integration test for simulate_convergence

* DOC: updated changelog for this PR

* ENH: ran black to lint intg test file

* new fixes thx to copilot comments

* linted rocketpy/simulation/monte_carlo.py

---------

Co-authored-by: Malmahrouqi3 <mohdsaid497566@gmail.com>

* DOC: add latitude range in docs

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: remove unnecessary pylint warning

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: remove unnecessary pylint warning

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* DOC: correctly link to WeatherModelMapping

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* DOCS: checked todo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ENH: address copilot comments

* TST: improve tests

* ENH: get changes from BUG: All NOAA NOMADS Dependent Atmosphere Models Broken
Fixes #933

* BUG: Fix hard-coded radius value for parachute added mass calculation (#889)

* Fix hard-coded radius value for parachute added mass calculation

Calculate radius from cd_s using a typical hemispherical parachute drag
coefficient (1.4) when radius is not explicitly provided. This fixes
drift distance calculations for smaller parachutes like drogues.

Formula: R = sqrt(cd_s / (Cd * π))

Closes #860

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Address code review: improve docstrings and add explicit None defaults

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Add CHANGELOG entry for PR #889

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Update rocket.add_parachute to use radius=None for consistency

Changed the default radius from 1.5 to None in the add_parachute method
to match the Parachute class behavior. This ensures consistent automatic
radius calculation from cd_s across both APIs.

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation

Fix hard-coded radius value for parachute added mass calculation

Calculate radius from cd_s using a typical hemispherical parachute drag
coefficient (1.4) when radius is not explicitly provided. This fixes
drift distance calculations for smaller parachutes like drogues.

Formula: R = sqrt(cd_s / (Cd * π))

Closes #860

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Add CHANGELOG entry for PR #889

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation

MNT: Extract noise initialization to fix pylint too-many-statements in Parachute.__init__

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* Refactor environment method access in controller test for clarity

* fix pylint

* fix comments

* avoid breaking change with drag_coefficient

* reafactors Parachute.__init__ method

* fix tests

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>

* ENH: Add guidelines for simulation safety, Sphinx documentation, and pytest standards (GitHub Copilot) (#937)

* REL: bump version to 1.12

* BUG: Add wraparound logic for wind direction in environment plots (#939)

* chore: added personal toolkit files

* update branch name in workflow

* chore: update toolkit files

* Fix: add wraparound logic for wind direction and related tests

* style: fix ruff formatting

* Remove unused import

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* refactor: move repetitive logic into helper method

* fix: update test logic in test_environment

* add changelog entry

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: add numpy import to test_environment.py

* MNT: rename constant for wraparound threshold in _break_direction_wraparound method

* DOC: add latitude range in docs

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: remove unnecessary pylint warning

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: remove unnecessary pylint warning

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* ENH: address copilot comments

* TST: improve tests

* DOC: correctly link to WeatherModelMapping

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* DOCS: checked todo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ENH: Adaptive Monte Carlo via Convergence Criteria (#922)

* ENH: added a new function (simulate_convergence)

* DOC: added a cell to show simulate_convergence function usage

* TST: integration test for simulate_convergence

* DOC: updated changelog for this PR

* ENH: ran black to lint intg test file

* new fixes thx to copilot comments

* linted rocketpy/simulation/monte_carlo.py

---------

Co-authored-by: Malmahrouqi3 <mohdsaid497566@gmail.com>

* DEV: remove unwanted changes from develop

* DEV: Update for hotfix

* TST: add tests

* MNT: remove changes from develop again

* MNT: Refactor longitude and latitude index functions

* MNT: ruff

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>
Co-authored-by: Khushal Kottaru <khushal.kottaru@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mohammed S. Al-Mahrouqi <malmahrouqi3@gatech.edu>
Co-authored-by: Malmahrouqi3 <mohdsaid497566@gmail.com>
Copilot AI and others added 2 commits April 6, 2026 00:29
…ate_rotate) in Flight plots layer

Agent-Logs-Url: https://github.com/RocketPy-Team/RocketPy/sessions/90f7410c-65e8-4b6b-83be-0d2ecc7d8e0e

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
…me_start_time)

Agent-Logs-Url: https://github.com/RocketPy-Team/RocketPy/sessions/90f7410c-65e8-4b6b-83be-0d2ecc7d8e0e

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix merge conflicts and test feature for PR 909 feat: Implement 3D flight animation methods using Vedo (Issue #523) Apr 6, 2026
Copilot AI requested a review from Gui-FernandesBR April 6, 2026 00:34
@Gui-FernandesBR Gui-FernandesBR changed the base branch from master to animate_flight April 6, 2026 11:28
@Gui-FernandesBR Gui-FernandesBR changed the base branch from animate_flight to develop April 6, 2026 11:29
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.

3 participants