Error "XML Error: Element size must be a multiple of dim+1 mujoco" #2107
-
IntroHi! I am a undergrad student at ETH Zurich, I use MuJoCo for my research on Multimaterial deformable objects. My setupI use MuJoCo 3.2.3 with python bindings. My questionWhen loading the file "parts_3800_3.xml" in the mujoco viewer, the error This error should imply, that the file "part-1.41.msh" has an error, i.e. one of the When I remove the flexcomp with the name "part 2", I can view the "parts_3800_3.xml" without any error in the mujoco viewer. Is there actually a problem with the file "part-1.41.msh" which I and my code have overlooked or is there a bug in mujoco? I have attached all 4 files in the follwoing zip folder: Thank you for your help. Minimal model and/or code that explain my questionModel: <!-- 3 PARTS
created by Sebastian Heckers on 25.04.2024
Example of multi-material deformable objects with 3 parts/meshes.
With Bottle (ID 3800), body, neck and lid.
-->
<mujoco model="Sphere Drop">
<include file="../drop/scene.xml"/>
<asset>
<texture name="tex" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .1 .9" rgb2=".9 .3 .3"/>
<material name="tex" texture="tex" texrepeat="1 1" texuniform="true" reflectance=".2"/>
</asset>
<!-- set default units -->
<compiler angle="radian" meshdir="../../../assets/"/>
<extension>
<plugin plugin="mujoco.elasticity.solid" />
</extension>
<compiler autolimits="true"/>
<option solver="CG" tolerance="1e-6" timestep=".0001"/>
<size memory="240M"/>
<worldbody>
<flexcomp name="part1" type="gmsh" file="partnet/3800/part-0.41.msh" rgba=".8 .2 .2 1" pos="0 0 5" euler="0 0 -1.57075" mass="500" scale="3 3 3" >
<!-- <contact condim="3" solref="0.01 1" solimp=".95 .99 .0001" selfcollide="none" friction="5 0.5 0.01"/> -->
<plugin plugin="mujoco.elasticity.solid">
<!--Units are in Pa (SI)-->
<config key="young" value="1e5"/>
<config key="poisson" value="0.45"/>
<config key="damping" value="0.0"/>
</plugin>
</flexcomp>
<flexcomp name="part2" type="gmsh" file="partnet/3800/part-1.41.msh" rgba=".2 .2 .8 1" pos="0 0 5" euler="0 0 -1.57075" mass="500" scale="3 3 3" >
<!-- <contact condim="3" solref="0.01 1" solimp=".95 .99 .0001" selfcollide="none" friction="5 0.5 0.01"/> -->
<plugin plugin="mujoco.elasticity.solid">
<!--Units are in Pa (SI)-->
<config key="young" value="1e7"/>
<config key="poisson" value="0.45"/>
<config key="damping" value="0.0"/>
</plugin>
</flexcomp>
<flexcomp name="part3" type="gmsh" file="partnet/3800/part-2.41.msh" rgba=".2 .8 .2 1" pos="0 0 5" euler="0 0 -1.57075" mass="500" scale="3 3 3" >
<!-- <contact condim="3" solref="0.01 1" solimp=".95 .99 .0001" selfcollide="none" friction="5 0.5 0.01"/> -->
<plugin plugin="mujoco.elasticity.solid">
<!--Units are in Pa (SI)-->
<config key="young" value="1e8"/>
<config key="poisson" value="0.45"/>
<config key="damping" value="0.0"/>
</plugin>
</flexcomp>
</worldbody>
</mujoco>
Code: import mujoco
import mediapy as media
model = mujoco.MjModel.from_xml_string(xml)
data = mujoco.MjData(model)
with mujoco.Renderer(model) as renderer:
mujoco.mj_forward(model, data)
renderer.update_scene(data)
media.show_image(renderer.render()) Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Do the meshes contain only tetrahedra? Cc @mohammad200h as he knows more about the GMSH format. |
Beta Was this translation helpful? Give feedback.
-
Have you tried to set https://mujoco.readthedocs.io/en/latest/XMLreference.html#body-flexcomp-dim in the XML? |
Beta Was this translation helpful? Give feedback.
-
You need to set dim=3 in xml. if you look at the content of part-0.41.msh:
you can see 3 0 0 1663. |
Beta Was this translation helpful? Give feedback.
You need to set dim=3 in xml.
Here is a simplified model that loads.
mujoco_model_solution.zip
if you look at the content of part-0.41.msh:
you can see 3 0 0 1663.
3 indicates that this is a volumetric mesh. Therefore you need to set the dim=3 in xml.