diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index f2b030db..523b0d43 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -772,23 +772,11 @@ has any effect. The settings here are global and apply to the entire model. models compiled with this flag, it is important to remember that collision geoms are often placed in a :ref:`group` which is invisible by default. -.. _compiler-convexhull: - -:at:`convexhull`: :at-val:`[false, true], "true"` - If this attribute is "true", the compiler will automatically generate a convex hull for every mesh that is used in at - least one non-visual geom (in the sense of the discardvisual attribute above). This is done to speed up collision - detection; recall :ref:`Collision` section in the Computation chapter. Even if the mesh is already convex, the hull - contains edge information that is not present in the mesh file, so it needs to be constructed. The only reason to - disable this feature is to speed up re-loading of a model with large meshes during model editing (since the convex - hull computation is the slowest operation performed by the compiler). However once model design is finished, this - feature should be enabled, because the availability of convex hulls substantially speeds up collision detection with - large meshes. - .. _compiler-usethread: :at:`usethread`: :at-val:`[false, true], "true"` If this attribute is "true", the model compiler will run in multi-threaded mode. Currently multi-threading is used - for computing the length ranges of actuators and for loading meshes. + for computing the length ranges of actuators and for parallel loading of meshes. .. _compiler-fusestatic: diff --git a/doc/XMLschema.rst b/doc/XMLschema.rst index 72df2be3..caf07b20 100644 --- a/doc/XMLschema.rst +++ b/doc/XMLschema.rst @@ -52,9 +52,9 @@ | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`fitaabb` | :ref:`eulerseq` | :ref:`meshdir` | :ref:`texturedir` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`discardvisual` | :ref:`convexhull` | :ref:`usethread` | :ref:`fusestatic` | | +| | | | :ref:`discardvisual` | :ref:`usethread` | :ref:`fusestatic` | :ref:`inertiafromgeom` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`inertiafromgeom` | :ref:`inertiagrouprange` | :ref:`assetdir` | :ref:`alignfree` | | +| | | | :ref:`inertiagrouprange` | :ref:`assetdir` | :ref:`alignfree` | | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | +------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |_| compiler |br| |_| |L| | | .. table:: | diff --git a/doc/changelog.rst b/doc/changelog.rst index 920cff46..6aa3b745 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -9,6 +9,7 @@ General ^^^^^^^ - The global compiler flag ``exactmeshinertia`` has been removed and replaced with the mesh-specific :ref:`inertia` attribute. +- The not-useful ``convexhull`` compiler option (to disable computation of mesh convex hulls) has been removed. - Removed the deprecated ``mju_rotVecMat`` and ``mju_rotVecMatT`` functions. - Sorting now uses a faster, native sort function (fixes :github:issue:`1638`). - The PBR texture layers introduced in 3.2.1 were refactored from seperate sub-elements to a single diff --git a/doc/includes/references.h b/doc/includes/references.h index e19503d4..e8b6f6e7 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -1693,7 +1693,6 @@ typedef struct mjsCompiler_ { // compiler options mjtByte degree; // angles in radians or degrees char eulerseq[3]; // sequence for euler rotations mjtByte discardvisual; // discard visual geoms in parser - mjtByte convexhull; // compute mesh convex hulls mjtByte usethread; // use multiple threads to speed up compiler mjtByte fusestatic; // fuse static bodies with parent int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom) diff --git a/include/mujoco/mjspec.h b/include/mujoco/mjspec.h index 58feb8f8..2dc3177b 100644 --- a/include/mujoco/mjspec.h +++ b/include/mujoco/mjspec.h @@ -131,7 +131,6 @@ typedef struct mjsCompiler_ { // compiler options mjtByte degree; // angles in radians or degrees char eulerseq[3]; // sequence for euler rotations mjtByte discardvisual; // discard visual geoms in parser - mjtByte convexhull; // compute mesh convex hulls mjtByte usethread; // use multiple threads to speed up compiler mjtByte fusestatic; // fuse static bodies with parent int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom) diff --git a/introspect/structs.py b/introspect/structs.py index 9f8c8b4c..0776273e 100644 --- a/introspect/structs.py +++ b/introspect/structs.py @@ -8853,11 +8853,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([ type=ValueType(name='mjtByte'), doc='discard visual geoms in parser', ), - StructFieldDecl( - name='convexhull', - type=ValueType(name='mjtByte'), - doc='compute mesh convex hulls', - ), StructFieldDecl( name='usethread', type=ValueType(name='mjtByte'), diff --git a/src/user/user_init.c b/src/user/user_init.c index b5d15413..08fceb59 100644 --- a/src/user/user_init.c +++ b/src/user/user_init.c @@ -39,7 +39,6 @@ void mjs_defaultSpec(mjSpec* spec) { spec->compiler.eulerseq[0] = 'x'; spec->compiler.eulerseq[1] = 'y'; spec->compiler.eulerseq[2] = 'z'; - spec->compiler.convexhull = 1; spec->compiler.usethread = 1; spec->compiler.inertiafromgeom = mjINERTIAFROMGEOM_AUTO; spec->compiler.inertiagrouprange[1] = mjNGROUP-1; diff --git a/src/user/user_mesh.cc b/src/user/user_mesh.cc index d1e20f46..695de30f 100644 --- a/src/user/user_mesh.cc +++ b/src/user/user_mesh.cc @@ -563,7 +563,7 @@ void mjCMesh::Compile(const mjVFS* vfs) { } // make graph describing convex hull - if ((model->compiler.convexhull && needhull_) || face_.empty()) { + if (needhull_ || face_.empty()) { MakeGraph(); } diff --git a/src/xml/xml_base.h b/src/xml/xml_base.h index a022831c..bf2c92d6 100644 --- a/src/xml/xml_base.h +++ b/src/xml/xml_base.h @@ -42,7 +42,6 @@ extern const int gain_sz; extern const int bias_sz; extern const int stage_sz; extern const int datatype_sz; -extern const mjMap coordinate_map[]; extern const mjMap angle_map[]; extern const mjMap enable_map[]; extern const mjMap bool_map[]; diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index 6fc675c5..6a70d13e 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -97,9 +97,9 @@ static void UpdateString(string& psuffix, int count, int i) { const char* MJCF[nMJCF][mjXATTRNUM] = { {"mujoco", "!", "1", "model"}, {"<"}, - {"compiler", "*", "20", "autolimits", "boundmass", "boundinertia", "settotalmass", + {"compiler", "*", "19", "autolimits", "boundmass", "boundinertia", "settotalmass", "balanceinertia", "strippath", "coordinate", "angle", "fitaabb", "eulerseq", - "meshdir", "texturedir", "discardvisual", "convexhull", "usethread", + "meshdir", "texturedir", "discardvisual", "usethread", "fusestatic", "inertiafromgeom", "inertiagrouprange", "assetdir", "alignfree"}, {"<"}, {"lengthrange", "?", "10", "mode", "useexisting", "uselimit", @@ -1008,9 +1008,6 @@ void mjXReader::Compiler(XMLElement* section, mjSpec* spec) { if (MapValue(section, "discardvisual", &n, bool_map, 2)) { spec->compiler.discardvisual = (n==1); } - if (MapValue(section, "convexhull", &n, bool_map, 2)) { - spec->compiler.convexhull = (n==1); - } if (MapValue(section, "usethread", &n, bool_map, 2)) { spec->compiler.usethread = (n==1); } diff --git a/src/xml/xml_native_writer.cc b/src/xml/xml_native_writer.cc index 907920a6..e9a47920 100644 --- a/src/xml/xml_native_writer.cc +++ b/src/xml/xml_native_writer.cc @@ -920,9 +920,6 @@ void mjXWriter::Compiler(XMLElement* root) { XMLElement* section = InsertEnd(root, "compiler"); // settings - if (!model->compiler.convexhull) { - WriteAttrTxt(section, "convexhull", FindValue(bool_map, 2, model->compiler.convexhull)); - } WriteAttrTxt(section, "angle", "radian"); if (!model->get_meshdir().empty()) { WriteAttrTxt(section, "meshdir", model->get_meshdir()); diff --git a/test/engine/testdata/collision_driver/midphase.xml b/test/engine/testdata/collision_driver/midphase.xml index 3939de92..49bc5dbf 100644 --- a/test/engine/testdata/collision_driver/midphase.xml +++ b/test/engine/testdata/collision_driver/midphase.xml @@ -1,6 +1,6 @@ - + )"; - mjModel* model = LoadModelFromString(xml); - ASSERT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -458,8 +457,9 @@ TEST_F(MjCMeshTest, FaceNormalAutogenerated) { )"; - mjModel* model = LoadModelFromString(xml); - ASSERT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -480,9 +480,9 @@ TEST_F(MjCMeshTest, SmallInertiaLoads) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - ASSERT_THAT(model, NotNull()) << error.data(); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -510,18 +510,18 @@ TEST_F(MjCMeshTest, TinyInertiaFails) { TEST_F(MjCMeshTest, FlippedFaceAllowedLegacyInertia) { const std::string xml_path = GetTestDataFilePath(kMalformedFaceOBJPath); - std::array error; - mjModel* model = mj_loadXML(xml_path.c_str(), 0, error.data(), error.size()); - EXPECT_THAT(model, testing::NotNull()) << error.data(); + char error[1024]; + mjModel* model = mj_loadXML(xml_path.c_str(), 0, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; EXPECT_THAT(model->nmeshface, 4); mj_deleteModel(model); } TEST_F(MjCMeshTest, MissingFaceAllowedConvexInertia) { const std::string xml_path = GetTestDataFilePath(kCompareInertiaPath); - std::array error; - mjModel* model = mj_loadXML(xml_path.c_str(), 0, error.data(), error.size()); - EXPECT_THAT(model, testing::NotNull()) << error.data(); + char error[1024]; + mjModel* model = mj_loadXML(xml_path.c_str(), 0, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; EXPECT_THAT(model->nmeshface, 10); EXPECT_THAT(model->body_inertia[3], model->body_inertia[9]); EXPECT_THAT(model->body_inertia[4], model->body_inertia[10]); @@ -583,9 +583,9 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedWorld) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; CheckTetrahedronWasRescaled(model); mj_deleteModel(model); } @@ -605,9 +605,9 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedNoMass) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()) << error.data(); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; CheckTetrahedronWasRescaled(model); mj_deleteModel(model); } @@ -628,9 +628,9 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedInertial) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; CheckTetrahedronWasRescaled(model); mj_deleteModel(model); } @@ -650,9 +650,9 @@ TEST_F(MjCMeshTest, FlippedFaceAllowedNegligibleArea) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; CheckTetrahedronWasRescaled(model); mj_deleteModel(model); } @@ -706,9 +706,9 @@ TEST_F(MjCMeshTest, AreaTooSmallAllowedWorld) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -736,10 +736,9 @@ TEST_F(MjCMeshTest, VolumeTooSmall) { TEST_F(MjCMeshTest, VolumeSmallAllowedShell) { static constexpr char xml[] = R"( - @@ -749,9 +748,9 @@ TEST_F(MjCMeshTest, VolumeSmallAllowedShell) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - ASSERT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; EXPECT_LE(mju_abs(model->geom_size[0]), 1); EXPECT_LE(mju_abs(model->geom_size[1]), 1); EXPECT_LE(mju_abs(model->geom_size[2]), 1); @@ -815,9 +814,9 @@ TEST_F(MjCMeshTest, VolumeTooSmallAllowedWorld) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -895,8 +894,9 @@ TEST_F(MjCMeshTest, MeshPosQuat) { )"; - mjModel* model = LoadModelFromString(xml); - ASSERT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; // Loading the mesh results in an offset of the geom's pos and quat due to the // fact that the geom's center is not the volumetric center of the mesh. To // recover the geom's originally specified pose, the offset used is stored in @@ -953,8 +953,9 @@ TEST_F(MjCMeshTest, MeshScale) { )"; - mjModel* model = LoadModelFromString(xml); - ASSERT_THAT(model, NotNull()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; EXPECT_THAT(AsVector(model->mesh_scale + 0, 3), ElementsAre(1, 1, 1)); EXPECT_THAT(AsVector(model->mesh_scale + 3, 3), ElementsAre(0.9, 1, -1)); @@ -972,9 +973,9 @@ TEST_F(MjCMeshTest, CreateFaceTexCoord) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); - EXPECT_THAT(model, NotNull()) << error.data(); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); + ASSERT_THAT(model, NotNull()) << error; mj_deleteModel(model); } @@ -1057,13 +1058,10 @@ TEST_F(MjCMeshTest, InvalidIndexInFace) { )"; - std::array error; - mjModel* model = LoadModelFromString(xml, error.data(), error.size()); + char error[1024]; + mjModel* model = LoadModelFromString(xml, error, sizeof(error)); ASSERT_THAT(model, IsNull()); - EXPECT_THAT( - error.data(), - HasSubstr( - "in face 0, vertex index 6 does not exist")); + EXPECT_THAT(error, HasSubstr("in face 0, vertex index 6 does not exist")); mj_deleteModel(model); } diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index 4eab533b..f456e3f6 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -5727,7 +5727,6 @@ public unsafe struct mjsCompiler_ { public byte degree; public fixed sbyte eulerseq[3]; public byte discardvisual; - public byte convexhull; public byte usethread; public byte fusestatic; public int inertiafromgeom;