Report which body has too-small mass/inertia in compilation error.

PiperOrigin-RevId: 776196017
Change-Id: Ib81efb170347a57cdc4b446c14cd7b8f5357958c
This commit is contained in:
Yuval Tassa
2025-06-26 10:39:31 -07:00
committed by Copybara-Service
parent afc35451a0
commit 21bae3a388
4 changed files with 7 additions and 23 deletions
+2 -1
View File
@@ -529,7 +529,7 @@ TEST_F(MjCMeshTest, TinyInertiaFails) {
<mesh name="tiny" vertex="0 0 0 1e-4 0 0 0 1e-4 0 0 0 1e-4"/>
</asset>
<worldbody>
<body>
<body name="tiny_body">
<freejoint/>
<geom type="mesh" mesh="tiny"/>
</body>
@@ -542,6 +542,7 @@ TEST_F(MjCMeshTest, TinyInertiaFails) {
error.data(),
HasSubstr(
"mass and inertia of moving bodies must be larger than mjMINVAL"));
EXPECT_THAT(error.data(), HasSubstr("Element name 'tiny_body'"));
}
TEST_F(MjCMeshTest, FlippedFaceAllowedLegacyInertia) {
+2 -1
View File
@@ -196,7 +196,7 @@ TEST_F(UserCModelTest, NestedZeroMassBodiesFail) {
<worldbody>
<body>
<geom size="1"/>
<body>
<body name="bad">
<freejoint/>
<body>
<body>
@@ -214,6 +214,7 @@ TEST_F(UserCModelTest, NestedZeroMassBodiesFail) {
error,
HasSubstr(
"mass and inertia of moving bodies must be larger than mjMINVAL"));
EXPECT_THAT(error, HasSubstr("Element name 'bad'"));
mj_deleteModel(model);
}