Isaac sim4.5 debug

Note: For any Isaac Lab topics, please submit your topic to its GitHub repo (GitHub - isaac-sim/IsaacLab: Unified framework for robot learning built on NVIDIA Isaac Sim) following the instructions provided on Isaac Lab’s Contributing Guidelines (Contribution Guidelines — Isaac Lab Documentation).

Please provide all relevant details below before submitting your post. This will help the community provide more accurate and timely assistance. After submitting, you can check the appropriate boxes. Remember, you can always edit your post later to include additional information if needed.

Isaac Sim Version

[1] 4.5.0
4.2.0
4.1.0
4.0.0
4.5.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Operating System

[1] Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify):

Topic Description

Detailed Description

(Describe the issue in detail, including what you were trying to do, what you expected to happen, and what actually happened)
I downloaded the Isaac Sim 4.5 from the NVIDIA website, but when I used the GeometryPrim in isaacsim.core.prims. I wanted to see the object’s contact info, so I used this “self.peg.get_contact_offsets()”,“self.peg.get_rest_offsets()”, but there was an error saying “AttributeError: module ‘pxr.UsdPhysics’ has no attribute ‘PhysxCollisionAPI’. Did you mean: ‘MeshCollisionAPI’?”. Then I looked up the pxr module found there is no PhysxCollisionAPI in recent pxr docs. So I knew I was using old isaacsim.core.prims module, how can I upgrade isaacsim.core.prims in 4.5 ? I am sure that I did not change any python code in isaacsim.core.prims.

@2230580090 are you invoking the geometry prim programmatically or via GUI? if the former, would you be able to provide your code snippet?

I use python to use GeometryPrim. Here is my code " def add_table(self,table_position=np.array([[0.7,0.2,1.03]]),
hole_translation= np.array([[-0.06, -0.1, 0.0]]),
hole_orientation= None,
peg_translation= np.array([[-0.1, -0.15, 0.0]]),
peg_orientation= None):
# 创建桌子
# hole and peg will seted in their parent frame, just use translation
# position is relative to the world frame,so just translation
table_path = self.assets_root_path + “/Isaac/Props/Mounts/textured_table.usd”
add_reference_to_stage(usd_path=table_path, prim_path=“/World/table”)
self.table = RigidPrim(prim_paths_expr=“/World/table”,name=“table_0”,
positions=table_position / get_stage_units(),
)
self.world.scene.add(self.table)
self.world.reset()
hole_path = self.assets_root_path + “/Isaac/IsaacLab/Factory/factory_hole_8mm.usd”
peg_path = self.assets_root_path + “/Isaac/IsaacLab/Factory/factory_peg_8mm.usd”
add_reference_to_stage(usd_path=hole_path,prim_path=“/World/table/hole”)
add_reference_to_stage(usd_path=peg_path,prim_path=“/World/table/peg”)
self.hole = GeometryPrim(prim_paths_expr=“/World/table/hole”,name=“hole_0”,
translations=hole_translation / get_stage_units(),
orientations=hole_orientation,
)
# add_reference_to_stage(usd_path=hole_path,prim_path=“/World/hole”)
# self.hole = RigidPrim(prim_paths_expr=“/World/hole”,name=“hole_0”,
# positions=np.array([[0.64, 0.1 , 1.03]])
# )

    self.world.scene.add(self.hole)
    self.world.reset()
    self.peg = GeometryPrim(prim_paths_expr="/World/table/peg",name="peg_0",
                    translations=peg_translation / get_stage_units(),
                    orientations=peg_orientation,
                        )
    # add_reference_to_stage(usd_path=peg_path,prim_path="/World/peg")
    # self.peg = RigidPrim(prim_paths_expr="/World/peg",name="peg_0",
    #                     positions=np.array([[0.59999996, 0.05      , 1.03 ]])
    #                     )
    self.world.scene.add(self.peg)
    self.world.reset()

import numpy as np
import gymnasium as gym
import sys
import cv2 # 用于图像处理

import carb
from isaacsim.core.api import World
from isaacsim.robot.manipulators.examples.franka import Franka
from isaacsim.robot.manipulators.examples.franka import KinematicsSolver
from isaacsim.core.utils.stage import add_reference_to_stage, get_stage_units
from isaacsim.storage.native import get_assets_root_path
from isaacsim.core.utils.viewports import set_camera_view
from isaacsim.core.utils.rotations import matrix_to_euler_angles, euler_angles_to_quat
from isaacsim.core.api.objects import VisualSphere, VisualCylinder
from isaacsim.core.prims import GeometryPrim,RigidPrim
from omni.isaac.sensor import Camera
from pxr import UsdLux, Gf

class FrankaGym(gym.Env):
metadata = {‘render.modes’: [‘human’]}
def init(self, max_steps=1000, stage_units =1.0, render=True, render_mode=‘human’,task_message=None):
self.max_steps = max_steps
self.episode_steps = 0
self.render = render
self.render_mode = render_mode
self.action_space = gym.spaces.Box(low=-1.0, high=1.0, shape=(7,))
self.observation_space = gym.spaces.Box(low=-np.inf, high=np.inf, shape=(10,))

    self.world = World(stage_units_in_meters=stage_units)
    self.world.scene.add_default_ground_plane()
    set_camera_view(
    eye=[1.3, 0.,1.6], target=[0.00, 0.00, 0.9], camera_prim_path="/OmniverseKit_Persp")  # set camera view
    
    self.stage = self.world.stage

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

    self.add_franka()
    self.add_sphere_light()
    self.add_table()     
    self.world.step(render=self.render) 
    self.camera_world = Camera(prim_path="/World/CameraWorld",
                    name="camera_1",
                    resolution=(256,256),
                    frequency=20,
                    orientation=np.array([0.,0.,0.,-1.]),
                    position=np.array([1,0.0,1.2]),
                    )
    self.camera_world.set_clipping_range(0.01, 10.0)
    self.camera_world.set_focal_length(1)
    self.world.scene.add(self.camera_world)
    self.world.reset()
    print("peg_offsets:",self.peg.get_rest_offsets())
    print("peg_contact_offsets:",self.peg.get_contact_offsets())

"
The two prints have the same question.

Hi @2230580090, sorry for the very late reply. This actually seems like a bug in the API. I have raised a ticket to look into this more closely. Will keep you updated.