Add nJmom, the number of non-zeros in sparse actuator_moment matrix, to mjModel.

PiperOrigin-RevId: 698343986
Change-Id: I3d4a4dea1ec095d4e7b231c2fffc0e6241cee39f
This commit is contained in:
Taylor Howell
2024-11-20 04:29:55 -08:00
committed by Copybara-Service
parent cd84011d7b
commit aae5fd6906
13 changed files with 78 additions and 33 deletions
+24
View File
@@ -116,6 +116,30 @@ TEST_F(UserCModelTest, SameFrame) {
mj_deleteModel(model);
}
TEST_F(UserCModelTest, ActuatorSparsity) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<body>
<geom size="1"/>
<joint name="a"/>
<body>
<geom size="1"/>
<joint name="b"/>
</body>
</body>
</worldbody>
<actuator>
<motor joint="a"/>
<motor joint="b"/>
</actuator>
</mujoco>
)";
mjModel* m = LoadModelFromString(xml);
ASSERT_EQ(m->nJmom, 4);
mj_deleteModel(m);
}
// ------------- test automatic inference of nuser_xxx -------------------------