Python bindings - huge performance overhead #2154
-
IntroHi! I am a graduate student, I use MuJoCo for a reinforcement learning. My setup
My questionMaybe I'm using Mujoco bindings incorrectly, but I have a problem with huge overheads when iterating the Is there some faster way I can access the collision data, or the data struct in general? Minimal model and/or code that explain my questiondef _updateCollisionNormals(self) -> list[float]:
collisions = self.collisions
for contact in self.data.contact:
for rod_i, (min_i, max_i) in enumerate(self.collision_map):
pidx = contact.geom[1]
if min_i <= pidx <= max_i:
break # TODO 720 steps in one second: def stepSimulation(self):
self.clearCollisionNormals()
# Step simulation
for i in range(self.internal_step_factor):
mj.mj_step(MODEL, self.data)
self._updateCollisionNormals()
... 1400 steps in one second: def stepSimulation(self):
self.clearCollisionNormals()
# Step simulation
for i in range(self.internal_step_factor):
mj.mj_step(MODEL, self.data)
# self._updateCollisionNormals()
... Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Solved by accessing through index instead of iteration. |
Beta Was this translation helpful? Give feedback.
To clarify for the benefit of future readers, you replaced
with
correct?