Run usd physics simulation in a certain step

Hi, I’m trying to run physics simulation in kits’ extension. In the extension I’m creating the geometry and assigning the physic schema to them. I want to run the simulation in a certain step. Currently what I’m doing was to call timeline.forward_one_frame() and then call kit.app.update() in a loop. Will I get a correct simulation result using such method? Or is there any other method to get a simulation result without using the timeline?
Thanks!

Well it is not really “without a timeline” because you are still stepping one frame into the simulation. But yes it should work for that very small amount of time, but you may not see much change. I would simply run the simulation as normal in your kit app or USD Composer, by playing the timeline as normal. Then make sure the physics simulation performs as expected. Then each frame should be correct. And if you want to go from frame to frame, that should all work. There would be no need to call for a kit app update. Once the simulation is processed it should be automatically updated by simply going to the next frame.

Thanks! I’m creating usd geometry and doing physics simulation within a reinforcement learning environment class. Then in each step for RL agent use the displacement of the geometry as a reward while training. I tried not calling the kit app update but then it seems to be not running the simulation in training. Is there any other method to get the position of the xforms after a certain step to accelerate my training process?

You should just be able to query the position of any prim in the scene with python code and get back the xyz coordinates. Let me see if I can find some code for you.

Any reason you’re not using Isaac Lab? Isaac Lab environments give you easy access to the physics step.

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