I’m having problems setting GPU dynamics programatically in the physicsScene for a scene with a ParticleSystem. The physicalScene correctly sets the GPU flag but apparently is not applied even if you stop/start the simulation. It only makes effect if you manually click on the physicsScene in the GUI.
To demostrate this error, I’ve created a simple script loading a usd reference which contains a cube with a ParticleSystem already set. Find attached the usd file and the script used.
from omni.isaac.kit import SimulationApp
CONFIG = {"renderer": "RayTracedLighting", "headless": False}
simulation_app = SimulationApp(CONFIG)
from omni.isaac.core import SimulationContext, utils # noqa E402
simulation_context = SimulationContext(stage_units_in_meters=1.0)
# Configure the physics scene to use GPU dynamics for particles (fluids)
physics_context = simulation_context.get_physics_context()
physics_context.enable_ccd(False)
physics_context.enable_gpu_dynamics(True)
# Loading the cube with the particle sampler as a reference
utils.stage.add_reference_to_stage("particle_cube.usda", "/cube_reference")
simulation_app.update()
simulation_context.initialize_physics()
simulation_context.play()
while simulation_app.is_running():
simulation_context.step(render=True)
simulation_context.stop()
simulation_app.close()
That might indicate some IsaacSim script issues, you can try to directly access the physicsScene prim and set the attribute, which is what the script should do.
I think the setting might get overridden by IsaacSim scripts, because GPU dynamics is enabled by default, I would try to move the attribute change right before the play.
No CCD is unrelated you can leave it on or off as you wish.
Sorry I am not very familiar with all IsaacSim scripts, I am working mostly on the physics side.
So yes I think you need to set the device to CUDA to enable the GPU simulation, the particles should move, the update through Fabric/Flatcache is supported since 104.1 Kit release (help → about should tell you what version you do use).
However since particles are pretty much not supported by IsaacSim, I am wondering why do you use the script at all? Why dont you just simulate stuff through regular python and USD APIs? If things work fine through UI?
I’m using Isaac Sim 2022.2.1 with Kit 104.2. Launching Isaac from python doesn’t have the Help tab but I assume is using the same Kit version.
I didn’t know that particles where not fully supported on Isaac. For me they work good, except fot the issue explained in this post. I’m developing a project that needs to simulate fluids and connects to ROS, that’s why is handy to have a python script launching the simulation
With the line I posted previously, which set Fabric/Flatcache, the particles aren’t moving but no error appears. Maybe Fabric for particles is not supported by Isaac yet?
Well for particles you need GPU enabled, so the CUDA device should be set, that sounds good. Why particles dont move I am not sure, that sounds like a bug. I hope Kelly can comment more on the IsaacSim side, they should work with standalone physics simulation .
We had some issues with deformable rendering with the GPU pipeline, it’s possible the issue also appears for particles. I will confirm this on our end.
For now, you can initialize the SimulationContext with cpu device, adding set_defaults=False to the arguments so that it does not override the default settings for enabling GPU simulation. It seems like a bug to me that we cannot override the setting somehow, even though the UI reflects the change.