Allow actuators to add damping and armature to joint and tendon transmissions.

PiperOrigin-RevId: 886899849
Change-Id: I02200ee0d4f7c96096d8188b95f823b566562a30
This commit is contained in:
Yuval Tassa
2026-03-20 11:40:35 -07:00
committed by Copybara-Service
parent f7bd6d15f7
commit 510d75f4cf
25 changed files with 1164 additions and 77 deletions
+46
View File
@@ -2841,5 +2841,51 @@ TEST_F(OctreeSDFTest, TorusSDF) {
mj_deleteModel(model);
}
// ------------- test actuator damping/armature validation ---------------------
using ActuatorTransmissionTest = MujocoTest;
TEST_F(ActuatorTransmissionTest, DampingRejectsSiteTransmission) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<body>
<joint type="slide"/>
<geom size="1"/>
<site name="s"/>
</body>
</worldbody>
<actuator>
<general site="s" damping="1"/>
</actuator>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
ASSERT_THAT(m, IsNull());
EXPECT_THAT(error.data(), HasSubstr("damping requires joint or tendon"));
}
TEST_F(ActuatorTransmissionTest, ArmatureRejectsSiteTransmission) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<body>
<joint type="slide"/>
<geom size="1"/>
<site name="s"/>
</body>
</worldbody>
<actuator>
<general site="s" armature="1"/>
</actuator>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
ASSERT_THAT(m, IsNull());
EXPECT_THAT(error.data(), HasSubstr("armature requires joint or tendon"));
}
} // namespace
} // namespace mujoco