Collision problem

Hi

We are doing a collision test with the isaac sim, and there is a phenomenon where two objects pass through. Please check the picture below

The purpose of this project is to insert the pin into the hole, and I think the parts should not overlap, so I wonder what setting should be modified to improve it.

I created several cubes around a single stl file so that as many parts as possible can be contacted.

Desktop.zip (152.5 KB)

This is screenshot and usd files.

Hi,
Could you please flatten out the stage? Looks like I am missing some parts. Wanted to try this out, looks like collisions look correct, it might require higher simulation frequency or collision tolerances settings tweak.
Regards,
Ales

Thank you for your answer.

But i think stage is flatten.

I think it works normally when there is no robot, but when there is a robot, the parts cannot hold their power due to the force of the robot, so it seems that a problem occurs.

If you don’t mind, can you test it with this code.
Please change the path of the previously attached usd file, it will work.

This is my full python code. (2022.2.0 ver)

Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.

NVIDIA CORPORATION and its licensors retain all intellectual property

and proprietary rights in and to this software, related documentation

and any modifications thereto. Any use, reproduction, disclosure or

distribution of this software and related documentation without an express

license agreement from NVIDIA CORPORATION is strictly prohibited.

from omni.isaac.kit import SimulationApp

simulation_app = SimulationApp({“headless”: False})

from omni.isaac.core import World
from omni.isaac.manipulators import SingleManipulator
from omni.isaac.manipulators.grippers import SurfaceGripper
from omni.isaac.manipulators.grippers import Gripper

from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.universal_robots.controllers import PickPlaceController
from omni.isaac.universal_robots.controllers import RMPFlowController

from omni.isaac.core.objects import DynamicCuboid

from omni.isaac.core.utils.numpy import euler_angles_to_quats, quats_to_euler_angles

from omni.isaac.universal_robots import KinematicsSolver

import carb
import sys
import numpy as np
import argparse

import omni
from pxr import Gf, Sdf, UsdPhysics
from pxr import PhysxSchema

stage = omni.usd.get_context().get_stage()

scene = UsdPhysics.Scene.Define(stage, “/World/physics”)

scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))

scene.CreateGravityMagnitudeAttr().Set(9.81)

PhysxSchema.PhysxSceneAPI.Apply(stage.GetPrimAtPath(“/World/physics”))

physxSceneAPI = PhysxSchema.PhysxSceneAPI.Get(stage, “/World/physics”)

physxSceneAPI.CreateEnableCCDAttr(True)

physxSceneAPI.CreateEnableStabilizationAttr(True)

physxSceneAPI.CreateEnableGPUDynamicsAttr(False)

physxSceneAPI.CreateBroadphaseTypeAttr(“GPU”)

physxSceneAPI.CreateSolverTypeAttr(“TGS”)

Add a physics scene prim to stage

scene = UsdPhysics.Scene.Define(stage, Sdf.Path(“/World/physicsScene1”))

Set gravity vector

scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))
scene.CreateGravityMagnitudeAttr().Set(9.8)

my_world = World(stage_units_in_meters=1.0)
my_world.scene.add_default_ground_plane()

parser = argparse.ArgumentParser()
parser.add_argument(“–test”, default=False, action=“store_true”, help=“Run in test mode”)
args, unknown = parser.parse_known_args()

assets_root_path = get_assets_root_path()
if assets_root_path is None:
carb.log_error(“Could not find Isaac Sim assets folder”)
simulation_app.close()
sys.exit()

asset_path = assets_root_path + “/Isaac/Robots/UR10/ur10.usd”
add_reference_to_stage(usd_path=asset_path, prim_path=“/World/UR10”)

#pin(gripper) part (please change your path)
gripper_usd = “C:\isaac sim\connector RL\isaac sim env/rectangle_pin.usd”
add_reference_to_stage(usd_path=gripper_usd, prim_path=“/World/UR10/ee_link”)
gripper = SurfaceGripper(end_effector_prim_path=“/World/UR10/ee_link”, translate=0.10, direction=“y”)

#hole part (please change your path)
hole_part = “C:\isaac sim\connector RL\isaac sim env/rectangle_hole.usd”

add_reference_to_stage(usd_path=hole_part, prim_path=“/World/hole”)

ur10 = my_world.scene.add(
SingleManipulator(prim_path=“/World/UR10”, name=“my_ur10”, end_effector_prim_name=“ee_link”, gripper=gripper)
)

ur10.set_joints_default_state(positions=np.array([0, -np.pi / 2, -np.pi / 2, 0, np.pi / 2, 0]))

my_world.scene.add_default_ground_plane()
my_world.reset()

my_controller = KinematicsSolver(ur10)
articulation_controller = ur10.get_articulation_controller()
current_joint_positions=ur10.get_joint_positions()

i = 0.001
t = 0.0 #theta

target_position = 0
target_orientation = 0
actions = 0

init_new_position = gripper.get_local_pose()[0]
int_target_orientation = gripper.get_local_pose()[1]

temp_init_new_position = init_new_position.copy()
temp_init_new_orentation = int_target_orientation.copy()

temp_init_new_orentation_euler = quats_to_euler_angles(temp_init_new_orentation)

while simulation_app.is_running():
my_world.step(render=True)

if my_world.is_playing():
    
    if my_world.current_time_step_index == 0:
        my_world.reset()
        #my_controller.reset()
        ur10.set_joints_default_state(positions=np.array([0, -np.pi / 2, -np.pi / 2, 0, np.pi / 2, 0]))
        
        init_new_position      = temp_init_new_position.copy()
        int_target_orientation = temp_init_new_orentation.copy()
        
        i = 0.001
        t = 0.0 #theta


    observations = my_world.get_observations()

 
    if init_new_position[0] < -0.8645: #20cm 
        continue
        
        
    else:
        
        init_new_position[0] -= i
        calc_new_position       = init_new_position
        calc_target_orientation = int_target_orientation
        
        actions, succ      = my_controller.compute_inverse_kinematics(
        target_position    = calc_new_position,
        target_orientation = calc_target_orientation)

        if succ:
            articulation_controller.apply_action(actions)
            
        print('calc_new_position', calc_new_position)

simulation_app.close()

Ok I think I was able to get this working okish, but there were few things I had to do to make this work.

  1. There is an additional articulation root on the ee_link, there was an error about that, this articulation root should be removed.
  2. There was an error about nested rigid bodies too, the rigid body on path /World/UR10/ee_link/Xform/mesh_
    should be removed too
  3. The mass of the object with the hole is crazy high. I am not sure what the intention here is. If the object should move try to set its mass to something reasonable like 10. If the object should not move then disable the rigid body (check box) on the hole/xform prim.

If you want to get more precise collisions, increase eventually the PhysicsScene simulation frequency. (there are two scenes delete one first so that you dont do changes on incorrect one).

Regards,
Ales