Skip to content

Fix: positions of components nested inside other components - #44

Open
rundvd wants to merge 1 commit into
RocketPy-Team:developfrom
rundvd:fix/element-positions
Open

rundvd wants to merge 1 commit into
RocketPy-Team:developfrom
rundvd:fix/element-positions

Conversation

@rundvd

@rundvd rundvd commented Dec 1, 2026

Copy link
Copy Markdown

process_elements_position adds the length of every earlier sibling to top_position, as if all components were stacked end to end. That holds for the children of the rocket and of a stage, but everything else is placed relative to the front of its own parent. A fin set listed after an inner tube or a bulkhead in the same body tube is therefore shifted back by the length of that component.

In Anonymous--Eta, for example, the fins end up 4.012 m from the nose tip instead of 2.493 m, so the initial static margin in RocketPy is 11.82 calibers. With this change it's 3.42 (OpenRocket gives 3.39 near Mach 0.3).

I compared the positions with OpenRocket's getComponentLocations() for all the examples. Of the 335 components that can be matched by type, name and length, 145 were misplaced, including 18 of the 30 fin sets. With this change all of them match in OpenRocket 22.02, 23.09 and 24.12.

  • The new test compares the fin sets and rail buttons of every example with OpenRocket's locations (16 of the 23 examples fail on develop).
  • In the examples' parameters.json, I only updated the fin and rail button positions that this changes.

@rundvd
rundvd requested a review from juliomachad0 as a code owner December 1, 2026 15:42
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.

1 participant