Remove the particle composite (replaced by replicate).

PiperOrigin-RevId: 730089997
Change-Id: If8d18fb56ae01241e76f84dbf7951e034026d829
This commit is contained in:
Alessio Quaglino
2025-02-23 03:13:20 -08:00
committed by Copybara-Service
parent 0fcd20f0da
commit c52d1b3941
20 changed files with 164 additions and 527 deletions
+21 -24
View File
@@ -35,14 +35,30 @@ using ::testing::NotNull;
using ::testing::HasSubstr;
using UserCompositeTest = MujocoTest;
// ------------- test automatic inference of nuser_xxx -------------------------
// ------------------------ cable tests ---------------------------------------
TEST_F(UserCompositeTest, SpacingGreaterThanGeometry) {
TEST_F(UserCompositeTest, ShapeCanBeOmitted) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<composite type="particle" count="282 2">
<geom size="8"/>
<composite type="cable" count="100 1 1" curve="s">
<geom type="box" size="1 1 1"/>
</composite>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, NotNull()) << error.data();
mj_deleteModel(m);
}
TEST_F(UserCompositeTest, InvalidShape) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<composite type="cable" count="100 1 1" curve="s s exp">
<geom type="box" size="1 1 1"/>
</composite>
</worldbody>
</mujoco>
@@ -51,26 +67,7 @@ TEST_F(UserCompositeTest, SpacingGreaterThanGeometry) {
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, IsNull()) << error.data();
EXPECT_THAT(error.data(),
HasSubstr("Spacing must be larger than geometry size"));
}
TEST_F(UserCompositeTest, SpacingEqualToGeometry) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<composite type="particle" count="282 2" spacing="8">
<geom size="8"/>
</composite>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, NotNull()) << error.data();
mjData* d = mj_makeData(m);
mj_step(m, d);
mj_deleteData(d);
mj_deleteModel(m);
HasSubstr("The curve array contains an invalid shape"));
}
} // namespace