isaac-sim / IsaacLab

Unified framework for robot learning built on NVIDIA Isaac Sim
https://isaac-sim.github.io/IsaacLab
Other
2.17k stars 892 forks source link

[Bug Report] Bug title PhysX error: The application needs to increase PxGpuDynamicsMemoryConfig::totalAggregatePairsCapacity #981

Closed hanlin-ga closed 1 month ago

hanlin-ga commented 1 month ago

Hello, I am running "./isaaclab.sh -p source/standalone/workflows/rsl_rl/train.py --task Isaac-Lift-Cube-Franka-v0 --headless --device cuda:0". I modified the script of "joint_pos_env_cfg.py" to make Franka to pick up a 006_mustard_bottle from YCB dataset. It was ok to train the model to pick up a dex_cube_instanceable.usd, but when I changed to 006_mustard_bottle.usd, it shows the error:

[Error] [omni.physx.plugin] PhysX error: The application needs to increase PxGpuDynamicsMemoryConfig::totalAggregatePairsCapacity to 16790 , otherwise, the simulation will miss interactions , FILE /builds/omniverse/physics/physx/source/gpubroadphase/src/PxgAABBManager.cpp, LINE 1287

My modified code snippet of joint_pos_env_cfg.py is here:

    self.scene.object = RigidObjectCfg(
        prim_path="{ENV_REGEX_NS}/Object",
        init_state=RigidObjectCfg.InitialStateCfg(pos=[0.5, 0, 0.055], rot=[0.7071068, -0.7071068, 0, 0]),   #rot=[0.7071068, -0.7071068, 0, 0]
        spawn=UsdFileCfg(
            usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/YCB/Axis_Aligned_Physics/006_mustard_bottle.usd",
            # usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/Blocks/DexCube/dex_cube_instanceable.usd",
            scale=(0.8, 0.8, 0.8),
            rigid_props=RigidBodyPropertiesCfg(
                solver_position_iteration_count=16,
                solver_velocity_iteration_count=1,
                max_angular_velocity=1000.0,
                max_linear_velocity=1000.0,
                max_depenetration_velocity=5.0,
                disable_gravity=False,
            ),
        ),
    )

I am using RTX 4090 GPU by the way. How to solve this problem?

martinmatak commented 1 month ago
multiplier = max(1, batch_size // 256)
n_pairs = simulation_context.get_physics_context().get_gpu_found_lost_aggregate_pairs_capacity()
simulation_context.get_physics_context().set_gpu_found_lost_aggregate_pairs_capacity(n_pairs * multiplier)

this works for me

hanlin-ga commented 1 month ago
multiplier = max(1, batch_size // 256)
n_pairs = simulation_context.get_physics_context().get_gpu_found_lost_aggregate_pairs_capacity()
simulation_context.get_physics_context().set_gpu_found_lost_aggregate_pairs_capacity(n_pairs * multiplier)

this works for me

Thanks for the reply, did you add this in manager_based_env.py? @martinmatak

martinmatak commented 1 month ago

simulation_context variable above is an instance of omni.isaac.core.SimulationContext, it doesn't depend on a particular filename

hanlin-ga commented 1 month ago

Thank you, the error is gone now. @martinmatak

Mayankm96 commented 1 month ago

You can also set this into the simulation configuration directly: https://isaac-sim.github.io/IsaacLab/source/api/lab/omni.isaac.lab.sim.html#omni.isaac.lab.sim.PhysxCfg.gpu_total_aggregate_pairs_capacity

Fuhua-Bot commented 1 month ago

simulation_context variable above is an instance of omni.isaac.core.SimulationContext, it doesn't depend on a particular filename

Hi, @martinmatak , I met the same problem, and with using isaaclab, could you please tell me how to add these into a manager based RL env config? thanks.

kellyguo11 commented 1 month ago

You can specify this parameter in PhysxCfg, as Mayank linked to above. An example of using this in the manager based RL env is here: https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/manipulation/inhand/inhand_env_cfg.py#L322.