Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@
self.I_12_without_motor = inertia[3]
self.I_13_without_motor = inertia[4]
self.I_23_without_motor = inertia[5]
inertia_matrix = Matrix([
[self.I_11_without_motor, self.I_12_without_motor, self.I_13_without_motor],
[self.I_12_without_motor, self.I_22_without_motor, self.I_23_without_motor],
[self.I_13_without_motor, self.I_23_without_motor, self.I_33_without_motor],
]) # Initial Inertia Tensor determinant singularity check
if abs(inertia_matrix) == 0:

Copilot AI Jun 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using abs(inertia_matrix) to check for a singular matrix might not correctly compute the determinant; it is recommended to use the proper determinant method (e.g., inertia_matrix.det()) for an accurate singularity check.

Suggested change
if abs(inertia_matrix) == 0:
if inertia_matrix.det() == 0:

Copilot uses AI. Check for mistakes.
raise ValueError(

Check warning on line 302 in rocketpy/rocket/rocket.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/rocket/rocket.py#L302

Added line #L302 was not covered by tests
"The rocket inertia tensor is singular (determinant is zero). "
)
Comment on lines +295 to +317

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having the dry inertia as zero should not stop the simulation, since someone might only have the inertias on the motor for some reason.

In any case, we need the determinant of the Rocket + Motor Inertia Matrix to be different from zero. Could you move this check so that it is done when a motor is added?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean to say someone might want to simulate just a motor and check the trajectory?

Yes agreed I'll move it to when the motor is added.


# Define rocket geometrical parameters in SI units
self.center_of_mass_without_motor = center_of_mass_without_motor
Expand Down
Loading