Remove cloth and rope composites and deprecate loop.

PiperOrigin-RevId: 568168329
Change-Id: Ida4a5236bef74828c7bf59affdc28adea3db53b1
This commit is contained in:
Alessio Quaglino
2023-09-25 03:37:42 -07:00
committed by Copybara-Service
parent cbb07a4c32
commit d3d46e16a4
14 changed files with 5709 additions and 448 deletions
@@ -25,7 +25,7 @@ namespace mujoco {
namespace {
// number of steps to roll out before benhmarking
static const int kNumWarmupSteps = 500;
static const int kNumWarmupSteps = 200;
// number of steps to benchmark
static const int kNumBenchmarkSteps = 50;
@@ -102,7 +102,7 @@ void solveM_baseline(const mjModel* m, mjData* d, mjtNum* x, const mjtNum* y) {
// ----------------------------- benchmark ------------------------------------
static void BM_solveLD(benchmark::State& state, bool new_function) {
static mjModel* m = LoadModelFromPath("composite/cloth.xml");
static mjModel* m = LoadModelFromPath("plugin/elasticity/coil.xml");
mjData* d = mj_makeData(m);
// warm-up rollout to get a typical state
@@ -348,7 +348,7 @@ void ABSL_ATTRIBUTE_NOINLINE mulMatVecSparse_8(mjtNum* res,
// ----------------------------- benchmark ------------------------------------
static void BM_MatVecSparse(benchmark::State& state, int unroll) {
static mjModel* m = LoadModelFromPath("composite/cloth.xml");
static mjModel* m = LoadModelFromPath("plugin/elasticity/flag.xml");
mjData* d = mj_makeData(m);
// warm-up rollout to get a typical state
+5 -4
View File
@@ -48,13 +48,14 @@ static void run_parse_benchmark(const std::string xml_path, benchmark::State& st
// separately in CPU profiles (and don't get replaced with raw calls to
// run_parse_benchmark).
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_ParseCloth(benchmark::State& state) {
run_parse_benchmark(GetModelPath("composite/cloth.xml"), state);
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_ParseCable(benchmark::State& state) {
run_parse_benchmark(GetModelPath("plugin/elasticity/flag.xml"), state);
}
BENCHMARK(BM_ParseCloth);
BENCHMARK(BM_ParseCable);
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_ParseFlag(benchmark::State& state) {
run_parse_benchmark(GetModelPath("flag/flag.xml"), state);
run_parse_benchmark(GetModelPath("../test/benchmark/testdata/flag.xml"),
state);
}
BENCHMARK(BM_ParseFlag);
+5 -4
View File
@@ -79,12 +79,12 @@ static void run_step_benchmark(const mjModel* model, benchmark::State& state) {
// separately in CPU profiles (and don't get replaced with raw calls to
// run_step_benchmark).
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_StepCloth(benchmark::State& state) {
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_StepCable(benchmark::State& state) {
MujocoErrorTestGuard guard;
static mjModel* model = LoadModelFromPath("composite/cloth.xml");
static mjModel* model = LoadModelFromPath("plugin/elasticity/flag.xml");
run_step_benchmark(model, state);
}
BENCHMARK(BM_StepCloth);
BENCHMARK(BM_StepCable);
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_StepParticle(benchmark::State& state) {
MujocoErrorTestGuard guard;
@@ -95,7 +95,8 @@ BENCHMARK(BM_StepParticle);
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_StepFlag(benchmark::State& state) {
MujocoErrorTestGuard guard;
static mjModel* model = LoadModelFromPath("flag/flag.xml");
static mjModel* model =
LoadModelFromPath("../test/benchmark/testdata/flag.xml");
run_step_benchmark(model, state);
}
BENCHMARK(BM_StepFlag);
+5582
View File
File diff suppressed because one or more lines are too long
-28
View File
@@ -57,34 +57,6 @@ TEST_F(UserCompositeTest, MultipleJointsNotAllowedUnlessParticle) {
HasSubstr("Only particles are allowed to have multiple joints"));
}
TEST_F(UserCompositeTest, StretchAndTwistAllowed) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<body name="B10">
<freejoint/>
<composite type="rope" count="21 1 1" spacing="0.04">
<joint kind="main" damping="0.005"/>
<joint kind="stretch" damping="0.005"/>
<joint kind="twist" damping="0.005"/>
<geom type="capsule" size=".01 .015"/>
</composite>
</body>
</worldbody>
</mujoco>
)";
static char warning[1024];
warning[0] = '\0';
mju_user_warning = [](const char* msg) {
util::strcpy_arr(warning, msg);
};
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, NotNull());
EXPECT_THAT(warning, HasSubstr("deprecated"));
mj_deleteModel(m);
}
TEST_F(UserCompositeTest, SpacingGreaterThanGeometry) {
static constexpr char xml[] = R"(
<mujoco>
+6 -7
View File
@@ -795,12 +795,10 @@ TEST_F(XMLWriterTest, WritesSkin) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<body name="B0_0" pos="0 0 0">
<composite type="cloth" count="2 2 1" spacing="0.05">
<skin texcoord="true"/>
<geom type="ellipsoid" size="1 1 1"/>
</composite>
</body>
<composite type="grid" count="2 2 1" spacing="0.05">
<skin texcoord="true"/>
<geom size=".01"/>
</composite>
</worldbody>
</mujoco>
)";
@@ -1085,7 +1083,8 @@ TEST_F(PluginTest, WriteReadCompare) {
if (!mtemp) {
// if failing because assets are missing, accept the test
ASSERT_THAT(error.data(), HasSubstr("file")) << error.data();
ASSERT_THAT(error.data(), HasSubstr("file"))
<< error.data() << " from " << xml.c_str();
} else {
// for a particularly difficult example, relax the tolerance
mjtNum tol =