World position not updating during simulation run

I’ve being trying to get the position of prims in my simulated robot, but no matter what method I use to get the position of the part, I get the same initial value returned. Even though the position of the part, that I am trying to probe visually changes the position during the episode.

I have tried the following approach:

class RobotView:
  def __init__([....]):
   [...]
   base_path = "/World/envs/.*/robot/"
   sensor = XFormPrimView(prim_paths_expr= base_path + sensor_data['prim_path'], name= sensor_data['name'], 
   reset_xform_properties=True)
class AnyTask:
    def set_up_scene(self, scene: Scene) -> None:
        scene.add(self.robots.sensor)
        [...]

    def pre_physics_step(self, actions: torch.Tensor):
        pos, rot = self.robots.sensor.get_world_poses()

The returned position and rotation remain the same value, even though they should change.

They also do not change when I query them directly using the following approach:

prim = stage.GetPrimAtPath(some_prim_path)
matrix: Gf.Matrix4d = omni.usd.get_world_transform_matrix(prim)
translate: Gf.Vec3d = matrix.ExtractTranslation()

Any help would be greatly appreciated

1 Like

Hi @schmiJo

I think the problem may come from XFormPrimView and the fabric extension.

Fabric notes:

  • Using Fabric means that the data are not available in USD. This will cause USD based functionality to not work. For example debug visualization of physics colliders wont work anymore, because the transformations are not synchronized.
  • Using a python script to update and get USD state wont work because USD does not have current transformation information.

Or because the /persistent/physics/updateToUsd settings if set to false

The XFormPrimView get_world_pose method uses the USD API to get this information as well as the code you showed at the end of your comment.

Can you use RigidPrimView (which uses the PhysX tensor API) instead to see if the problem is fixed?

1 Like

Hi @toni.sm
Thanks for your answer.
Yes RigidPrimView works, but I would strongly prefer not using it, because that would lead to issues with rigging the robot.
How can I update the /persistent/physics/updateToUsd to true?
Or do I need the fabrics extension, and if I don’t how could I disable it?

Alternatively, could I query the prim position data with the PhysX api directly?

Hi @schmiJo

I recommend you use (at least for reinforcement learning) the RigidPrimView even if you need to modify your assets. Doing simulation with PhysX tensor if faster compared with USD API.

For disabling fabric in OmniIsaacGymEnvs visit the Simulation section in its documentation. To do this from a standalone application use the following snippet:

import omni.isaac.core.utils.extensions as extensions_utils

extensions_utils.disable_extension(extension_name="omni.physx.flatcache")

On the other hand, run Isaac Sim or the script with --/persistent/physics/updateToUsd=true argument from the terminal for enabling this setting.


Well, Isaac Sim Core uses the kit/extsPhysics/omni.physics.tensors extension for tensor API… but I don’t have enough knowledge and I haven’t done any tests to answer this question categorically.

Thank you @toni.sm

You cant access directly PhysX SDK, since that does have C++ API only, however you can use this python call to get the transformation indirectly from PhysX through omni.physx:

        curr_transform = get_physx_interface().get_rigidbody_transformation(str(path))
        rv_success = curr_transform["ret_val"]
        if rv_success:
            curr_pos_f3 = curr_transform["position"]
            curr_pos = Gf.Vec3d(curr_pos_f3[0], curr_pos_f3[1], curr_pos_f3[2])
            curr_rot_f4 = curr_transform["rotation"]
            curr_rot_quat = Gf.Quatd(curr_rot_f4[3], curr_rot_f4[0], curr_rot_f4[1], curr_rot_f4[2])

This would give you the transformation that is read from PhysX SDK rigid body.

2 Likes

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