Running Particle System on python script

Hello,

I try to run a simulation where I have a cloth composed of a particle system.

I have set up a physics_context and enabled the gpu but I have the following error

2022-10-21 15:03:50 [53,093ms] [Error] [omni.physx.plugin] Particles feature is only supported on GPU. Please enable GPU dynamics flag in Property/Scene of physics scene!
2022-10-21 15:03:50 [53,093ms] [Error] [omni.physx.plugin] Particle Cloth feature is only supported on GPU. Please enable GPU dynamics flag in Property/Scene of physics scene!
2022-10-21 15:04:18 [81,353ms] [Error] [omni.physicsschema.plugin] Rigid Body of (/World/SimpleCase/brush_handle_v4/component1/component1) missing xformstack reset when child of rigid body (/World/SimpleCase/brush_handle_v4/component1) in hierarchy. Simulation of multiple RigidBodyAPI’s in a hierarchy will cause unpredicted results. Please fix the hierarchy or use XformStack reset.
2022-10-21 15:04:18 [81,446ms] [Warning] [omni.physx.plugin] Scene reference from prim /World/SimpleCase/ParticleSystem could not be found. Using the default physics scene.
2022-10-21 15:04:18 [81,464ms] [Warning] [omni.hydra] Mesh /World/SimpleCase/brush_handle_v4/component2/component2 update topology/point without updating normal, fallback to smooth normal.

Here my piece of code that I try to run

scene_usd_path = “/home/btabia/git/virtual_sweeping/first_trial/cube_brush_scene.usd”
scene_prim_path = “/World/SimpleCase”

class Environment():
def init(self, scene_usd_path=“None”, scene_prim_path=“None”):
# instanciate the world
self.world = World(device = “GPU”, physics_prim_path = “/World/SimpleCase/PhysicsScene”)
self.usd_path = scene_usd_path
self.prim_path = scene_prim_path
# Set physics scene to use gpu physics
self.physics_context = PhysicsContext(prim_path = “/World/SimpleCase/PhysicsScene”)
self.physics_context.enable_gpu_dynamics(True)
# integrate the scene
self.env = add_reference_to_stage(usd_path = self.usd_path, prim_path = self.prim_path)
self.world.reset()

1 Like

I have the same error about Particle Feature GPU support. I have an RTX 2080Ti and installed proper drivers. Does anyone know a solution?

I have the same problem. If I use the GUI to add the particle system I can correctly simulate it, but if I add it programatically, as @bechir.tabia suggests, I get the error:

[Error] [omni.physx.plugin] Particles feature is only supported on GPU. Please enable GPU dynamics flag in Property/Scene of physics scene!

Even though GPU dynamics is set to True from the script and I can correctly verify that it is active in the PhysicsScene component in the GUI.

Any advice why this is happening?

1 Like

If you want to run your simulation programmatically for simulating particle systems, you need to set up your world and physics environment as such :

    #instanciate the world
    self.world = World(
        physics_prim_path = self.env_config["env"]["world"]["physics_prim_path"],
        physics_dt = self._physics_dt,
        rendering_dt = self.rendering_dt,
        stage_units_in_meters = self.env_config["env"]["world"]["stage_unit_in_meters"],
        device = "cuda",
        backend = "torch",
        )
    # set up the physics context
    omni.timeline.get_timeline_interface().play()
    self.physics_context = PhysicsContext(
                            prim_path = self.env_config["env"]["world"]["physics_prim_path"],
                            device = "cuda",
                            backend = "torch",
                            )
    self.physics_context.enable_gpu_dynamics(self.env_config["env"]["world"]["enable_gpu_dynamics"])

    if self.physics_context.use_gpu_pipeline:
        self.physics_context.enable_flatcache(True)
    set_carb_setting(self.world._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)