ENH: Zero Inertia tensor Check
维护者通常 3 天内回复
评估
这个 Issue 还没有评估数据。
描述
Is your feature request related to a problem? Please describe.
Previously, users could accidentally set the rocket's dry inertia tensor to a zero vector or otherwise singular configuration. This led to runtime errors during simulation, typically manifesting as RuntimeWarning: divide by zero encountered in scalar divide and subsequent integration failures in the ODE solver.
Describe the solution you'd like
The dry inertia tensor should be validated as soon as the Rocket object is initialized. Specifically:
-
Construct the 3×3 inertia matrix from user-provided I_ij values in Rocket.init.
-
Immediately compute its determinant.
-
Raise a clear ValueError if the determinant is zero (i.e., the tensor is singular), with a helpful message prompting users to provide physically realistic values.
-
This approach shifts error detection earlier in the development cycle, prevents invalid configurations from reaching the solver, and gives users a precise explanation of what's wrong.
-
No changes are made to motor or dynamic inertia evaluation. Only the dry inertia (which is static and available at init) is validated.
Additional context
-
This change improves usability and safety, especially for multi-stage and upper-stage configurations where users often define placeholder or dummy inertia values.
-
It avoids obscure integration failures and makes RocketPy more robust to user error.
-
The solution avoids invasive structural changes by operating entirely within the Rocket class and leveraging existing Matrix functionality.
Future extensions could optionally introduce runtime checks for singular dynamic inertias (e.g., in u_dot_generalized), but this patch focuses only on validating static dry inertia at creation time. For dynamic inertia evaluation a debug_inertia_check can be implemented as optional boolean flag added to the Flight class to catch near-singular total inertia tensors during simulation. When enabled, it performs a lightweight determinant check on the dynamically evaluated total inertia matrix at each time step. If the determinant falls below a safe threshold, a clear error is raised indicating potential instability due to ill-conditioned inertial properties. This helps users catch modeling or configuration issues in motor or mass properties that may otherwise cause silent solver failures. The feature is off by default to avoid performance overhead in production runs.
- 主要语言
- Python
- 星标
- 1.1k
- 派生
- 280
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 24
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RocketPy-Team/RocketPy 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
RocketPy-Team/RocketPy#1255 ·
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
RocketPy-Team/RocketPy#1241 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
RocketPy-Team/RocketPy#1202 ·
维护者通常 3 天内回复
-
Monte Carlo test fixtures write their logs into the working directory可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
RocketPy-Team/RocketPy#1189 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
RocketPy-Team/RocketPy#1171 · 1 条评论 ·
维护者通常 3 天内回复
查看 RocketPy-Team/RocketPy 的全部 Issue
相似的 Issue
-
docs(contributing): the two things that silently block a PR可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭available documentation good first issue
难度 1/5 1-3 小时 新手友好度 95/100
Nixitov/Riptide-Native#944 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
JTHCode/secretguard#24 ·
维护者通常 1 天内回复
-
area: middleware documentation good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 ·
维护者通常 1 天内回复