I am creating a robot simulation in MuJoCo Py.
When I try to render in every loop iteration, my simulation runs in less than real-time.
I am trying to simulate at 100Hz.
Even though i am using ROS rate.sleep() as the last loop argument, some loop iterations take more than the allowed 10ms.
e.g when playing a 60s sequence (loop should stop at step 6000 after 60s):
Real Time Duraion: 60.00s Loop Duarion 71.72s
Maximal Time Durations
Total 22.61ms at step 1505
Control 0.49ms
Log 8.51ms
Simulation 0.83ms
Render 22.36ms
Total Duration must not be larger than: 10.00ms
Current Frequency: 100
Potential Maximal Frequency: 44
The thing is that most iterations take much shorter, only some take longer than 10ms. And they are slowing down the loop.
I tried moving the viewer.render() to a subthread, but this is not working, apparently it must be in the main thread.
I am creating a robot simulation in MuJoCo Py. When I try to render in every loop iteration, my simulation runs in less than real-time.
I am trying to simulate at 100Hz.
Even though i am using ROS rate.sleep() as the last loop argument, some loop iterations take more than the allowed 10ms. e.g when playing a 60s sequence (loop should stop at step 6000 after 60s):
The thing is that most iterations take much shorter, only some take longer than 10ms. And they are slowing down the loop.
I tried moving the viewer.render() to a subthread, but this is not working, apparently it must be in the main thread.
Is there any other solution for this?