Collision issues in empty collision mesh space #2817
-
IntroHi! I am a researcher, I use MuJoCo for my research on simulation. My setupMujoco 3.3.5, Windows c++ My questionHello. I'm storing a point cloud as a std::vector<float[3]> and meshing it using MarchingCubeCPP. I ran a collision test, and collisions are detected even in empty spaces, as shown in the image. Since version 3.3.5, sdflib is no longer required, so I used the sdf type for the tool and point cloud mesh. How can I accurately detect collisions on the mesh surface, even through those empty spaces? also share point cloud obj file by zip ![]() Minimal model and/or code that explain my questionIf you encountered the issue in a complex model, please simplify it as much as possible (while still reproducing the issue). Model: minimal XML<asset>
<material name="robot1_black" class="robot1_ur5e" rgba="0.033 0.033 0.033 1"/>
<material name="robot1_jointgray" class="robot1_ur5e" rgba="0.278 0.278 0.278 1"/>
<material name="robot1_linkgray" class="robot1_ur5e" rgba="0.82 0.82 0.82 1"/>
<material name="robot1_urblue" class="robot1_ur5e" rgba="0.49 0.678 0.8 1"/>
<mesh name="robot1_base_0" content_type="model/obj" file=".../model/ur5e/assets/base_0.obj"/>
<mesh name="robot1_base_1" content_type="model/obj" file=".../model/ur5e/assets/base_1.obj"/>
<mesh name="robot1_shoulder_0" content_type="model/obj" file=".../model/ur5e/assets/shoulder_0.obj"/>
<mesh name="robot1_shoulder_1" content_type="model/obj" file=".../model/ur5e/assets/shoulder_1.obj"/>
<mesh name="robot1_shoulder_2" content_type="model/obj" file=".../model/ur5e/assets/shoulder_2.obj"/>
<mesh name="robot1_upperarm_0" content_type="model/obj" file=".../model/ur5e/assets/upperarm_0.obj"/>
<mesh name="robot1_upperarm_1" content_type="model/obj" file=".../model/ur5e/assets/upperarm_1.obj"/>
<mesh name="robot1_upperarm_2" content_type="model/obj" file=".../model/ur5e/assets/upperarm_2.obj"/>
<mesh name="robot1_upperarm_3" content_type="model/obj" file=".../model/ur5e/assets/upperarm_3.obj"/>
<mesh name="robot1_forearm_0" content_type="model/obj" file=".../model/ur5e/assets/forearm_0.obj"/>
<mesh name="robot1_forearm_1" content_type="model/obj" file=".../model/ur5e/assets/forearm_1.obj"/>
<mesh name="robot1_forearm_2" content_type="model/obj" file=".../model/ur5e/assets/forearm_2.obj"/>
<mesh name="robot1_forearm_3" content_type="model/obj" file=".../model/ur5e/assets/forearm_3.obj"/>
<mesh name="robot1_wrist1_0" content_type="model/obj" file=".../model/ur5e/assets/wrist1_0.obj"/>
<mesh name="robot1_wrist1_1" content_type="model/obj" file=".../model/ur5e/assets/wrist1_1.obj"/>
<mesh name="robot1_wrist1_2" content_type="model/obj" file=".../model/ur5e/assets/wrist1_2.obj"/>
<mesh name="robot1_wrist2_0" content_type="model/obj" file=".../model/ur5e/assets/wrist2_0.obj"/>
<mesh name="robot1_wrist2_1" content_type="model/obj" file=".../model/ur5e/assets/wrist2_1.obj"/>
<mesh name="robot1_wrist2_2" content_type="model/obj" file=".../model/ur5e/assets/wrist2_2.obj"/>
<mesh name="robot1_wrist3" content_type="model/obj" file=".../model/ur5e/assets/wrist3.obj"/>
<mesh name="robot1_weld_torch" content_type="model/stl" file=".../model/tool/parts/asset/weld_Torch.stl"/>
<mesh name="pointcloud_mesh" file="../../../../model/pointcloud/MarchingCubeMesh.obj"/>
</asset>
<worldbody>
<site name="robot1_base_attachment_site" pos="0 0 0" quat="0 0 0 -1" size="0.01" rgba="1 0 0 1"/>
<body name="base"/>
<body name="pc_socket">
<geom name="pointcloud_geom" type="sdf" mesh="pointcloud_mesh" contype="1" conaffinity="1" condim="1" rgba="0.2 0.7 1 1" pos="0.200000000 0.200000000 0.000000000" quat="0.000000000 0.000000000 0.000000000 1.000000000"/>
</body>
<light name="robot1_spotlight" target="robot1_wrist_2_link" pos="0 1 2" dir="0 0 -1" mode="targetbodycom"/>
<body name="robot1_base" childclass="robot1_ur5e">
...
<site name="robot1_attachment_site" pos="0 0.1 0" quat="-0.707107 0.707107 0 0"/>
<body name="robot1_cylinder" pos="0 0.135 0" quat="-0.706841 0.706841 -0.0193827 -0.0193827">
<geom size="0.03 0.035" quat="0.999624 0 0 0.0274113" type="cylinder"/>
<body name="robot1_weld_torch" pos="0 0 0.0175" quat="0.999624 0 0 0.0274113">
<geom type="sdf" mesh="robot1_weld_torch"/>
</body>
</body>
</body>
</body>
</body>
</body>
</body>
</body>
</body>
</worldbody>
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: 1 comment 9 replies
-
Do you mean that this was not an issue with sdflib but it is an issue now, or you never tested it with sdflib? |
Beta Was this translation helpful? Give feedback.
I have to say it seems challenging/impossible to capture this thin needle with an SDF automatically (when the geom contains also much bigger parts).. Maybe you want to split this asset into the needle and the rest? If the needle is a cylinder you could even use a primitive for this part.