Real-time simulation updates + ROS publishing via Python API

I’ve been trying to get Isaac Sim to simulate in real-time while being run by Python API. So far, I’ve been trying:

for i in range(30 * 60):
    kit.update(1.0 / 30.0)

to get the simulator to update at 30 Hz for a minute. However, this does not seem to work – most of the time it ends up running for over a minute. Additionally, when I run rostopic hz /rgb on an /rgb topic for a camera in the simulation, the publish rate varies wildly – sometimes it’s consistently > 40 Hz, other times it’s only around ~14 Hz.

  1. Is there any way to get the simulator to run in real-time, like when running the simulator via GUI and not the Python API?
  2. Why does the ROS topic vary so much between different sessions? Is there a way to have it publish at a consistent rate / set the rate of publishing?
  3. How does one get the simulator to run indefinitely? E.g. until the program is closed. I assume there’s a better way than just using while True: kit.update()?
  4. Is there any good example Python script that I can look at to understand the above questions? I’ve looked at some of the stuff in omni.isaac.samples, but can’t seem to find where the “simulation loop” is for the examples I’ve examined.

Will look into this, currently there aren’t any pure python ROS samples, but we should have one. I will share the .py file here when I have something.

1 Like

Alright, thanks!