Skip to content
Open
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:
Copy link
Preview

Copilot AI Jun 22, 2025

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). "
)

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