Skip to content

Commit a97c2b2

Browse files
committed
MNT: correction to input of inertia tensor into abs():
- MNT: correction to input of inertia tensor into abs(). Created an inertia matrix using Matrix right before the singularity check.
1 parent 8af308b commit a97c2b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rocketpy/rocket/rocket.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,12 @@ def __init__( # pylint: disable=too-many-statements
293293
self.I_12_without_motor = inertia[3]
294294
self.I_13_without_motor = inertia[4]
295295
self.I_23_without_motor = inertia[5]
296-
297-
# Initial Inertia Tensor determinant singularity check
298-
if abs(inertia) == 0:
296+
inertia_matrix = Matrix([
297+
[self.I_11_without_motor, self.I_12_without_motor, self.I_13_without_motor],
298+
[self.I_12_without_motor, self.I_22_without_motor, self.I_23_without_motor],
299+
[self.I_13_without_motor, self.I_23_without_motor, self.I_33_without_motor],
300+
]) # Initial Inertia Tensor determinant singularity check
301+
if abs(inertia_matrix) == 0:
299302
raise ValueError(
300303
"The rocket inertia tensor is singular (determinant is zero). "
301304
)

0 commit comments

Comments
 (0)