Remove the Shell plugin and integrate it into the engine.
PiperOrigin-RevId: 760688502 Change-Id: Ia70988d42b7edf571d7cb4a4f48f8fc50b51667d
This commit is contained in:
committed by
Copybara-Service
parent
45fc15b844
commit
7edbdd0ad6
@@ -343,7 +343,7 @@ void ABSL_ATTRIBUTE_NOINLINE mulMatVecSparse_8(mjtNum* res,
|
||||
// ----------------------------- benchmark ------------------------------------
|
||||
|
||||
static void BM_MatVecSparse(benchmark::State& state, int unroll) {
|
||||
static mjModel* m = LoadModelFromPath("plugin/elasticity/flag_flex.xml");
|
||||
static mjModel* m = LoadModelFromPath("flex/flag.xml");
|
||||
mjData* d = mj_makeData(m);
|
||||
|
||||
// warm-up rollout to get a typical state
|
||||
|
||||
@@ -73,7 +73,7 @@ static void run_parse_benchmark(const std::string xml_path,
|
||||
// run_parse_benchmark).
|
||||
|
||||
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_ParseFlagPlugin(benchmark::State& state) {
|
||||
run_parse_benchmark(GetModelPath("plugin/elasticity/flag_flex.xml"), state);
|
||||
run_parse_benchmark(GetModelPath("flex/flag.xml"), state);
|
||||
}
|
||||
BENCHMARK(BM_ParseFlagPlugin);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static void run_step_benchmark(const mjModel* model, benchmark::State& state) {
|
||||
|
||||
void ABSL_ATTRIBUTE_NO_TAIL_CALL BM_StepFlagPlugin(benchmark::State& state) {
|
||||
MujocoErrorTestGuard guard;
|
||||
static mjModel* model = LoadModelFromPath("plugin/elasticity/flag_flex.xml");
|
||||
static mjModel* model = LoadModelFromPath("flex/flag.xml");
|
||||
run_step_benchmark(model, state);
|
||||
}
|
||||
BENCHMARK(BM_StepFlagPlugin);
|
||||
|
||||
@@ -37,7 +37,7 @@ using ::testing::DoubleNear;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::NotNull;
|
||||
|
||||
constexpr int kNumTruePlugins = 11;
|
||||
constexpr int kNumTruePlugins = 10;
|
||||
constexpr int kNumFakePlugins = 30;
|
||||
constexpr int kNumTestPlugins = 4;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <mujoco/mujoco.h>
|
||||
#include "test/fixture.h"
|
||||
#include "plugin/elasticity/shell.h"
|
||||
|
||||
namespace mujoco {
|
||||
namespace {
|
||||
@@ -58,15 +57,10 @@ TEST_F(ElasticityTest, FlexCompatibility) {
|
||||
TEST_F(ElasticityTest, ElasticEnergyShell) {
|
||||
static constexpr char cantilever_xml[] = R"(
|
||||
<mujoco>
|
||||
<extension>
|
||||
<plugin plugin="mujoco.elasticity.shell"/>
|
||||
</extension>
|
||||
|
||||
<worldbody>
|
||||
<flexcomp type="grid" count="8 8 1" spacing="1 1 1"
|
||||
radius=".025" name="test" dim="2">
|
||||
<elasticity young="2" poisson="0" thickness="1"/>
|
||||
<plugin plugin="mujoco.elasticity.shell"/>
|
||||
</flexcomp>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
@@ -76,7 +70,8 @@ TEST_F(ElasticityTest, ElasticEnergyShell) {
|
||||
mjModel* m = LoadModelFromString(cantilever_xml, error, sizeof(error));
|
||||
ASSERT_THAT(m, testing::NotNull()) << error;
|
||||
mjData* d = mj_makeData(m);
|
||||
auto* shell = reinterpret_cast<plugin::elasticity::Shell*>(d->plugin_data[0]);
|
||||
mj_kinematics(m, d);
|
||||
mj_flex(m, d);
|
||||
|
||||
// check that a plane is in the kernel of the energy
|
||||
for (mjtNum scale = 1; scale < 4; scale++) {
|
||||
@@ -92,8 +87,8 @@ TEST_F(ElasticityTest, ElasticEnergyShell) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
mjtNum elongation1 = scale * shell->position[3*v[i]+x];
|
||||
mjtNum elongation2 = scale * shell->position[3*v[j]+x];
|
||||
mjtNum elongation1 = scale * d->flexvert_xpos[3*v[i]+x];
|
||||
mjtNum elongation2 = scale * d->flexvert_xpos[3*v[j]+x];
|
||||
energy += m->flex_bending[16*e+4*i+j] * elongation1 * elongation2;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +109,7 @@ TEST_F(PluginTest, ElasticEnergyMembrane) {
|
||||
<worldbody>
|
||||
<flexcomp type="grid" count="8 8 1" spacing="1 1 1"
|
||||
radius=".025" name="test" dim="2">
|
||||
<elasticity young="2" poisson="0" thickness="1" elastic2d="2"/>
|
||||
<elasticity young="2" poisson="0" thickness="1" elastic2d="stretch"/>
|
||||
<edge equality="false"/>
|
||||
</flexcomp>
|
||||
</worldbody>
|
||||
|
||||
Reference in New Issue
Block a user