How to simulate holes when importing urdf? The peg can not insert to the hole

Hello,
I am now going to do a peg in hole tasks. However, when I import the urdf of peg and hole, the peg can not insert to the hole. I think it may related to the convex hull, but I don’t know how to configure it … can anyone help me ?

<robot name="peg">
    <link concave="yes" name="base_link">
        <contact>
            <lateral_friction value="1.0"/>
        </contact>
        <inertial>
            <origin xyz="0 0 0.05"/>
            <mass value="1"/>
            <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="hole.STL"/>
            </geometry>
      <material name="mug">
        <color rgba="0 1 0.2 0.5"/>
        <specular rgb="1 1 1"/>
      </material>
        </visual>
        <collision concave="yes">
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="hole.STL"/>
            </geometry>
        </collision>
    </link>
</robot>

Hello,

To modify the Collision Type after converting URDF to USD using the URDF Importer, you can follow these steps:

  1. Open the converted USD file created by the URDF Importer.
  2. Open the hierarchy of the USD file by navigating through the Stage tab on the right side.
  3. Inside the Properties, locate the Physics → Collider section and open it.
  4. Modify the Approximation setting from ConvexFull to SDF Mesh or any other desired option.
  5. Save the changes by pressing Ctrl + S. (Note: Collision visualization can be enabled by clicking on the eye icon in the top-left corner, then selecting Show By Type → Physics → Colliders → All.)

I hope this helps!

Hello,@ smakolon385
I followed your steps, but can not find “Collider section” in the Physics.

I apologize for the lack of explanation!

Based on the URDF you provided, the collision tags and visual tags are defined within the URDF, so there should be a “collisions” stage along with the “visuals” stage in the USD generated by the URDF Importer. You should be able to find it by expanding the “+” icon next to “base_link” in the Stage tab on the right. Under “collisions,” you should see “mesh_0,” and I believe you will find “Physics → Collider” there.

Thanks,
I can found the Physics → Collider now, But the peg still can not insert into the hole

I’m glad to hear that you were able to change the collision type successfully.

Can you enable collision_visualization to check the collision mesh? You can enable collision_visualization by clicking on the eye icon in the top-left corner and then selecting Show By Type → Physics → Colliders → All. This should visualize the collision mesh as a green Triangle Mesh. Please take a look at the Collision Mesh and verify if there is a proper hole on the “hole” side.

Thanks,
I find that the collision mesh of the hole was convex, then I change the Collider setting to SDF Mesh in the visuals stage, and the peg can successfully insert into the hole!
However, when I try to import a smaller hole, the peg still can not insert to the hole.


image

If it’s alright, could you please provide me with the URDF files for the Peg and Hole, as well as the corresponding STL files? Based on the images I’ve seen, it seems that they haven’t been converted to SDF Mesh yet. I would like to try converting them myself and verify the results. Once I have confirmed it, I will attach the USD files to this thread.

sorry, Maybe I missed some steps, but now it’s okay again.
I have summarized the following steps:

1, import the urdf , and checked “fixed based link” and “create physics scene” (is this necessary?)
2, Open the corresponding USD file
3, change the mesh type to SDF Mesh and check the mesh by “enable collision_visualization”, but do not add a rigid body with colliders present (Not verified, but it has been added before. I don’t know what’s going on, but it sometimes doesn’t work)
4, use “create_prim” to create the hole to the world.

Thank you again for your answer!
By the way, from where you found that they haven’t been converted to SDF Mesh yet?

That’s great to hear!

The reason I thought the objects were not converted to SDF was because when I created an Insertion task in the past using SDF, the Triangle Mesh was provided in finer detail, and the mesh appeared on the object’s surface. However, when I looked at the images you provided, it seemed like the mesh was positioned away from the object’s surface, which led me to believe it wasn’t converted to SDF.

The current mesh now is like this, I don’t know whether it provided fine details?
Because even if I increase the “SDF SOLUTION”, the mesh seems not change. Furthermore, when I set the value to 2500, the mesh disappeared…
hole (2).STL (7.8 KB)



I see.
It doesn’t seem to have the level of fine detail I expected. In my case, I would directly open the STL file in Blender or similar software and subdivide the mesh to make it finer.

Okay, Thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.