Skip to content

Fix: swapped longitudinal/rotational inertia order - #43

Merged
juliomachad0 merged 3 commits into
RocketPy-Team:developfrom
WPI-HPRC:fix/inertia-order
Nov 12, 2026
Merged

juliomachad0 merged 3 commits into
RocketPy-Team:developfrom
WPI-HPRC:fix/inertia-order

Conversation

@bwang257

Copy link
Copy Markdown

search_rocket unpacks get_inertias() in the wrong order:
get_inertias returns (longitudinal, rotational) and rocket.py:24 assigns it to inertia_z, inertia_i, so rocket.inertia comes out as (rotational, rotational, longitudinal). In OpenRocket, "longitudinal" is the pitch/yaw inertia, not the roll inertia. AbstractRKSimulationStepper.java (328-330) in RocketPy divides the "longitudinal" inertia into pitch and yaw moments.

This PR swaps the unpack order (single line change) and adds a test that asserts that roll inertia < pitch inertia, skipping examples with no inertia data. This test fails initially and passes with the fix.

Also fixed the order in the example parameters.json files and tests.

@juliomachad0

Copy link
Copy Markdown
Member

Hi @bwang257 !, the PR looks great and the physics explanation makes total sense!
Could you please just run make format (or sort the import math above import pytest in tests/acceptance/test_ork_extractor.py) so the linter check passes in CI?
Once that's done, I'll merge it. Thanks!

@bwang257

Copy link
Copy Markdown
Author

Hi @juliomachad0!, thanks! I ran make format and the linter check should pass in CI now. Could you approve the workflow run so lint can re-run?

Once again, thanks for taking a look at this PR!

@juliomachad0
juliomachad0 merged commit 7633b63 into RocketPy-Team:develop Nov 12, 2026
0 of 9 checks passed
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