Before a URDF file from onshape-to-robot can be imported into MuJoCo, a few changes should be made to it’s structure to enable all needed functionalities.
This is XML element that we currently insert at the beginning of every URDF before loading it into MuJoCo.
<mujoco> <!-- discardvisual is disabled to include both the colliders and the mesh skins --> <!-- fusestatic is disabled to allow collision detection with static parts --> <compiler meshdir="meshes/" discardvisual="false" fusestatic="false"/> <!-- filterparent is disabled to allow collision detection between children and parent links --> <option> <flag filterparent="disable"/> </option> </mujoco>
The four settings being set by this are the following:
meshdir: This tells MuJoCo where to find the files containing all .stl meshes
discardvisual: This sets whether or not <visuals> elements should be rendered as well. Setting this to “false” groups all visual elements into a separate “geom” group form the <collision> elements.
fusestatic: Sets whether or not static links are fused together with their parent links. This has the side effect that the dummy link which can be added by onshape-to-robot and it’s associated links are considered world elements and thus not included in the collision detection (At least that’s our current best guess as to why that happened).
filterparent: Sets whether or not child links can collide with their parent links.